Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.TableManager


    @DELETE
    @Path("{name}")
    public Response dropTable(@PathParam("name") String tableName, @Context UriInfo uriInfo) {
        try {
            TableManager tableManager = getRepository(uriInfo).getTableManager();
            if (!tableManager.tableExists(tableName)) {
                throw new ResourceException("Table '" + tableName + "' not found", NOT_FOUND.getStatusCode());
            }
            tableManager.dropTable(tableName);
            return Response.ok().build();
        } catch (IOException ioe) {
            throw new ResourceException("Error dropping table '" + tableName + "'", ioe,
                    INTERNAL_SERVER_ERROR.getStatusCode());
        } catch (InterruptedException ie) {
View Full Code Here


        this.hbaseConf = hbaseConf;
    }

    @Override
    protected Repository createRepository(RepoTableKey key) throws InterruptedException, RepositoryException {
        TableManager tableManager = new TableManagerImpl(key.getRepositoryName(), hbaseConf, hbaseTableFactory);
        try {
            HTableInterface nonAuthHTable = LilyHBaseSchema.getRecordTable(hbaseTableFactory, key.getRepositoryName(), key.getTableName(), true);
            HTableInterface htable = wrapWithAuthorization(nonAuthHTable);
            return new HBaseRepository(key, this, htable, nonAuthHTable, blobManager, tableManager, getRecordFactory());
        } catch (org.apache.hadoop.hbase.TableNotFoundException e) {
View Full Code Here

                new SizeBasedBlobStoreAccessFactory(blobStoreAccesses, blobStoreAccessConfig);
        BlobManager blobManager = new BlobManagerImpl(hbaseTableFactory, blobStoreAccessFactory, false);
        repositoryManager = new HBaseRepositoryManager(typeManager, idGenerator,
                new RecordFactoryImpl(), hbaseTableFactory, blobManager, configuration, repositoryModel);

        TableManager repoTableManager =
                new TableManagerImpl(/* TODO multiple repositories */ "default", configuration, hbaseTableFactory);
        if (!repoTableManager.tableExists(Table.RECORD.name)) {
            repoTableManager.createTable(Table.RECORD.name);
        }

        repository = (Repository) repositoryManager.getDefaultRepository().getDefaultTable();
        table = repository.getDefaultTable();
    }
View Full Code Here

        if (status != 0) {
            return status;
        }

        LilyClient lilyClient = new LilyClient(zkConnectionString, 30000);
        TableManager tableManager = lilyClient.getRepository(repositoryName).getTableManager();
        try {
            status = execute(tableManager);
        } finally {
            lilyClient.close();
        }
View Full Code Here

    @Override
    public Object createTable(String repository, AvroTableCreateDescriptor tableCreateDescriptor)
            throws AvroInterruptedException, AvroIOException, AvroRepositoryException {
        try {
            TableManager tableMgr = repositoryManager.getRepository(repository).getTableManager();
            tableMgr.createTable(converter.convert(tableCreateDescriptor));
            return null;
        } catch (InterruptedException e) {
            throw converter.convert(e);
        } catch (IOException e) {
            throw converter.convert(e);
View Full Code Here

    @Override
    public Object dropTable(String repositoryName, String name)
            throws AvroInterruptedException, AvroIOException, AvroRepositoryException {
        try {
            TableManager tableMgr = repositoryManager.getRepository(repositoryName).getTableManager();
            tableMgr.dropTable(name);
            return null;
        } catch (InterruptedException e) {
            throw converter.convert(e);
        } catch (IOException e) {
            throw converter.convert(e);
View Full Code Here

    @Override
    public List<String> getTables(String repositoryName)
            throws AvroInterruptedException, AvroIOException, AvroRepositoryException {
        try {
            TableManager tableMgr = repositoryManager.getRepository(repositoryName).getTableManager();
            List<String> tables = new ArrayList<String>();
            for (RepositoryTable table : tableMgr.getTables()) {
                tables.add(table.getName());
            }
            return tables;
        } catch (InterruptedException e) {
            throw converter.convert(e);
View Full Code Here

    @Override
    public boolean tableExists(String repositoryName, String name)
            throws AvroInterruptedException, AvroIOException, AvroRepositoryException {
        try {
            TableManager tableMgr = repositoryManager.getRepository(repositoryName).getTableManager();
            return tableMgr.tableExists(name);
        } catch (InterruptedException e) {
            throw converter.convert(e);
        } catch (IOException e) {
            throw converter.convert(e);
        } catch (RepositoryException e) {
View Full Code Here

    }

    @Test(expected = Exception.class)
    public void testRecordTableCannotBeDeleted() throws Exception {
        String repositoryName = "testRecordTableCannotBeDeleted";
        TableManager tableManager = repositoryManager.getRepository(repositoryName).getTableManager();
        tableManager.dropTable("record");
    }
View Full Code Here

        RepositoryModel repositoryModel = repoSetup.getRepositoryModel();
        repositoryModel.create(repositoryName);
        assertTrue(repositoryModel.waitUntilRepositoryInState(repositoryName, RepositoryDefinition.RepositoryLifecycleState.ACTIVE, 60000L));

        LRepository repository = repositoryManager.getRepository(repositoryName);
        TableManager tableManager = repository.getTableManager();

        List<RepositoryTable> tables = tableManager.getTables();
        assertEquals(1, tables.size());
        assertEquals("record", tables.get(0).getName());

        tableManager.createTable("foo");

        assertEquals(2, tableManager.getTables().size());

        assertTrue(tableManager.tableExists("foo"));

        repository.getTable("foo");

        tableManager.dropTable("foo");

        assertEquals(1, tableManager.getTables().size());
    }
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.TableManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.