org.netbeans.modules.maven.model.pom.RepositoryPolicy Java Examples

The following examples show how to use org.netbeans.modules.maven.model.pom.RepositoryPolicy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: POMModelVisitor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@Messages({"ENABLED=Enabled", "UPDATE_POLICY=Update Policy", "CHECKSUM_POLICY=Checksum Policy"})
public void visit(RepositoryPolicy target) {
    RepositoryPolicy t = target;
    assert t != null ? t.isInDocumentModel() : true;
    POMQNames names = parent.getPOMQNames();
    checkChildString(names.ENABLED, ENABLED(), t != null ? (t.isEnabled() != null ? t.isEnabled().toString() : null) : null);
    checkChildString(names.UPDATEPOLICY, UPDATE_POLICY(), t != null ? t.getUpdatePolicy() : null);
    checkChildString(names.CHECKSUMPOLICY, CHECKSUM_POLICY(), t != null ? t.getChecksumPolicy() : null);

    count++;
}
 
Example #2
Source File: POMManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void registerRepository() {
    if (sourceModel.getRepositories().size() > 0) {
        operations.add(pomModel -> {
            Set<String> existingRepositories = getPOMProject().getRepositories() != null ? 
                    getPOMProject().getRepositories()
                            .stream()
                            .map(Repository::getId)
                            .collect(toSet()) 
                    : Collections.emptySet();
            for (org.apache.maven.model.Repository repository : sourceModel.getRepositories()) {
                if (!existingRepositories.contains(repository.getId())) {
                    Repository repo = pomModel.getFactory().createRepository();
                    repo.setId(repository.getId());
                    repo.setName(repository.getName());
                    repo.setLayout(repository.getLayout());
                    repo.setUrl(repository.getUrl());
                    if (repository.getSnapshots() != null) {
                        RepositoryPolicy policy = pomModel.getFactory().createReleaseRepositoryPolicy();
                        policy.setEnabled(Boolean.valueOf(repository.getSnapshots().getEnabled()));
                        repo.setReleases(policy);
                    }
                    getPOMProject().addRepository(repo);
                }
            }
        });
    }
}
 
Example #3
Source File: SpringDependenciesGenerator.java    From nb-springboot with Apache License 2.0 5 votes vote down vote up
private void fillRepository(POMModel model, JsonNode depsMeta, String repoId, Repository repository) {
    JsonNode repoInfo = depsMeta.path("repositories").path(repoId);
    repository.setId(repoId);
    repository.setName(repoInfo.path("name").asText());
    repository.setUrl(repoInfo.path("url").asText());
    // set repository policies (release, snapshots)
    if (repoInfo.hasNonNull("snapshotEnabled")) {
        RepositoryPolicy snapshots = model.getFactory().createSnapshotRepositoryPolicy();
        snapshots.setEnabled(repoInfo.get("snapshotEnabled").asBoolean());
        repository.setSnapshots(snapshots);
    }
}
 
Example #4
Source File: POMManager.java    From jeddict with Apache License 2.0 5 votes vote down vote up
private void registerRepository(List<org.apache.maven.model.Repository> sourceRepositories) {
    if (sourceRepositories.size() > 0) {
        operations.add(pomModel -> {
            Set<String> existingRepositories = getPOMProject().getRepositories() != null ? 
                    getPOMProject().getRepositories()
                            .stream()
                            .map(Repository::getId)
                            .collect(toSet()) 
                    : Collections.EMPTY_SET;
            for (org.apache.maven.model.Repository sourceRepository : sourceRepositories) {
                if (!existingRepositories.contains(sourceRepository.getId())) {
                    Repository repo = pomModel.getFactory().createRepository();
                    repo.setId(sourceRepository.getId());//isSnapshot ? MavenNbModuleImpl.NETBEANS_SNAPSHOT_REPO_ID : MavenNbModuleImpl.NETBEANS_REPO_ID);
                    repo.setName(sourceRepository.getName());
                    repo.setLayout(sourceRepository.getLayout());
                    repo.setUrl(sourceRepository.getUrl());
                    if (sourceRepository.getSnapshots() != null) {
                        RepositoryPolicy policy = pomModel.getFactory().createReleaseRepositoryPolicy();
                        policy.setEnabled(Boolean.valueOf(sourceRepository.getSnapshots().getEnabled()));
                        repo.setReleases(policy);
                    }
                    getPOMProject().addRepository(repo);
                }
            }
        });
    }
}
 
Example #5
Source File: DefaultVisitor.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(RepositoryPolicy target) {
    visitComponent(target);
}