Examples of RepositoryDefinition


Examples of org.lilyproject.repository.model.api.RepositoryDefinition

                    if (queueSize >= 10 && (System.currentTimeMillis() - startedAt > 5000)) {
                        log.warn("EventWorker queue getting large, size = " + queueSize);
                    }

                    try {
                        RepositoryDefinition repoDef = repositoryModel.getRepository(event.getRepositoryName());
                        if (repoDef.getLifecycleState() == RepositoryLifecycleState.CREATE_REQUESTED) {
                            for (RepositoryMasterHook hook : hooks) {
                                try {
                                    hook.postCreate(repoDef.getName());
                                } catch (InterruptedException e) {
                                    return;
                                } catch (Throwable t) {
                                    log.error("Failure executing a repository post-create hook for "
                                            + event.getRepositoryName(), t);
                                }
                            }
                            RepositoryDefinition updatedRepoDef = new RepositoryDefinition(repoDef.getName(),
                                    RepositoryLifecycleState.ACTIVE);
                            repositoryModel.updateRepository(updatedRepoDef);
                        } else if (repoDef.getLifecycleState() == RepositoryLifecycleState.DELETE_REQUESTED) {
                            for (RepositoryMasterHook hook : hooks) {
                                try {
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

        return fromJson(name, node);
    }

    public RepositoryDefinition fromJson(String name, ObjectNode node) {
        RepositoryDefinition.RepositoryLifecycleState lifecycleState = JsonUtil.getEnum(node, "lifecycleState", RepositoryDefinition.RepositoryLifecycleState.class);
        return new RepositoryDefinition(name, lifecycleState);
    }
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

        assertFalse(repositoryModel.repositoryExistsAndActive("repo1"));

        assertEquals(2, repositoryModel.getRepositories().size()); // 2 because the default repository is also there

        repositoryModel.updateRepository(new RepositoryDefinition("repo1", RepositoryDefinition.RepositoryLifecycleState.ACTIVE));
        listener.waitForEvents(1);
        listener.verifyEvents(new RepositoryModelEvent(RepositoryModelEventType.REPOSITORY_UPDATED, "repo1"));

        assertTrue(repositoryModel.repositoryExistsAndActive("repo1"));
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

        repositoryModel.deleteDirect("default");
    }

    @Test(expected = Exception.class)
    public void testDefaultRepositoryCannotBeUpdated() throws Exception {
        repositoryModel.updateRepository(new RepositoryDefinition("default", RepositoryDefinition.RepositoryLifecycleState.ACTIVE));
    }
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

    public void create(String repositoryName) throws RepositoryExistsException, InterruptedException, RepositoryModelException {
        if (!RepoDefUtil.isValidRepositoryName(repositoryName)) {
            throw new IllegalArgumentException(String.format("'%s' is not a valid repository name. "
                    + RepoDefUtil.VALID_NAME_EXPLANATION, repositoryName));
        }
        RepositoryDefinition repoDef = new RepositoryDefinition(repositoryName, RepositoryLifecycleState.CREATE_REQUESTED);
        byte[] repoBytes = RepositoryDefinitionJsonSerDeser.INSTANCE.toJsonBytes(repoDef);
        try {
            zk.create(REPOSITORY_COLLECTION_PATH + "/" + repositoryName, repoBytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        } catch (KeeperException.NodeExistsException e) {
            throw new RepositoryExistsException("Can't create repository, a repository with this name already exists: "
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

    @Override
    public void delete(String repositoryName)
            throws InterruptedException, RepositoryModelException, RepositoryNotFoundException {
        disallowDefaultRepository(repositoryName);
        RepositoryDefinition repoDef = new RepositoryDefinition(repositoryName, RepositoryLifecycleState.DELETE_REQUESTED);
        try {
            storeRepository(repoDef);
        } catch (KeeperException.NoNodeException e) {
            throw new RepositoryNotFoundException("Can't delete-request repository, a repository with this name doesn't exist: "
                    + repoDef.getName());
        } catch (KeeperException e) {
            throw new RepositoryModelException(e);
        }
    }
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

        }
    }

    @Override
    public boolean repositoryExistsAndActive(String repositoryName) {
        RepositoryDefinition repoDef = repos.get(repositoryName);
        return repoDef != null && repoDef.getLifecycleState() == RepositoryLifecycleState.ACTIVE;
    }
View Full Code Here

Examples of org.lilyproject.repository.model.api.RepositoryDefinition

        return repoDef != null && repoDef.getLifecycleState() == RepositoryLifecycleState.ACTIVE;
    }

    @Override
    public boolean repositoryActive(String repositoryName) throws RepositoryNotFoundException {
        RepositoryDefinition repoDef = repos.get(repositoryName);
        if (repoDef == null) {
            throw new RepositoryNotFoundException("No repository named " + repositoryName);
        }
        return repoDef.getLifecycleState() == RepositoryLifecycleState.ACTIVE;
    }
View Full Code Here

Examples of org.springframework.data.repository.RepositoryDefinition

    return this.domainType;
  }

  private Class<? extends Serializable> resolveIdType(Class<?> repositoryInterface) {

    RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class);

    if (annotation == null || annotation.idClass() == null) {
      throw new IllegalArgumentException(String.format("Could not resolve id type of %s!", repositoryInterface));
    }

    return annotation.idClass();
  }
View Full Code Here

Examples of org.springframework.data.repository.RepositoryDefinition

    return annotation.idClass();
  }

  private Class<?> resolveDomainType(Class<?> repositoryInterface) {

    RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class);

    if (annotation == null || annotation.domainClass() == null) {
      throw new IllegalArgumentException(String.format("Could not resolve domain type of %s!", repositoryInterface));
    }

    return annotation.domainClass();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.