Package com.amazonaws.services.simpledb

Examples of com.amazonaws.services.simpledb.AmazonSimpleDB


    @Override
    public void doStart() throws Exception {
        super.doStart();
       
        AmazonSimpleDB sdbClient = getSdbClient();
        String domainName = getConfiguration().getDomainName();
        LOG.trace("Querying whether domain [{}] already exists...", domainName);

        try {
            sdbClient.domainMetadata(new DomainMetadataRequest(domainName));
            LOG.trace("Domain [{}] already exists", domainName);
            return;
        } catch (NoSuchDomainException ase) {
            LOG.trace("Domain [{}] doesn't exist yet", domainName);
            LOG.trace("Creating domain [{}]...", domainName);
            sdbClient.createDomain(new CreateDomainRequest(domainName));
            LOG.trace("Domain [{}] created", domainName);
        }
    }
View Full Code Here


    @Override
    public void doStart() throws Exception {
        super.doStart();
       
        AmazonSimpleDB sdbClient = getSdbClient();
        String domainName = getConfiguration().getDomainName();
        LOG.trace("Querying whether domain [{}] already exists...", domainName);

        try {
            sdbClient.domainMetadata(new DomainMetadataRequest(domainName));
            LOG.trace("Domain [{}] already exists", domainName);
            return;
        } catch (NoSuchDomainException ase) {
            LOG.trace("Domain [{}] doesn't exist yet", domainName);
            LOG.trace("Creating domain [{}]...", domainName);
            sdbClient.createDomain(new CreateDomainRequest(domainName));
            LOG.trace("Domain [{}] created", domainName);
        }
    }
View Full Code Here

    @Override
    public void doStart() throws Exception {
        super.doStart();
       
        AmazonSimpleDB sdbClient = getSdbClient();
        String domainName = getConfiguration().getDomainName();
        LOG.trace("Querying whether domain [{}] already exists...", domainName);

        try {
            sdbClient.domainMetadata(new DomainMetadataRequest(domainName));
            LOG.trace("Domain [{}] already exists", domainName);
            return;
        } catch (NoSuchDomainException ase) {
            LOG.trace("Domain [{}] doesn't exist yet", domainName);
            LOG.trace("Creating domain [{}]...", domainName);
            sdbClient.createDomain(new CreateDomainRequest(domainName));
            LOG.trace("Domain [{}] created", domainName);
        }
    }
View Full Code Here

        return configuration.getAmazonSDBClient() != null ? configuration.getAmazonSDBClient() : createSdbClient();
    }

    AmazonSimpleDB createSdbClient() {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        AmazonSimpleDB client = new AmazonSimpleDBClient(credentials);
        if (configuration.getAmazonSdbEndpoint() != null) {
            client.setEndpoint(configuration.getAmazonSdbEndpoint());
        }
        configuration.setAmazonSDBClient(client);
        return client;
    }
View Full Code Here

        return sdbClient;
    }

    AmazonSimpleDB createSdbClient() {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        AmazonSimpleDB client = new AmazonSimpleDBClient(credentials);
        return client;
    }
View Full Code Here

    public synchronized void setupDbDomain(String domainName) {
        try {
            if (!doesDomainExist(domainName)) {
                logger.info("creating domain: " + domainName);
                AmazonSimpleDB db = getSimpleDb();
                db.createDomain(new CreateDomainRequest().withDomainName(domainName));
                domainSet.add(domainName);
            }
        } catch (AmazonClientException e) {
            throw new PersistenceException("Could not create SimpleDB domain.", e);
        }
View Full Code Here

            return;

        try {
            domainSet = new HashSet<String>();
            logger.info("getting all domains");
            AmazonSimpleDB db = getSimpleDb();
            ListDomainsResult listDomainsResult = db.listDomains();
            domainSet.addAll(listDomainsResult.getDomainNames());
            while (listDomainsResult.getNextToken() != null) {
                ListDomainsRequest request = new ListDomainsRequest().withNextToken(listDomainsResult.getNextToken());
                listDomainsResult = db.listDomains(request);
                domainSet.addAll(listDomainsResult.getDomainNames());
            }
        } catch (AmazonClientException e) {
            throw new PersistenceException(e);
        }
View Full Code Here

        factory.close();
    }
    @After
    public void deleteAll() throws AmazonClientException {
        EntityManagerSimpleJPA em = (EntityManagerSimpleJPA) factory.createEntityManager();
        AmazonSimpleDB db = em.getSimpleDb();
       
        String domainName = em.getDomainName(MyTestObject.class);
        db.deleteDomain(new DeleteDomainRequest().withDomainName(domainName));

        domainName = em.getDomainName(MyTestObject2.class);
        db.deleteDomain(new DeleteDomainRequest().withDomainName(domainName));

        domainName = em.getDomainName(MyInheritanceObject1.class);
        db.deleteDomain(new DeleteDomainRequest().withDomainName(domainName));
       
        em.close();
    }
View Full Code Here

    @Ignore("Rename feature is currently broken")
    @Test
    public void rename() throws IOException, ExecutionException, InterruptedException, AmazonClientException {
        EntityManagerSimpleJPA em = (EntityManagerSimpleJPA) factory.createEntityManager();
        AmazonSimpleDB db = em.getSimpleDb();

        String domainName = em.getFactory().getDomainName(MyTestObject.class);
        em.getFactory().createIfNotExistDomain(domainName);
       
        String id = "abc123";
        List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();
        atts.add(new ReplaceableAttribute("id", id, true));
        atts.add(new ReplaceableAttribute("nameOld", "Bullwinkle", true));
        db.putAttributes(new PutAttributesRequest()
          .withDomainName(domainName)
          .withItemName(id)
          .withAttributes(atts));

        MyTestObject object;
View Full Code Here

    @Ignore("Rename Subclass feature is currently broken")
    @Test
    public void renameSubclass() throws IOException, ExecutionException, InterruptedException, AmazonClientException {
        EntityManagerSimpleJPA em = (EntityManagerSimpleJPA) factory.createEntityManager();
        AmazonSimpleDB db = em.getSimpleDb();

        String domainName = em.getFactory().getDomainName(MyInheritanceObject1.class);
        em.getFactory().createIfNotExistDomain(domainName);
       
        String id = "abc123";
        List<ReplaceableAttribute> atts = new ArrayList<ReplaceableAttribute>();
        atts.add(new ReplaceableAttribute("id", id, true));
        atts.add(new ReplaceableAttribute(EntityManagerFactoryImpl.DTYPE, "MyInheritanceObjectOld", true));
        atts.add(new ReplaceableAttribute("fieldInSubClass2", "Bullwinkle", true));
       
        db.putAttributes(new PutAttributesRequest()
        .withDomainName(domainName)
        .withItemName(id)
        .withAttributes(atts));

        MyInheritanceObject1 object;
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.AmazonSimpleDB

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.