use of javax.validation.constraints.NotNull in project che by eclipse.
the class JavaRefactoringRename method createLinkedRenameRefactoringApplyDto.
@NotNull
private LinkedRenameRefactoringApply createLinkedRenameRefactoringApplyDto(String newName, String sessionId) {
LinkedRenameRefactoringApply dto = dtoFactory.createDto(LinkedRenameRefactoringApply.class);
dto.setNewName(newName);
dto.setSessionId(sessionId);
return dto;
}
use of javax.validation.constraints.NotNull in project cassandra-mesos-deprecated by mesosphere.
the class PersistedCassandraFrameworkConfigurationTest method createInitializedState.
@NotNull
private State createInitializedState(@NotNull final String varName, @NotNull final String resourceName) throws IOException {
final State state = new InMemoryState();
final Variable var = await(state.fetch(varName));
final Variable mut = var.mutate(readConfigurationFile(resourceName));
await(state.store(mut));
return state;
}
use of javax.validation.constraints.NotNull in project graylog2-server by Graylog2.
the class Indices method getIndexNamesAndAliases.
@NotNull
public Map<String, Set<String>> getIndexNamesAndAliases(String indexPattern) {
// only request indices matching the name or pattern in `indexPattern` and only get the alias names for each index,
// not the settings or mappings
final GetIndexRequestBuilder getIndexRequestBuilder = c.admin().indices().prepareGetIndex();
getIndexRequestBuilder.addFeatures(GetIndexRequest.Feature.ALIASES);
getIndexRequestBuilder.setIndices(indexPattern);
final GetIndexResponse getIndexResponse = c.admin().indices().getIndex(getIndexRequestBuilder.request()).actionGet();
final String[] indices = getIndexResponse.indices();
final ImmutableOpenMap<String, List<AliasMetaData>> aliases = getIndexResponse.aliases();
final Map<String, Set<String>> indexAliases = Maps.newHashMap();
for (String index : indices) {
final List<AliasMetaData> aliasMetaData = aliases.get(index);
if (aliasMetaData == null) {
indexAliases.put(index, Collections.emptySet());
} else {
indexAliases.put(index, aliasMetaData.stream().map(AliasMetaData::alias).collect(toSet()));
}
}
return indexAliases;
}
use of javax.validation.constraints.NotNull in project ddf by codice.
the class MetacardsMigratable method export.
/**
* Exports all the metacards currently stored in the catalog framework.
* <p>
* {@inheritDoc}
*/
@Override
@NotNull
public MigrationMetadata export(@NotNull Path exportPath) throws MigrationException {
config.setExportPath(exportPath.resolve(this.getId()));
fileWriter.createExportDirectory(config.getExportPath());
Collection<MigrationWarning> warnings = new ArrayList<>();
Map<String, Serializable> props = createMapWithNativeQueryMode();
Filter dumpFilter = filterBuilder.attribute(Metacard.ANY_TEXT).is().like().text("*");
QueryImpl exportQuery = new QueryImpl(dumpFilter);
exportQuery.setPageSize(config.getExportQueryPageSize());
exportQuery.setRequestsTotalResultsCount(false);
QueryRequest exportQueryRequest = new QueryRequestImpl(exportQuery, props);
try {
executeQueryLoop(exportQuery, exportQueryRequest);
} catch (Exception e) {
LOGGER.info("Internal error occurred when exporting catalog: {}", e);
throw new ExportMigrationException(DEFAULT_FAILURE_MESSAGE);
} finally {
cleanup();
}
return new MigrationMetadata(warnings);
}
use of javax.validation.constraints.NotNull in project ddf by codice.
the class MigratableUtil method copyFileFromSystemPropertyValue.
/**
* Copies a file, whose path is taken from a {@link System} property value, to a destination
* directory. The file to copy must be a relative path under {@code ddf.home}, and its path
* must not contain any symbolic link, otherwise the file will not be copied and a
* {@link MigrationWarning} will be returned.
*
* @param systemProperty name of the {@link System} property that contains the path to the
* source file
* @param exportDirectory root directory where the file will be copied. If the file'
* relative path included any directories, those will be re-created
* under this directory.
* @param warnings any warnings generated during this operation (e.g., source file outside
* of {@code ddf.home}) will be added to this collection
*/
public void copyFileFromSystemPropertyValue(@NotNull String systemProperty, @NotNull Path exportDirectory, @NotNull Collection<MigrationWarning> warnings) throws MigrationException {
String source = System.getProperty(systemProperty);
notEmpty(source, String.format("Source path property [%s] is invalid: [%s]", systemProperty, source));
Path sourcePath = Paths.get(source);
copy(sourcePath, exportDirectory, warnings, () -> isSourceMigratable(sourcePath, (reason) -> new PathMigrationWarning(systemProperty, sourcePath, reason), warnings));
}
Aggregations