text:
package org.mapdb;

import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.*;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.LockSupport;

import static org.junit.Assert.*;

@SuppressWarnings({ "unchecked", "rawtypes" })
public class DBMakerTest{

    private void verifyDB(DB db) {
        Map m = db.hashMap("test");
        m.put(1,2);
        assertEquals(2, m.get(1));
    }

    @Test
    public void testNewMemoryDB() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                .make();
        verifyDB(db);
    }

    @Test
    public void testNewFileDB() throws Exception {
        File f = TT.tempDbFile();
        DB db = DBMaker.fileDB(f)
                .transactionDisable().make();
        verifyDB(db);
    }

    @Test
    public void testDisableTransactions() throws Exception {
        DBMaker.memoryDB().make();
    }

    @Test
    public void testDisableCache() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                 .make();
        verifyDB(db);
        Store s = Store.forDB(db);
        assertEquals(s.getClass(), StoreDirect.class);
    }

    @Test
    public void testMake() throws Exception {
        DB db = DBMaker
                .fileDB(TT.tempDbFile())
                .transactionDisable()
                .make();
        verifyDB(db);
        //check default values are set
        Engine w =  db.engine;
        Store store = Store.forDB(db);
        assertNull(store.caches);
        StoreDirect s = (StoreDirect) store;
        assertTrue(s.vol instanceof Volume.RandomAccessFileVol);
    }

    @Test
    public void testCacheHashTableEnable() throws Exception {
        DB db = DBMaker
                .fileDB(TT.tempDbFile())
                .cacheHashTableEnable()
                .transactionDisable()
                .make();
        verifyDB(db);
        //check default values are set
        Engine w =  db.engine;
        Store store = Store.forDB(db);
        assertTrue(store.caches[0] instanceof Store.Cache.HashTable);
        assertEquals(1024 * 2, ((Store.Cache.HashTable) store.caches[0]).items.length * store.caches.length);
        StoreDirect s = (StoreDirect) store;
        assertTrue(s.vol instanceof Volume.RandomAccessFileVol);
    }

    @Test
    public void testMakeMapped() throws Exception {
        DB db = DBMaker
                .fileDB(TT.tempDbFile())
                .transactionDisable()
                .mmapFileEnable()
                .make();
        verifyDB(db);
        //check default values are set
        Engine w = db.engine;
        Store store = Store.forDB(db);
        StoreDirect s = (StoreDirect) store;
        assertTrue(s.vol instanceof Volume.MappedFileVol);
    }

    @Test
    public void testCacheHardRefEnable() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                .cacheHardRefEnable()
                .make();
        verifyDB(db);
        Store store = Store.forDB(db);
        assertTrue(store.caches[0].getClass() == Store.Cache.HardRef.class);
    }

    @Test
    public void testCacheWeakRefEnable() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                .cacheWeakRefEnable()
                .make();
        verifyDB(db);
        Store store = Store.forDB(db);
        Store.Cache cache = store.caches[0];
        assertTrue(cache.getClass() == Store.Cache.WeakSoftRef.class);
        assertTrue(((Store.Cache.WeakSoftRef) cache).useWeakRef);
    }

    @Test
    public void testCacheSoftRefEnable() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                .cacheSoftRefEnable()
                .make();
        verifyDB(db);
        Store store = Store.forDB(db);
        assertTrue(store.caches[0].getClass() == Store.Cache.WeakSoftRef.class);
        assertFalse(((Store.Cache.WeakSoftRef) store.caches[0]).useWeakRef);
    }

    @Test
    public void testCacheLRUEnable() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                .cacheLRUEnable()
                .make();
        verifyDB(db);
        Store store = Store.forDB(db);
        assertTrue(store.caches[0].getClass() == Store.Cache.LRU.class);
        db.close();
    }

    @Test
    public void testCacheSize() throws Exception {
        DB db = DBMaker
                .memoryDB()
                .transactionDisable()
                .cacheHashTableEnable()
                .cacheSize(1000)
                .make();
        verifyDB(db);
        Store store = Store.forDB(db);
        assertEquals(1024, ((Store.Cache.HashTable) store.caches[0]).items.length * store.caches.length);
    }

    @Test public void read_only() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker.fileDB(f).make();
        db.close();
        db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()
                .readOnly()
                .make();
        assertTrue(db.engine instanceof Engine.ReadOnlyWrapper);
        db.close();
    }

    @Test(expected = DBException.WrongConfig.class)
    public void reopen_wrong_checksum() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker.fileDB(f).make();
        db.close();
        db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()

                .checksumEnable()
                .make();
        Engine w = db.engine;
        assertTrue(w instanceof TxEngine);

        Store s = Store.forEngine(w);
        assertTrue(s.checksum);
        assertTrue(!s.compress);
        assertTrue(!s.encrypt);
        db.close();
    }

    @Test public void checksum() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()
                .checksumEnable()
                .make();

        Store s = Store.forDB(db);
        assertTrue(s.checksum);
        assertTrue(!s.compress);
        assertTrue(!s.encrypt);
        db.close();
    }

    @Test public void encrypt() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()
                .encryptionEnable("adqdqwd")
                .make();
        Store s = Store.forDB(db);
        assertTrue(!s.checksum);
        assertTrue(!s.compress);
        assertTrue(s.encrypt);
        db.close();
    }

    @Test(expected = DBException.WrongConfig.class)
    public void reopen_wrong_encrypt() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker.fileDB(f).make();
        db.close();
        db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()
                .encryptionEnable("adqdqwd")
                .make();
        Store s = Store.forDB(db);
        assertTrue(!s.checksum);
        assertTrue(!s.compress);
        assertTrue(s.encrypt);
        db.close();
    }

    @Test public void compress() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()
                .compressionEnable()
                .make();
        Store s = Store.forDB(db);
        assertTrue(!s.checksum);
        assertTrue(s.compress);
        assertTrue(!s.encrypt);
        db.close();
    }

    @Test(expected = DBException.WrongConfig.class)
    public void reopen_wrong_compress() throws IOException {
        File f = TT.tempDbFile();
        DB db = DBMaker.fileDB(f).make();
        db.close();
        db = DBMaker
                .fileDB(f)
                .deleteFilesAfterClose()
                .compressionEnable()
                .make();
        Engine w = db.engine;
        assertTrue(w instanceof TxEngine);
        Store s = Store.forEngine(w);
        assertTrue(!s.checksum);
        assertTrue(s.compress);
        assertTrue(!s.encrypt);

        db.close();
    }

    @Test public void close_on_jvm_shutdown(){
        DBMaker
                .tempFileDB()
                .closeOnJvmShutdown()
                .deleteFilesAfterClose()
                .make();
    }

    @Test public void tempTreeMap(){
        ConcurrentNavigableMap<Long,String> m = DBMaker.tempTreeMap();
        m.put(111L,"wfjie");
        assertTrue(m.getClass().getName().contains("BTreeMap"));
    }

    @Test public void tempHashMap(){
        ConcurrentMap<Long,String> m = DBMaker.tempHashMap();
        m.put(111L, "wfjie");
        assertTrue(m.getClass().getName().contains("HTreeMap"));
    }

    @Test public void tempHashSet(){
        Set<Long> m = DBMaker.tempHashSet();
        m.add(111L);
        assertTrue(m.getClass().getName().contains("HTreeMap"));
    }

    @Test public void tempTreeSet(){
        NavigableSet<Long> m = DBMaker.tempTreeSet();
        m.add(111L);
        assertTrue(m.getClass().getName().contains("BTreeMap"));
    }

    @Test public void keys_value_matches() throws IllegalAccessException {
        Class c = DBMaker.Keys.class;
        Set<Integer> s = new TreeSet<Integer>();
        for (Field f : c.getDeclaredFields()) {
            f.setAccessible(true);
            String value = (String) f.get(null);

            String expected = f.getName().replaceFirst("^[^_]+_","");
            assertEquals(expected, value);
        }
    }

    File folderDoesNotExist = new File("folder-does-not-exit/db.aaa");

    @Test(expected = DBException.VolumeIOError.class)
    public void nonExistingFolder(){
        DBMaker.fileDB(folderDoesNotExist).make();
    }

    @Test(expected = DBException.VolumeIOError.class)
    public void nonExistingFolder3(){
        DBMaker.fileDB(folderDoesNotExist).mmapFileEnable().make();
    }

    @Test(expected = DBException.VolumeIOError.class)
    public void nonExistingFolder2(){
        DBMaker
                .fileDB(folderDoesNotExist)
                .snapshotEnable()
                .commitFileSyncDisable()
                .makeTxMaker();
    }

    @Test public void treeset_pump_presert(){
        List unsorted = Arrays.asList(4,7,5,12,9,10,11,0);

        NavigableSet<Integer> s = DBMaker.memoryDB().transactionDisable().make()
                .treeSetCreate("t")
                .pumpPresort(10)
                .pumpSource(unsorted.iterator())
                .make();

        assertEquals(Integer.valueOf(0),s.first());
        assertEquals(Integer.valueOf(12), s.last());
    }

    @Test public void treemap_pump_presert(){
        List unsorted = Arrays.asList(4,7,5,12,9,10,11,0);

        BTreeMap<Integer,Integer> s = DBMaker.memoryDB().transactionDisable().make()
                .treeMapCreate("t")
                .pumpPresort(10)
                .pumpSource(unsorted.iterator(), Fun.extractNoTransform())
                .make();

        assertEquals(Integer.valueOf(0),s.firstEntry().getKey());
        assertEquals(Integer.valueOf(12), s.lastEntry().getKey());
        s.close();
    }

    @Test public void heap_store(){
        DB db = DBMaker.heapDB().make();
        Engine  s = Store.forDB(db);

        assertTrue(s instanceof StoreHeap);
        db.close();
    }

    @Test public void executor() throws InterruptedException {
        if(TT.scale()==0)
            return;
        final DB db = DBMaker.heapDB().executorEnable().make();
        assertNotNull(db.executor);
        assertFalse(db.executor.isTerminated());

        final AtomicBoolean b = new AtomicBoolean(true);

        Runnable r = new Runnable() {
            @Override
            public void run() {
                while(b.get()) {
                    LockSupport.parkNanos(10);
                }
            }
        };

        db.executor.execute(r);

        final AtomicBoolean closed = new AtomicBoolean();
        new Thread(){
            @Override
            public void run() {
                db.close();
                closed.set(true);
            }
        }.start();

        Thread.sleep(1000);
        assertTrue(db.executor.isShutdown());

        //shutdown the task
        b.set(false);
        Thread.sleep(2000);
        assertTrue(closed.get());
        assertNull(db.executor);
        db.close();
    }

    @Test public void temp_HashMap_standalone(){
        HTreeMap m = DBMaker.tempHashMap();
        assertTrue(m.closeEngine);
        m.close();
    }

    @Test public void temp_TreeMap_standalone(){
        BTreeMap m = DBMaker.tempTreeMap();
        assertTrue(m.closeEngine);
        m.close();
    }

    @Test public void temp_HashSet_standalone() throws IOException {
        HTreeMap.KeySet m = (HTreeMap.KeySet) DBMaker.tempHashSet();
        assertTrue(m.getHTreeMap().closeEngine);
        m.close();
    }

    @Test public void temp_TreeSet_standalone() throws IOException {
        BTreeMap.KeySet m = (BTreeMap.KeySet) DBMaker.tempTreeSet();
        assertTrue(((BTreeMap)m.m).closeEngine);
        m.close();
    }

    @Test public void metricsLog(){
        ScheduledExecutorService s = Executors.newSingleThreadScheduledExecutor();
        DB db = DBMaker.memoryDB()
                .metricsEnable(11111)
                .metricsExecutorEnable(s)
                .make();

        //TODO test task was scheduled with correct interval
        assertTrue(s==db.metricsExecutor);
        assertNull(db.executor);
        db.close();
    }

    @Test public void storeExecutor(){
        ScheduledExecutorService s = Executors.newSingleThreadScheduledExecutor();
        DB db = DBMaker.memoryDB()
                .storeExecutorPeriod(11111)
                .storeExecutorEnable(s)
                .make();

        //TODO test task was scheduled with correct interval
        assertTrue(s==db.storeExecutor);
        assertNull(db.executor);
        db.close();
    }

    @Test public void cacheExecutor(){
        ScheduledExecutorService s = Executors.newSingleThreadScheduledExecutor();
        DB db = DBMaker.memoryDB()
                .cacheExecutorPeriod(11111)
                .cacheExecutorEnable(s)
                .make();

        //TODO test task was scheduled with correct interval
        assertTrue(s==db.cacheExecutor);
        assertNull(db.executor);
        db.close();
    }

    @Test public void asyncWriteCache(){
        DB db = DBMaker.memoryDB()
                .asyncWriteEnable()
                .transactionDisable()
                .make();
        assertEquals(StoreCached.class, Store.forDB(db).getClass());
        db.close();
    }

    @Test public void asyncWriteQueueSize(){
        DB db = DBMaker.memoryDB()
                .asyncWriteEnable()
                .asyncWriteQueueSize(12345)
                .transactionDisable()
                .make();
        StoreCached c = (StoreCached) Store.forDB(db);
        assertEquals(12345,c.writeQueueSize);
        db.close();
    }

    @Test public void hashmap_segmented(){
        HTreeMap m = DBMaker
                .hashMapSegmentedMemory()
                .make();

        if(HTreeMap.SEG==1)
            return;

        assertNotSame(m.engines[0], m.engines[1]);

        StoreDirect s = (StoreDirect) m.engines[0];
        assertSame(Store.NOLOCK, s.locks[0].readLock());
        assertSame(Store.NOLOCK, s.locks[0].writeLock());
        assertEquals(1, s.locks.length);
        assertFalse(s.isClosed());

        m.close();

        for(Engine e:m.engines){
            assertTrue(e.isClosed());
        }
    }

    @Test public void hashmap_segmented_expiration(){
        HTreeMap m = DBMaker
                .hashMapSegmentedMemory()
                .expireAfterWrite(100)
                .executorEnable()
                .make();

        if(HTreeMap.SEG==1)
            return;

        assertNotSame(m.engines[0], m.engines[1]);

        StoreDirect s = (StoreDirect) m.engines[0];
        assertSame(Store.NOLOCK, s.locks[0].readLock());
        assertSame(Store.NOLOCK, s.locks[0].writeLock());
        assertEquals(1, s.locks.length);
        assertFalse(s.isClosed());

        m.close();
        assertTrue(m.executor.isTerminated());

        for(Engine e:m.engines){
            assertTrue(e.isClosed());
        }
    }

    @Test public void fileChannel(){
        DB db = DBMaker.fileDB(TT.tempDbFile())
                .fileChannelEnable()
                .transactionDisable().make();
        StoreDirect d = (StoreDirect) Store.forDB(db);
        assertEquals(Volume.FileChannelVol.class, d.vol.getClass());
        db.close();
    }

    @Test public void fileMmapCleanerHack_file(){
        DB db = DBMaker.fileDB(TT.tempDbFile())
                .fileMmapEnable()
                .transactionDisable()
                .make();
        assertFalse(((Volume.MappedFileVol)((StoreDirect) db.engine).vol).cleanerHackEnabled);
        db.close();

        db = DBMaker.fileDB(TT.tempDbFile())
                .fileMmapEnable()
                .fileMmapCleanerHackEnable()
                .transactionDisable()
                .make();
        assertTrue(((Volume.MappedFileVol) ((StoreDirect) db.engine).vol).cleanerHackEnabled);
        db.close();
    }

    @Test public void fileMmapCleanerHack_memory(){
        DB db = DBMaker.memoryDirectDB()
                .transactionDisable()
                .make();
        assertFalse(((Volume.ByteBufferVol) ((StoreDirect) db.engine).vol).cleanerHackEnabled);
        db.close();

        db = DBMaker.memoryDirectDB()
                .fileMmapCleanerHackEnable()
                .transactionDisable()
                .make();
        assertTrue(((Volume.ByteBufferVol) ((StoreDirect) db.engine).vol).cleanerHackEnabled);
        db.close();
    }

    @Test public void file_locked() throws IOException {
        File f = File.createTempFile("mapdbTest", "mapdb");
        DB db = DBMaker.fileDB(f).transactionDisable().make();

        StoreDirect s = (StoreDirect) db.getEngine();
        assertTrue(s.vol.getFileLocked());
        assertNull(s.fileLockHeartbeat);
        db.close();
    }

    @Test public void file_locked_disabled() throws IOException {
        File f = File.createTempFile("mapdbTest","mapdb");
        DB db = DBMaker.fileDB(f).transactionDisable()
                .fileLockDisable()
                .make();

        StoreDirect s = (StoreDirect) db.getEngine();
        assertFalse(s.vol.getFileLocked());
        assertNull(s.fileLockHeartbeat);
        db.close();
    }

    @Test public void file_locked_disabled_wal() throws IOException {
        File f = File.createTempFile("mapdbTest","mapdb");
        DB db = DBMaker.fileDB(f)
                .fileLockDisable()
                .make();

        StoreWAL s = (StoreWAL) db.getEngine();
        assertFalse(s.vol.getFileLocked());
        assertFalse(s.curVol.getFileLocked());
        assertNull(s.fileLockHeartbeat);
        db.close();
    }

    @Test public void file_locked_disabled_append() throws IOException {
        File f = File.createTempFile("mapdbTest","mapdb");
        DB db = DBMaker.appendFileDB(f)
                .fileLockDisable()
                .make();

        StoreAppend s = (StoreAppend) db.getEngine();
        assertFalse(s.vol.getFileLocked());
        assertNull(s.fileLockHeartbeat);
        db.close();
    }

    @Test public void file_locked_heartbeat() throws IOException {
        File f = File.createTempFile("mapdbTest","mapdb");
        DB db = DBMaker.fileDB(f).transactionDisable()
                .fileLockHeartbeatEnable()
                .make();

        StoreDirect s = (StoreDirect) db.getEngine();
        assertFalse(s.vol.getFileLocked());

        assertTrue(s.fileLockHeartbeat.isLocked());
        assertEquals(new File(f.getPath() + ".lock"), s.fileLockHeartbeat.getFile());
        db.close();
    }

    @Test public void allocate_start_size(){
        DB db = DBMaker.memoryDB().allocateStartSize(20 * 1024 * 1024 - 10000).make();
        StoreWAL wal = (StoreWAL) Store.forDB(db);
        assertEquals(1024 * 1024, wal.curVol.length());
        assertEquals(20*1024*1024, wal.vol.length());
        db.close();
    }

    @Test public void allocate_start_size_file(){
        DB db = DBMaker.fileDB(TT.tempDbFile()).allocateStartSize(20 * 1024*1024 -10000).make();
        StoreWAL wal = (StoreWAL) Store.forDB(db);
        assertEquals(16, wal.curVol.length());
        assertEquals(20*1024*1024, wal.vol.length());
        db.close();
    }

    @Test public void allocate_start_size_mmap(){
        DB db = DBMaker.fileDB(TT.tempDbFile()).fileMmapEnable().allocateStartSize(20 * 1024*1024 -10000).make();
        StoreWAL wal = (StoreWAL) Store.forDB(db);
        assertEquals(1024*1024, wal.curVol.length());
        assertEquals(20*1024*1024, wal.vol.length());
        db.close();
    }

    @Test public void allocate_increment(){
        DB db = DBMaker.memoryDB().allocateIncrement(20 * 1024 * 1024 - 10000).make();
        StoreWAL wal = (StoreWAL) Store.forDB(db);
        assertEquals(1024 * 1024, wal.curVol.length());
        assertEquals(32*1024*1024, wal.realVol.length());
        wal.realVol.ensureAvailable(35 * 1024 * 1024);
        assertEquals(64 * 1024 * 1024, wal.realVol.length());

        db.close();
    }

    @Test public void allocate_increment_mmap(){
        DB db = DBMaker.fileDB(TT.tempDbFile()).fileMmapEnable().allocateIncrement(20 * 1024 * 1024 - 10000).make();
        StoreWAL wal = (StoreWAL) Store.forDB(db);
        assertEquals(1024 * 1024, wal.curVol.length());
        assertEquals(32*1024*1024, wal.realVol.length());
        wal.realVol.ensureAvailable(35 * 1024 * 1024);
        assertEquals(64 * 1024 * 1024, wal.realVol.length());

        db.close();
    }

    @Test public void serializer_class_loader(){
        final Set<String> loadedClasses = new HashSet<String>();
        ClassLoader l = new ClassLoader() {
            @Override
            public Class<?> loadClass(String name) throws ClassNotFoundException {
                loadedClasses.add(name);
                return super.loadClass(name);
            }
        };
        DB db = DBMaker.memoryDB().serializerClassLoader(l).transactionDisable().make();

        TT.clone(new Class1(), db.getDefaultSerializer());
        assertTrue(loadedClasses.contains(Class1.class.getName()));

        db.close();
        loadedClasses.clear();

        db = DBMaker.memoryDB()
                .serializerRegisterClass(Class2.class.getName(),l)
                .transactionDisable()
                .make();

        TT.clone(new Class2(), db.getDefaultSerializer());
        assertTrue(loadedClasses.contains(Class2.class.getName()));
        db.close();
    }

    public static class Class1 implements Serializable {
    }

    public static class Class2 implements Serializable {
    }

    @Test public void cc() throws IllegalAccessException {
        assertEquals(CC.DEFAULT_CACHE, DBMaker.CC().get("DEFAULT_CACHE"));
    }
}


text:
require 'vertx-web/session_store'
require 'vertx/vertx'
require 'vertx/util/utils.rb'
# Generated from io.vertx.ext.web.sstore.LocalSessionStore
module VertxWeb
  #  A session store which is only available on a single node.
  #  <p>
  #  Can be used when sticky sessions are being used.
  class LocalSessionStore < ::VertxWeb::SessionStore
    # @private
    # @param j_del [::VertxWeb::LocalSessionStore] the java delegate
    def initialize(j_del)
      super(j_del)
      @j_del = j_del
    end
    # @private
    # @return [::VertxWeb::LocalSessionStore] the underlying java delegate
    def j_del
      @j_del
    end
    #  Create a session store
    # @param [::Vertx::Vertx] vertx the Vert.x instance
    # @param [String] sessionMapName name for map used to store sessions
    # @param [Fixnum] reaperInterval how often, in ms, to check for expired sessions
    # @return [::VertxWeb::LocalSessionStore] the session store
    def self.create(vertx=nil,sessionMapName=nil,reaperInterval=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && sessionMapName == nil && reaperInterval == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::LocalSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxWeb::LocalSessionStore)
      elsif vertx.class.method_defined?(:j_del) && sessionMapName.class == String && !block_given? && reaperInterval == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::LocalSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class]).call(vertx.j_del,sessionMapName),::VertxWeb::LocalSessionStore)
      elsif vertx.class.method_defined?(:j_del) && sessionMapName.class == String && reaperInterval.class == Fixnum && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebSstore::LocalSessionStore.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::java.lang.String.java_class,Java::long.java_class]).call(vertx.j_del,sessionMapName,reaperInterval),::VertxWeb::LocalSessionStore)
      end
      raise ArgumentError, "Invalid arguments when calling create(vertx,sessionMapName,reaperInterval)"
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
.. Copyright (c) 2007-2019 UShareSoft, All rights reserved

.. _deployments-terminate:

Terminating a deployment
========================

You terminate a deployment by running ``deploy terminate``:

.. code-block:: shell

	$ hammr deploy terminate --id <your-id>
        Do you really want to delete deployment with id t0id1exb3d [Y/n]
        Y
        Deployment is stopping
        |##############################################################|
        OK: Deployment terminated

This command will delete your deployment on the targeted cloud. You cand find the ID of the deployment by using the command ``deploy list``.


text:
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>zip-splitter</groupId>
  <artifactId>zip-splitter</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>ZipSplitter</name>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>ZipSplitter</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <properties>
  	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>


text:
package pr05_randomArrayList;

public class Main {
    public static void main(String[] args) {

        RandomArrayList ral = new RandomArrayList();
        ral.add("Pesho");
        ral.add(1);
        ral.add("989808");
        ral.add("ggggg");
        ral.add(3);

        System.out.println(ral.getRandomElement());
        System.out.println(ral.getRandomElement());
        System.out.println(ral.getRandomElement());
        System.out.println(ral.getRandomElement());

    }
}


text:
This plugin lets VIP users define areas of the world where only specified users are allowed to build and dig.

An area is defined by the VIP by using a Wand item (by default, a stick with a meta 1) by left-clicking and right-clicking in two opposite corners of the area, then issuing a /protection add command. Multiple users can be allowed in a single area. There is no hardcoded limit on the number of areas or the number of players allowed in a single area. Areas can overlap; in such a case, if a user is allowed in any one of the overlapping areas, they are allowed to build / dig.

The protected areas are stored in an SQLite database in a file "ProtectionAreas.sqlite" that is created next to the MCServer executable. The plugin has its configuration options stored in a "ProtectionAreas.ini" file.

# Configuration
The configuration is stored in the ProtectionAreas.ini file next to the MCServer executable in a regular manner.

The wand item can be specified in the configuration. By default, a stick with meta 1 is used, but any valid item can be used. Stored in the [ProtectionAreas].WandItem value.

If there is no area, players can be either allowed to interact freely or not at all, based on the setting in the [ProtectionAreas].AllowInteractNoArea value. Accepted values are 0 and 1.

# Commands

### General
| Command | Permission | Description |
| ------- | ---------- | ----------- |
|/protection add | protection.add | adds a new protected area using wand|
|/protection addc | protection.add | adds a new protected area with explicitly specified coordinates|
|/protection del | protection.del | deletes the specified area.|
|/protection list | protection.list | lists all areas in the specified place|
|/protection user add | protection.user.add | adds the specified users to the allowed users in the specified area|
|/protection user list | protection.user.list | lists all the allowed users for the specified area|
|/protection user remove | protection.user.remove | removes the specified users from the allowed users in the specified area|
|/protection user strip | protection.user.strip | removes the user from all areas in this world|
|/protection wand | protection.wand | gives the Wand item|

# Permissions
| Permissions | Description | Commands | Recommended groups |
| ----------- | ----------- | -------- | ------------------ |
| protection.add |  | `/protection addc`, `/protection add` |  |
| protection.del |  | `/protection del` |  |
| protection.list |  | `/protection list` |  |
| protection.user.add |  | `/protection user add` |  |
| protection.user.list |  | `/protection user list` |  |
| protection.user.remove |  | `/protection user remove` |  |
| protection.user.strip |  | `/protection user strip` |  |
| protection.wand |  | `/protection wand` |  |


text:
# Istio Mixer: Adapter Developer's Guide

This document is for developers looking to build an [adapter](https://istio.io/docs/concepts/policy-and-control/mixer.html#adapters)
for Istio's Mixer. Adapters integrate Mixer with different infrastructure backends that deliver core functionality, such
as logging, monitoring, quotas, ACL checking, and more. This guide explains the adapter model and adapter lifecycle, and
also walks through the step-by-step instructions for creating a simple adapter.

* [Background](#background)
* [Template overview](#template-overview)
* [Adapter lifecycle](#adapter-lifecycle)
* [Example](#example)
* [Summary diagrams](#summary-diagrams)
* [Plug adapter into Mixer](#plug-adapter-into-mixer)
* [Testing](#testing)
* [Do's and dont's](#dos-and-donts)
* [Built-in templates](#built-in-templates)
* [Walkthrough](#walkthrough-of-adapter-implementation-30-minutes)

# Background

[Mixer](https://istio.io/docs/concepts/policy-and-control/mixer.html) provides Istio's generic intermediation layer
between application code and infrastructure backends such as quota systems, access control systems, logging, and so
on. It is an [attribute](https://istio.io/docs/concepts/policy-and-control/attributes.html) processing engine that uses
operator-supplied [configuration](https://istio.io/docs/concepts/policy-and-control/mixer-config.html) to map request
attributes from the proxy into calls to these backend systems via a pluggable set of [adapters](https://istio.io/docs/concepts/policy-and-control/mixer.html#adapters).
Adapters enable Mixer to expose a single consistent API, independent of the infrastructure backends in use. The exact
set of adapters used at runtime is determined through operator configuration and can easily be extended to target new
or custom infrastructure backends.

![mixer architecture](./img/mixer%20architecture.svg)

Mixer structures its incoming attributes into a more useful form for adapters using
templates. Templates describe the form of data dispatched to adapters when processing a request and the interface that
the adapter must implement to receive this data. The operator that configures Istio controls how
this template-specific data is constructed and dispatched to adapters.

Out of the box, Mixer provides a suite of [default templates](#built-in-templates).
We strongly recommend that, when implementing adapters, you use Mixer's
default templates. Though if they are not suitable for your particular needs you can also [create your own templates](./templates.md)
along with adapters to consume the relevant data. Mixer also includes some [built-in adapters](https://github.com/istio/mixer/tree/master/adapter)
by default, but users may need to implement their own to let Mixer send data to their chosen backend.

The roles of the template author, adapter author, and the operator can be summarized as:

* The template author defines a *template*, which describes the data Mixer dispatches to adapters, and the
  interface that the adapter must implement to process that data. The supported set of templates within Mixer
  determines the various types of data an operator can configure Mixer to create and dispatch to the adapters.

* The adapter author selects the templates he/she wants to support based on the functionality the adapter must provide.
  The adapter author's role is to implement the required set of template-specific interfaces to process the data
  dispatched by Mixer at runtime.

* The operator defines what data should be collected
  ([instances](https://istio.io/docs/concepts/policy-and-control/mixer-config.html#instances)), where it can be sent
  ([handlers](https://istio.io/docs/concepts/policy-and-control/mixer-config.html#handlers)), and when to send it
  ([rules](https://istio.io/docs/concepts/policy-and-control/mixer-config.html#rules)).

![operator, adapter and template devs](./img/operator%20template%20adapter%20dev.svg)

# Template overview

To understand how an adapter receives and processes a template-specific instance, this section first
provides details about various artifacts of a template that are relevant for adapter development.

As we saw in the previous section, a build of Mixer supports a set of templates, and every template defines a kind
of data Mixer dispatches to adapters when processing a request, and also defines the interface for adapters to consume
that data.

The following diagram shows the various components of a template.

![template generated artifacts](./img/template%20generated%20artifacts.svg)

We'll look at each of these in more detail below.

## Template proto file

Templates are defined using a proto file with a message named `'Template'`. `Template` is a simple proto message with
no associated code. All of the Go artifacts used by adapters are automatically generated from the template protos.

Every template also has two additional properties associated with it:

* **Name**: Every template has a unique name. Adapter code uses the name of the template to register with Mixer that it
wants to consume `Instance` objects associated with a particular template. The template name is also used within
operator config to provide template-specific fields to attribute mapping, which is used to create `Instance `objects.

* **Template Variety**: Every template has a specific `template_variety` which can be either Check, Report or Quota.
The template and its variety determine the signatures of the methods that adapters must implement for consuming the
associated instances. The `template_variety` also determines under which of the core Mixer behaviors, check report or
quota, the `instances` for the templates should be created and dispatched to adapters.

## Generated Go code

Individual templates are processed in order to produce four Go artifacts:

* *Instance* struct: This defines the data that is passed to the adapters at request time. Mixer
constructs objects of the `Instance` type, based on the request attributes and operator configuration.

* *Handler* interface: This defines methods that Mixer uses to dispatch created `Instance` objects to the adapters at
request time. Adapters must implement one Handler interface per supported template type.

* *Type* struct: If the datatype of a field in the `Instance` Go struct is dynamic (`interface{}`), the datatype of the value it will
hold during request time is determined based on operator-supplied configuration. The type struct expresses
the datatype of dynamic fields using the [ValueType enum](https://github.com/istio/api/blob/master/mixer/v1/config/descriptor/value_type.proto),
which has 1:1 mapping between Go data types and its enum values.

* *HandlerBuilder* interface: This defines the methods that Mixer uses to pass the `Types`
to the adapter.  Mixer passes all possible type information for which the adapter might expect to receive corresponding
`Instance` objects at request time. Adapters implement per template `HandlerBuilder` interface for Mixer to call into them.

## Examples

These examples show three templates, one for each of the possible `template_variety` types. Each example shows a
`Template` message, and the resulting generated Go code.

### REPORT variety template

Template.proto

```proto

syntax = "proto3";

package metric;

import "mixer/v1/config/descriptor/value_type.proto";
import "pkg/adapter/template/TemplateExtensions.proto";

option (istio.mixer.v1.config.template.template_variety) = TEMPLATE_VARIETY_REPORT;

// Metric represents a single piece of data to report.
message Template {
   // The value being reported.
   istio.mixer.v1.config.descriptor.ValueType value = 1;

   // The unique identity of the particular metric to report.
   map<string, istio.mixer.v1.config.descriptor.ValueType> dimensions = 2;
}
```

Auto-generated Go code used by adapter implementation

```golang

package metric

import (
  "context"
  "istio.io/istio/mixer/pkg/adapter"
)

const TemplateName = "metric"

type Instance struct {
  Name string
  Value interface{}
  Dimensions map[string]interface{}
}

type Type struct {
  Value      istio_mixer_v1_config_descriptor.ValueType
  Dimensions map[string]istio_mixer_v1_config_descriptor.ValueType
}

type Handler interface {
  adapter.Handler
  HandleMetric(context.Context, []*Instance) error
}

type HandlerBuilder interface {
  adapter.HandlerBuilder
  SetMetricTypes(map[string]*Type /*Instance name -> Type*/)
}
```

### CHECK  variety template

Template.proto

```proto

syntax = "proto3";

package listentry;

import "pkg/adapter/template/TemplateExtensions.proto";

option (istio.mixer.v1.config.template.template_variety) = TEMPLATE_VARIETY_CHECK;

// ListEntry is used to verify the presence/absence of a string
// within a list.
message Template {
    // Specifies the entry to verify in the list.
    string value = 1;
}
```

Auto-generated Go code used by adapter implementation

```golang

package listentry

import (
	"context"

	"istio.io/istio/mixer/pkg/adapter"
)

const TemplateName = "listentry"

type Instance struct {
	// Name of the instance as specified in configuration.
	Name string

	// Specifies the entry to verify in the list.
	Value string
}

type Type struct {
}

type HandlerBuilder interface {
	adapter.HandlerBuilder
	SetListEntryTypes(map[string]*Type /*Instance name -> Type*/)
}

type Handler interface {
	adapter.Handler
	HandleListEntry(context.Context, *Instance) (adapter.CheckResult, error)
}
```

### QUOTA variety template

Template.proto

```proto

syntax = "proto3";

package metric;

import "mixer/v1/config/descriptor/value_type.proto";
import "pkg/adapter/template/TemplateExtensions.proto";

option (istio.mixer.v1.config.template.template_variety) = TEMPLATE_VARIETY_REPORT;

// Metric represents a single piece of data to report.
message Template {
   // The value being reported.
   istio.mixer.v1.config.descriptor.ValueType value = 1;

   // The unique identity of the particular metric to report.
   map<string, istio.mixer.v1.config.descriptor.ValueType> dimensions = 2;
}
```

Auto-generated Go code used by adapter implementation

```golang

package quota

import (
	"context"

	"istio.io/istio/mixer/pkg/adapter"
)

const TemplateName = "quota"

type Instance struct {
	// Name of the instance as specified in configuration.
	Name string

	// The unique identity of the particular quota to manipulate.
	Dimensions map[string]interface{}
}

type Type struct {
	Dimensions map[string]istio_mixer_v1_config_descriptor.ValueType
}

type HandlerBuilder interface {
	adapter.HandlerBuilder
	SetQuotaTypes(map[string]*Type /*Instance name -> Type*/)
}

type Handler interface {
	adapter.Handler
	HandleQuota(context.Context, *Instance, adapter.QuotaArgs) (adapter.QuotaResult, error)
}
```

# Adapter lifecycle

This section explains various Mixer states during which it interacts with adapters. This is important in order to
understand how to implement adapter code and manage the states of various objects within the adapter code itself, such
as remote connections and local caches. This section explains how an adapter implementation is usually structured to
achieve clear separation of concerns between configuration-time and request-time responsibilities.

## Common adapter code layout

Every adapter must implement :

* A Go struct that implements '`HandlerBuilder'`interfaces for all supported templates.

* A Go struct that implements '`Handler' `interfaces for all supported templates.

An adapter implementation therefore usually contains a Go struct named `builder` and a Go struct named `handler`.
(The name of the structs is not important, but for the purpose of this document, let's call them `builder` and `handler`).

## Mixer-adapter interactions

Mixer has three states during which it interacts with adapters: initialization-time, configuration-time and request-time.

High level flow between Mixer and adapters.

![flow: mixer and adapter interaction](./img/mixer%20adapter%20flow.svg)

Let's take a detailed look at them:

### Initialization-time

This is when Mixer is booted and adapters are initialized. Every adapter must implement a `GetInfo `function which
returns an `adapter.Info` object. During initialization, Mixer invokes this function for all known adapters. The
`adapter.Info` describes the templates an adapter wants to support as well as how to construct its `builder` object.

`adapter.Info` (Details in [info.go](https://github.com/istio/mixer/blob/master/pkg/adapter/info.go)) contains the
following information:

```golang
type Info struct {
	// Name returns the official name of the adapter, it must be RFC 1035 compatible DNS
	// label.
	// Regex: "^[a-z]([-a-z0-9]*[a-z0-9])?$"
	// Name is used in Istio configuration, therefore it should be descriptive but short.
	// example: denier
	// Vendor adapters should use a vendor prefix.
	// example: mycompany-denier
	Name string

	// Impl is the package implementing the adapter.
	// example: "istio.io/istio/mixer/adapter/denier"
	Impl string

	// Description returns a user-friendly description of the adapter.
	Description string

	// NewBuilder is a function that creates a Builder which implements Builders
	// associated with the SupportedTemplates.
	NewBuilder NewBuilderFn

	// SupportedTemplates expresses all the templates the adapter wants to serve.
	SupportedTemplates []string

	// DefaultConfig is a default configuration struct for this
	// adapter. This will be used by the configuration system to establish
	// the shape of the block of configuration state passed to the HandlerBuilder.Build
	// method.
	DefaultConfig proto.Message
}
```

### Configuration-time

This is when the operator configuration is loaded/reloaded. During configuration, Mixer creates new `builder` objects,
configures them, and instantiates `handler` objects for the adapter.

Details about the configuration time Mixer-Adapter interaction:

**Creating new `builder`**

Every handler config block in the operator's config results in an instance of `builder` type

![handler config](./img/handler%20config.svg)

**Passing template-specific types and adapter-specific config to `builder`**

After `builder` object instantiation, Mixer configures the `builder` object by invoking various template-specific
`HandlerBuilder `interface methods (example `SetMetricTypes`, `SetQuotaTypes` for 'metric' and 'quota' named templates.)
and passing a map of string-to-`Type `struct. The string key and the value `Type `represents the name of the instance as
configured by the operator and the shape of the `Instance` object the adapter would receive at request time.

Given the above sample handler configuration and 'metric' template, the example below shows configuration-time call values.

![flow: example attr to types](./img/example%20instance%20to%20type.svg)

At request time, every `Instance` object dispatched to the adapter has a `Name` field. The adapter implementation should
use the value of the `Name` field to lookup the shape description for the `Instance` object from the map of instance
name(string)->`Type` that was passed at configuration time through the `builder` object.

Once Mixer has called into various template-specific Set.*Types methods,

Mixer calls the `SetAdapterConfig` method on the `builder`, and once done then Mixer calls the `Validate` method followed by the
`Build` method. `SetAdapterConfig` gives the builder the adapter-specific configuration, `Validate` method allows builder to
validate the operator configuration based on the provided template-specific `Types` and the adapter-specific configuration.

**Instantiating `handler`**

Once `builder` is validated, Mixer calls its `Build` method, which returns a `handler` object which Mixer invokes during
request processing. The `handler` instance constructed must implement all the `Handler` interfaces (runtime request
serving interfaces) for all the templates the adapter has registered for. If the returned handler fails to implement the
required interface for the adapter's supported templates, Mixer reports an error and doesn't serve runtime traffic to
the particular handler.

The `Build` method is where adapters must do all their bootstrapping work. For example establishing connection with backend
system, initializing cache and more, that they need to start receiving data at request time.

**Closing `handler`**

When a handler is no longer useful, Mixer calls its `Close` method. In the `Close` method an adapter is expected to release
all the allocated resources and close all remote connections to the backends if it has any.

### Request-time

During this time Mixer dispatches the `instance` objects to the adapter based on the routing rules configured by the operator.
Mixer does this by invoking the Handle* functions on the `handler` object.

Given the above example operator's config (instance, action, handler configuration) and
['metric'](#report-variety-template) template, the following example shows the request-time `Instance` objects created
for a given input set of attributes:

![example attr to instance mapping](./img/example%20attr%20to%20instance.svg)

# Example

The following sample adapters illustrate the basic skeleton of the adapter code and do not provide any
functionality. They always return success. For examples of real world adapters, see [implementation of built-in adapters
within Mixer framework](https://github.com/istio/mixer/tree/master/adapter).

* Sample adapter that supports the 'metric' template

```golang
type (
  builder struct{}
  handler struct{}
)

// ensure our types implement the requisite interfaces
var _ metric.HandlerBuilder = builder{}
var _ metric.Handler = handler{}

///////////////// Configuration Methods ///////////////

func (builder) Build(Context.Context, adapter.Env) (adapter.Handler, error) {
  return handler{}, nil
}
func (builder) SetAdapterConfig(adapter.Config)                      {}
func (builder) Validate() (*adapter.ConfigErrors)                 { return }

func (builder) SetMetricTypes(map[string]*metric.Type){
  ...
}

////////////////// Runtime Methods //////////////////////////

func (handler) HandleMetric(context.Context, []*metric.Instance) error {
  return nil
}

func (handler) Close() error { return nil }

////////////////// Bootstrap //////////////////////////
// GetInfo returns the Info for this adapter.

func GetInfo() adapter.BuilderInfo {
  return adapter.BuilderInfo{
     Name:        "istio.io/istio/mixer/adapter/noop1",
     Description: "Does nothing",
     SupportedTemplates: []string{
        metric.TemplateName,
     },
     NewBuilder: func() adapter.HandlerBuilder { return builder{} },
     DefaultConfig:        &types.Empty{},
  }
}
```
* Sample adapter that supports the 'listentry' template.

```golang
type (
  builder struct{}
  handler struct{}
)

// ensure our types implement the requisite interfaces
var _ listentry.HandlerBuilder = builder{}
var _ listentry.Handler = handler{}

///////////////// Configuration Methods ///////////////

func (builder) Build(Context.Context, adapter.Env) (adapter.Handler, error) {
  return handler{}, nil
}
func (builder) SetAdapterConfig(adapter.Config)                      {}
func (builder) Validate() (*adapter.ConfigErrors)                 { return }

func (builder) SetListEntryTypes(map[string]*listentry.Type){
  ...
}

////////////////// Runtime Methods //////////////////////////

var checkResult = adapter.CheckResult{
  Status:        rpc.Status{Code: int32(rpc.OK)},
  ValidDuration: 1000000000 * time.Second,
  ValidUseCount: 1000000000,
}

func (handler) HandleListEntry(context.Context, *listentry.Instance) (adapter.CheckResult, error) {
  return checkResult, nil
}

func (handler) Close() error { return nil }

////////////////// Bootstrap //////////////////////////

// GetInfo returns the Info associated with this adapter implementation.
func GetInfo() adapter.BuilderInfo {
  return adapter.BuilderInfo{
     Name:        "istio.io/istio/mixer/adapter/noop2",
     Description: "Does nothing",
     SupportedTemplates: []string{
        listentry.TemplateName,
     },
     NewBuilder: func() adapter.HandlerBuilder { return builder{} },
     DefaultConfig:        &types.Empty{},
  }
}

```
* Sample adapter that supports the 'quota' template.

```golang
type (
  builder struct{}
  handler struct{}
)

// ensure our types implement the requisite interfaces
var _ quota.HandlerBuilder = builder{}
var _ quota.Handler = handler{}

///////////////// Configuration Methods ///////////////

func (builder) Build(Context.Context, adapter.Env) (adapter.Handler, error) {
  return handler{}, nil
}
func (builder) SetAdapterConfig(adapter.Config)                      {}
func (builder) Validate() (*adapter.ConfigErrors)                 { return }

func (builder) SetQuotaTypes(map[string]*quota.Type){
  ...
}

////////////////// Runtime Methods //////////////////////////

func (handler) HandleQuota(ctx context.Context, _ *quota.Instance, args adapter.QuotaRequestArgs) (adapter.QuotaResult2, error) {
  return adapter.QuotaResult2{
        ValidDuration: 1000000000 * time.Second,
        Amount:        args.QuotaAmount,
     },
     nil
}

func (handler) Close() error { return nil }

////////////////// Bootstrap //////////////////////////

// GetInfo returns the Info associated with this adapter implementation.
func GetInfo() adapter.BuilderInfo {
  return adapter.BuilderInfo{
     Name:        "istio.io/istio/mixer/adapter/noop2",
     Description: "Does nothing",
     SupportedTemplates: []string{
        quota.TemplateName,
     },
     NewBuilder: func() adapter.HandlerBuilder { return builder{} },
     DefaultConfig:        &types.Empty{},
  }
}
```

The above section provided a complete example of a simple adapter. In the next sections we'll look in more detail
how to build Mixer with custom adapters that are not shipped with the default Mixer build, and step-by-step guide to
build a simple adapter.

# Summary diagrams

The diagrams below show the relationship between, adapters, templates, operator configuration, and Mixer. They also show the flow of
Mixer at boot time, how it interacts with adapters and operator configuration. The diagrams also demonstrate how handler,
rule and instance configuration is translated to calls into adapters at configuration-time and request time.

First let's look into how Mixer, adapters, templates and operator configurations are related

![template, adapter and operator config relationship](./img/template%2C%20adapter%20and%20operator%20config%20relationship.svg)

Now that we have understood the relationship between various artifacts, let's look into what happens at the time of Mixer
start, when operator configuration is loaded/changed and when request is received.

![flow: mixer start](./img/mixer%20start%20flow.svg)

![flow: operator config change](./img/operator%20config%20change.svg)

![flow: incoming api](./img/request%20time.svg)

# Plug adapter into Mixer

For a new adapter to plug into Mixer, you will have to add your adapter's reference into Mixer's inventory
[build file](https://github.com/istio/mixer/blob/master/adapter/BUILD)'s inventory_library rule. In the *deps* section
add a reference to adapter's go_library build rule, and in the *packages* section add the short name and the go import
path to the adapter package that implements the `GetInfo `function. These two changes will plug your custom adapter into Mixer.

# Testing

We provide a simple adapter test framework. The framework instantiates an in-process Mixer gRPC server with a config store
backed by the local filesystem, and also a Mixer gRPC client in test process, which allows stepping through adapter code in
test cases. The test framework is implemented in the [test/testenv](../../test/testenv)
directory. A [sample](../../test/testenv/testenv_test.go) test is provided to show
how to use this test framework to test a dummy adapter called denier. To setup the environment, adapter developer need
author adapter config files. Sample adapter config can be found in [/testdata](../../testdata/config) directory.

# Do's and dont's

* Adapters must use env.Logger for logging during execution. This logger understands about which adapter is running and
routes the data to the place where the operator wants to see it.

* Adapters must use env.ScheduleWork or env.ScheduleDaemon in order to dispatch goroutines. This ensures all adapter
goroutines are prevented from crashing Mixer as a whole by catching any panics they produce.

# Built-in templates

Mixer ships with a set of built-in templates that are ready to use by adapters:

* [listentry](https://github.com/istio/mixer/tree/master/template/listentry)

* [logentry](https://github.com/istio/mixer/tree/master/template/logentry)

* [quota](https://github.com/istio/mixer/tree/master/template/quota)

* [metric](https://github.com/istio/mixer/tree/master/template/metric)

* [checknothing](https://github.com/istio/mixer/tree/master/template/checknothing)

* [reportnothing](https://github.com/istio/mixer/tree/master/template/reportnothing)

Using the above templates, the Mixer team has implemented a set of adapters that ships as part of the default Mixer
binary. They are located at [istio/mixer/adapter](https://github.com/istio/mixer/tree/master/adapter). They are good
examples for reference when implementing new adapters.

# Walkthrough of adapter implementation (30 minutes)

Please refer to [Adapter Development Walkthrough](./adapter-development-walkthrough.md)


text:
layout: docs
title: getExtraAttributes
id: trait.Facebook.HackCodegen.CodegenWithAttributes.getExtraAttributes
docid: trait.Facebook.HackCodegen.CodegenWithAttributes.getExtraAttributes
permalink: /docs/reference/trait.Facebook.HackCodegen.CodegenWithAttributes.getExtraAttributes/
---
# Facebook\\HackCodegen\\CodegenWithAttributes::getExtraAttributes()

``` Hack
protected function getExtraAttributes(): dict<string, vec<string>>;
```

## Returns

+ ` dict<string, vec<string>> `


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Documentacion de pynprcalc — documentación de pynprcalc - </title>

    <link rel="stylesheet" href="_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="index" title="Índice" href="genindex.html" />
    <link rel="search" title="Búsqueda" href="search.html" />
    <link rel="next" title="pynprcalc.calc.main" href="_autosummary/pynprcalc.calc.main.html" />

Navegación

          índice

          módulos |

          siguiente |

documentación de pynprcalc -  »

Documentacion de pynprcalc¶

Esta es una calculadora RPN.

<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>

pynprcalc.calc.main
Corazón de la caluladora.

pynprcalc.calc.ui
Interfaz de usuario en línea de comandos.

pynprcalc.funciones.misc
Funciones varias.

pynprcalc.funciones.math.basico
Funciones matemáticas básicas.

pynprcalc.funciones.math.const
Constantes matemáticas.

pynprcalc.funciones.math.exp
Funciones exponenciales.

pynprcalc.funciones.math.trig
Funciones trigonométricas.

pynprcalc.funciones.math.misc
Funciones misceláneas.

pynprcalc.comandos
Interfaz entre los comandos de la calculadora y las funciones matemáticas.

Indices and tables¶

Índice

Índice de Módulos

Página de Búsqueda

Tabla de Contenidos

pynprcalc.calc.main

pynprcalc.calc.ui

pynprcalc.funciones.misc

pynprcalc.funciones.math.basico

pynprcalc.funciones.math.const

pynprcalc.funciones.math.exp

pynprcalc.funciones.math.trig

pynprcalc.funciones.math.misc

pynprcalc.comandos

Próximo tema

pynprcalc.calc.main

Esta página

Mostrar el código

Búsqueda rápida

    <form class="search" action="search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Ir a" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Navegación

          índice

          módulos |

          siguiente |

documentación de pynprcalc -  »

        © Derechos de autor 2017, Martin Bernardi.
      Creado con Sphinx 1.5.5.


text:
package cl.uchile.ing.adi.quicklooklib.items;

import android.content.Context;
import android.os.Bundle;

import cl.uchile.ing.adi.quicklooklib.R;
import cl.uchile.ing.adi.quicklooklib.fragments.DefaultFragment;

/**
 * Represents web content in the filesystem.
 */
public class ExcelItem extends FileItem {

    public ExcelItem(String path, String mimetype, long size, Bundle extra, Context context) {
        super(path,mimetype,size,extra, context);
        image = R.drawable.excel;
        formattedName = getContext().getString(R.string.items_excel_formatted_name);
    }
}