code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private String getRootLoggerDirectory() {
String rootLoggerDirectory = null;
org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger();
Enumeration allAppenders = rootLogger.getAllAppenders();
if (allAppenders != null) {
while (allAppenders.hasMoreElements... | java |
int assignPosition(Id id) throws RepositoryException {
int pos = -1;
if (!freePositions.isEmpty()) {
pos = freePositions.remove(0);
} else {
pos = nextPos++;
ensureCapacity(pos);
}
idPosMap.put(id, pos);
for (HierarchicalTypeStore s ... | java |
void releaseId(Id id) {
Integer pos = idPosMap.get(id);
if (pos != null) {
idPosMap.remove(id);
freePositions.add(pos);
for (HierarchicalTypeStore s : superTypeStores) {
s.releaseId(id);
}
}
} | java |
void store(ReferenceableInstance i) throws RepositoryException {
int pos = idPosMap.get(i.getId());
typeNameList.set(pos, i.getTypeName());
storeFields(pos, i);
for (HierarchicalTypeStore s : superTypeStores) {
s.store(i);
}
} | java |
void load(ReferenceableInstance i) throws RepositoryException {
int pos = idPosMap.get(i.getId());
loadFields(pos, i);
for (HierarchicalTypeStore s : superTypeStores) {
s.load(i);
}
} | java |
public static String getMessageJson(Object message) {
VersionedMessage<?> versionedMessage = new VersionedMessage<>(CURRENT_MESSAGE_VERSION, message);
return GSON.toJson(versionedMessage);
} | java |
@Override
public synchronized List<EntityAuditEvent> listEvents(String entityId, String startKey, short maxResults)
throws AtlasException {
List<EntityAuditEvent> events = new ArrayList<>();
String myStartKey = startKey;
if (myStartKey == null) {
myStartKey = entityId... | java |
public static void validateUpdate(FieldMapping oldFieldMapping, FieldMapping newFieldMapping)
throws TypeUpdateException {
Map<String, AttributeInfo> newFields = newFieldMapping.fields;
for (AttributeInfo attribute : oldFieldMapping.fields.values()) {
if (newFields.containsKey(at... | java |
public static Direction createDirection(AtlasEdgeDirection dir) {
switch(dir) {
case IN:
return Direction.IN;
case OUT:
return Direction.OUT;
case BOTH:
return Direction.BOTH;
default:
throw new RuntimeException("Unrecognized direc... | java |
public StructType defineQueryResultType(String name, Map<String, IDataType> tempTypes,
AttributeDefinition... attrDefs) throws AtlasException {
AttributeInfo[] infos = new AttributeInfo[attrDefs.length];
for (int i = 0; i < attrDefs.length; i++) {
infos[i] = new AttributeInfo(th... | java |
@GET
@Path("search")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response search(@QueryParam("query") String query,
@DefaultValue(LIMIT_OFFSET_DEFAULT) @QueryParam("limit") int limit,
@DefaultValue(LIMIT_OFFSET_DEFA... | java |
@GET
@Path("search/dsl")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response searchUsingQueryDSL(@QueryParam("query") String dslQuery,
@DefaultValue(LIMIT_OFFSET_DEFAULT) @QueryParam("limit") int limit,
... | java |
@GET
@Path("search/gremlin")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@InterfaceAudience.Private
public Response searchUsingGremlinQuery(@QueryParam("query") String gremlinQuery) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> MetadataDiscoveryResource... | java |
public AndCondition copy() {
AndCondition builder = new AndCondition();
builder.children.addAll(children);
return builder;
} | java |
public <V, E> NativeTitanGraphQuery<V, E> create(NativeTitanQueryFactory<V, E> factory) {
NativeTitanGraphQuery<V, E> query = factory.createNativeTitanQuery();
for (QueryPredicate predicate : children) {
predicate.addTo(query);
}
return query;
} | java |
public void cache(AtlasEntityWithExtInfo entity) {
if (entity != null && entity.getEntity() != null && entity.getEntity().getGuid() != null) {
entityCacheV2.put(entity.getEntity().getGuid(), entity);
}
} | java |
@Override
@GraphTransaction
public List<Map<String, String>> searchByGremlin(String gremlinQuery) throws DiscoveryException {
LOG.debug("Executing gremlin query={}", gremlinQuery);
try {
Object o = graph.executeGremlinScript(gremlinQuery, false);
return extractResult(o);
... | java |
private static void addSolr5Index() {
try {
Field field = StandardIndexProvider.class.getDeclaredField("ALL_MANAGER_CLASSES");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
... | java |
private String getPassword(org.apache.commons.configuration.Configuration config, String key) throws IOException {
String password;
String provider = config.getString(CERT_STORES_CREDENTIAL_PROVIDER_PATH);
if (provider != null) {
LOG.info("Attempting to retrieve password from confi... | java |
protected org.apache.commons.configuration.Configuration getConfiguration() {
try {
return ApplicationProperties.get();
} catch (AtlasException e) {
throw new RuntimeException("Unable to load configuration: " + ApplicationProperties.APPLICATION_PROPERTIES);
}
} | java |
public void andWith(OrCondition other) {
//Because Titan does not natively support Or conditions in Graph Queries,
//we need to expand out the condition so it is in the form of a single OrCondition
//that contains only AndConditions. We do this by following the rules of boolean
//algeb... | java |
public static boolean validate(final String date) {
Matcher matcher = PATTERN.matcher(date);
if (matcher.matches()) {
matcher.reset();
if (matcher.find()) {
int year = Integer.parseInt(matcher.group(1));
String month = matcher.group(2);
... | java |
private List<GroovyExpression> expandOrs(GroovyExpression expr, OptimizationContext context) {
if (GremlinQueryOptimizer.isOrExpression(expr)) {
return expandOrFunction(expr, context);
}
return processOtherExpression(expr, context);
} | java |
private List<GroovyExpression> expandOrFunction(GroovyExpression expr, OptimizationContext context) {
FunctionCallExpression functionCall = (FunctionCallExpression) expr;
GroovyExpression caller = functionCall.getCaller();
List<GroovyExpression> updatedCallers = null;
if (caller != null)... | java |
private List<GroovyExpression> processOtherExpression(GroovyExpression source, OptimizationContext context) {
UpdatedExpressions updatedChildren = getUpdatedChildren(source, context);
if (!updatedChildren.hasChanges()) {
return Collections.singletonList(source);
}
List<Groovy... | java |
protected List<GrantedAuthority> getAuthorities(String username) {
final List<GrantedAuthority> grantedAuths = new ArrayList<>();
grantedAuths.add(new SimpleGrantedAuthority("DATA_SCIENTIST"));
return grantedAuths;
} | java |
protected void checkVersion(VersionedMessage<T> versionedMessage, String messageJson) {
int comp = versionedMessage.compareVersion(expectedVersion);
// message has newer version
if (comp > 0) {
String msg =
String.format(VERSION_MISMATCH_MSG, expectedVersion, ver... | java |
@Override
@GraphTransaction
public String getOutputsGraph(String datasetName) throws AtlasException {
LOG.info("Fetching lineage outputs graph for datasetName={}", datasetName);
datasetName = ParamChecker.notEmpty(datasetName, "dataset name");
TypeUtils.Pair<String, String> typeIdPair = ... | java |
@Override
@GraphTransaction
public String getInputsGraph(String tableName) throws AtlasException {
LOG.info("Fetching lineage inputs graph for tableName={}", tableName);
tableName = ParamChecker.notEmpty(tableName, "table name");
TypeUtils.Pair<String, String> typeIdPair = validateDatase... | java |
@Override
@GraphTransaction
public String getSchema(String datasetName) throws AtlasException {
datasetName = ParamChecker.notEmpty(datasetName, "table name");
LOG.info("Fetching schema for tableName={}", datasetName);
TypeUtils.Pair<String, String> typeIdPair = validateDatasetNameExists... | java |
@POST
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasRelationship create(AtlasRelationship relationship) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf =... | java |
@PUT
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasRelationship update(AtlasRelationship relationship) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = ... | java |
@GET
@Path("/guid/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasRelationship getById(@PathParam("guid") String guid) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)... | java |
@DELETE
@Path("/guid/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public void deleteById(@PathParam("guid") String guid) throws AtlasBaseException {
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
... | java |
@Override
@GraphTransaction
public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
if ... | java |
AtlasVertex findVertex(DataTypes.TypeCategory category, String typeName) {
LOG.debug("Finding AtlasVertex for {}.{}", category, typeName);
Iterator results = graph.query().has(Constants.TYPENAME_PROPERTY_KEY, typeName).vertices().iterator();
AtlasVertex vertex = null;
if (results != nul... | java |
private List<AtlasVertex> createVertices(List<TypeVertexInfo> infoList) throws AtlasException {
List<AtlasVertex> result = new ArrayList<>(infoList.size());
List<String> typeNames = Lists.transform(infoList, new Function<TypeVertexInfo,String>() {
@Override
public String apply(T... | java |
@Override
public IDataType onTypeFault(String typeName) throws AtlasException {
// Type is not cached - check the type store.
// Any super and attribute types needed by the requested type
// which are not cached will also be loaded from the store.
Context context = new Context();
... | java |
private void evictionWarningIfNeeded() {
// If not logging eviction warnings, just return.
if (evictionWarningThrottle <= 0) {
return;
}
evictionsSinceWarning++;
if (evictionsSinceWarning >= evictionWarningThrottle) {
DateFormat dateFormat = DateFormat.g... | java |
@GET
@Path("/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasLineageInfo getLineageGraph(@PathParam("guid") String guid,
@QueryParam("direction") @DefaultValue(DEFAULT_DIRECTION) LineageDirection direction,
... | java |
private void initialize(AtlasGraph graph) throws RepositoryException, IndexException {
AtlasGraphManagement management = graph.getManagementSystem();
try {
if (management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)) {
LOG.info("Global indexes already exist for gr... | java |
@Override
public void onAdd(Collection<? extends IDataType> dataTypes) throws AtlasException {
AtlasGraphManagement management = provider.get().getManagementSystem();
for (IDataType dataType : dataTypes) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating in... | java |
@Override
public void instanceIsActive() throws AtlasException {
LOG.info("Reacting to active: initializing index");
try {
initialize();
} catch (RepositoryException | IndexException e) {
throw new AtlasException("Error in reacting to active on initialization", e);
... | java |
public static CreateUpdateEntitiesResult fromJson(String json) throws AtlasServiceException {
GuidMapping guidMapping = AtlasType.fromJson(json, GuidMapping.class);
EntityResult entityResult = EntityResult.fromString(json);
CreateUpdateEntitiesResult result = new CreateUpdateEntitiesResult();
... | java |
public static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef) throws AtlasBaseException {
// do not allow renames of the Def.
String existingName = existingRelationshipDef.getName();
String newName = newRelationshipDef.getName();
... | java |
public static String selectServerId(Configuration configuration) throws AtlasException {
// ids are already trimmed by this method
String[] ids = configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS);
String matchingServerId = null;
int appPort = Integer.parseInt(System.getPrope... | java |
@GET
@Path("{guid}/outputs/graph")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response outputsGraph(@PathParam("guid") String guid) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> LineageResource.outputsGraph({})", guid);
}
AtlasPerfT... | java |
@GET
@Path("{guid}/schema")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response schema(@PathParam("guid") String guid) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> LineageResource.schema({})", guid);
}
AtlasPerfTracer perf = null;
... | java |
public static Referenceable createClusterEntity(final org.apache.falcon.entity.v0.cluster.Cluster cluster) {
LOG.info("Creating cluster Entity : {}", cluster.getName());
Referenceable clusterRef = new Referenceable(FalconDataTypes.FALCON_CLUSTER.getName());
clusterRef.set(AtlasClient.NAME, clu... | java |
private Properties getConsumerProperties(NotificationType type) {
// find the configured group id for the given notification type
String groupId = properties.getProperty(type.toString().toLowerCase() + "." + CONSUMER_GROUP_ID_PROPERTY);
if (StringUtils.isEmpty(groupId)) {
throw new ... | java |
public List<String> createTraitType(String traitName, ImmutableSet<String> superTraits, AttributeDefinition... attributeDefinitions) throws AtlasServiceException {
HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef(traitName, superTraits, attributeDefinitions);
St... | java |
public List<String> listTypes() throws AtlasServiceException {
final JSONObject jsonObject = callAPIWithQueryParams(API.LIST_TYPES, null);
return extractResults(jsonObject, AtlasClient.RESULTS, new ExtractOperation<String, String>());
} | java |
public List<String> listTypes(final DataTypes.TypeCategory category) throws AtlasServiceException {
JSONObject response = callAPIWithRetries(API.LIST_TYPES, null, new ResourceCreator() {
@Override
public WebResource createResource() {
WebResource resource = getResource(AP... | java |
public EntityResult updateEntityAttribute(final String guid, final String attribute, String value)
throws AtlasServiceException {
LOG.debug("Updating entity id: {}, attribute name: {}, attribute value: {}", guid, attribute, value);
JSONObject response = callAPIWithRetries(API.UPDATE_ENTITY_P... | java |
public void addTrait(String guid, Struct traitDefinition) throws AtlasServiceException {
String traitJson = InstanceSerialization.toJson(traitDefinition, true);
LOG.debug("Adding trait to entity with id {} {}", guid, traitJson);
callAPIWithBodyAndParams(API.ADD_TRAITS, traitJson, guid, URI_TRAIT... | java |
public void deleteTrait(String guid, String traitName) throws AtlasServiceException {
callAPIWithBodyAndParams(API.DELETE_TRAITS, null, guid, TRAITS, traitName);
} | java |
public EntityResult deleteEntities(final String ... guids) throws AtlasServiceException {
LOG.debug("Deleting entities: {}", guids);
JSONObject jsonResponse = callAPIWithRetries(API.DELETE_ENTITIES, null, new ResourceCreator() {
@Override
public WebResource createResource() {
... | java |
public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue)
throws AtlasServiceException {
LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName,
uniqueAttributeValue);
API... | java |
public List<String> listEntities(final String entityType) throws AtlasServiceException {
JSONObject jsonResponse = callAPIWithRetries(API.LIST_ENTITIES, null, new ResourceCreator() {
@Override
public WebResource createResource() {
WebResource resource = getResource(API.LI... | java |
public List<String> listTraits(final String guid) throws AtlasServiceException {
JSONObject jsonResponse = callAPIWithBodyAndParams(API.LIST_TRAITS, null, guid, URI_TRAITS);
return extractResults(jsonResponse, AtlasClient.RESULTS, new ExtractOperation<String, String>());
} | java |
public List<Struct> listTraitDefinitions(final String guid) throws AtlasServiceException{
JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_ALL_TRAIT_DEFINITIONS, null, guid, TRAIT_DEFINITIONS);
List<JSONObject> traitDefList = extractResults(jsonResponse, AtlasClient.RESULTS, new ExtractOperati... | java |
public Struct getTraitDefinition(final String guid, final String traitName) throws AtlasServiceException{
JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName);
try {
return InstanceSerialization.fromJsonStruct(jsonResponse.ge... | java |
public List<EntityAuditEvent> getEntityAuditEvents(String entityId, short numResults)
throws AtlasServiceException {
return getEntityAuditEvents(entityId, null, numResults);
} | java |
public JSONArray searchByDSL(final String query, final int limit, final int offset) throws AtlasServiceException {
LOG.debug("DSL query: {}", query);
JSONObject result = callAPIWithRetries(API.SEARCH_DSL, null, new ResourceCreator() {
@Override
public WebResource createResource()... | java |
public JSONObject searchByFullText(final String query, final int limit, final int offset) throws AtlasServiceException {
return callAPIWithRetries(API.SEARCH_FULL_TEXT, null, new ResourceCreator() {
@Override
public WebResource createResource() {
WebResource resource = ge... | java |
@VisibleForTesting
public JSONObject callAPIWithResource(API api, WebResource resource) throws AtlasServiceException {
return callAPIWithResource(toAPIInfo(api), resource, null, JSONObject.class);
} | java |
public void writeBoolean(boolean value) {
try {
buffer.writeInt(1);
if (value) {
buffer.writeByte(1);
} else {
buffer.writeByte(0);
}
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} | java |
public void writeShort(int value) {
try {
buffer.writeInt(2);
buffer.writeShort(value);
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} | java |
public void writeInt(int value) {
try {
buffer.writeInt(4);
buffer.writeInt(value);
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} | java |
public void writeLong(long value) {
try {
buffer.writeInt(8);
buffer.writeLong(value);
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} | java |
public void writeFloat(float value) {
try {
buffer.writeInt(4);
buffer.writeFloat(value);
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} | java |
public void writeDouble(double value) {
try {
buffer.writeInt(8);
buffer.writeDouble(value);
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} | java |
@SuppressWarnings("checkstyle:magicnumber")
private static long toPgSecs(final long seconds) {
long secs = seconds;
// java epoc to postgres epoc
secs -= 946684800L;
// Julian/Greagorian calendar cutoff point
if (secs < -13165977600L) { // October 15, 1582 -> October 4, 1582... | java |
public void saveAll(PGConnection connection, Stream<TEntity> entities) throws SQLException {
try (PgBinaryWriter bw = new PgBinaryWriter(configuration.getBufferSize())) {
// Wrap the CopyOutputStream in our own Writer:
bw.open(new PGCopyOutputStream(connection, mapping.getCopyCommand()... | java |
static String capitalizeFirstWordAsciiOnly(String s) {
if (s == null || s.isEmpty()) {
return s;
}
int secondWordStart = s.length();
for (int i = 1; i < s.length(); i++) {
if (!isLowerCaseAsciiOnly(s.charAt(i))) {
secondWordStart = i;
break;
}
}
return toUpperCa... | java |
@Nullable static ExecutableElement findLargestPublicConstructor(TypeElement typeElement) {
List<ExecutableElement> constructors =
FluentIterable.from(ElementFilter.constructorsIn(typeElement.getEnclosedElements()))
.filter(FILTER_NON_PUBLIC)
.toList();
if (constructors.size() ==... | java |
static boolean isSingleton(Types types, TypeElement element) {
return isSingleton(types, element, element.asType());
} | java |
static boolean isParcelable(Elements elements, Types types, TypeMirror type) {
TypeMirror parcelableType = elements.getTypeElement(PARCELABLE_CLASS_NAME).asType();
return types.isAssignable(type, parcelableType);
} | java |
@Nullable static AnnotationMirror getAnnotationWithSimpleName(Element element, String name) {
for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
String annotationName = mirror.getAnnotationType().asElement().getSimpleName().toString();
if (name.equals(annotationName)) {
return mirr... | java |
private static boolean extractAndLoadLibraryFile(String libFolderForCurrentOS, String libraryFileName,
String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// Include architecture name in temporary filen... | java |
private static boolean loadNativeLibrary(String path, String name) {
File libPath = new File(path, name);
if(libPath.exists()) {
try {
System.load(new File(path, name).getAbsolutePath());
return true;
}
catch(UnsatisfiedLinkError e) {
... | java |
private static void loadSecp256k1NativeLibrary() throws Exception {
if(extracted) {
return;
}
// Try loading library from fr.acinq.secp256k1.lib.path library path */
String secp256k1NativeLibraryPath = System.getProperty("fr.acinq.secp256k1.lib.path");
String secp256... | java |
public static String absoluteHrefOf(final String path) {
try {
return fromCurrentServletMapping().path(path).build().toString();
} catch (final IllegalStateException e) {
return path;
}
} | java |
@Override
public void disable(final String jobType, final String comment) {
setValue(jobType, KEY_DISABLED, comment != null ? comment : "");
} | java |
@Override
public Set<String> findAllJobTypes() {
return stream(collection.find().maxTime(500, TimeUnit.MILLISECONDS).spliterator(), false)
.map(doc -> doc.getString(ID))
.collect(toSet());
} | java |
public boolean update(final V value, final long maxTime, final TimeUnit timeUnit) {
final K key = keyOf(value);
if (key != null) {
return collectionWithWriteTimeout(maxTime, timeUnit)
.replaceOne(byId(key), encode(value))
.getModifiedCount() == 1;
... | java |
public void delete(final K key, final long maxTime, final TimeUnit timeUnit) {
collectionWithWriteTimeout(maxTime, timeUnit).deleteOne(byId(key));
} | java |
protected Document byId(final K key) {
if (key != null) {
return new Document(ID, key.toString());
} else {
throw new NullPointerException("Key must not be null");
}
} | java |
@Override
public JobMeta getJobMeta(String jobType) {
final Map<String, String> document = map.get(jobType);
if (document != null) {
final Map<String, String> meta = document.keySet()
.stream()
.filter(key -> !key.startsWith("_e_"))
... | java |
public static ServiceType serviceType(final String type, final Criticality criticality, final String disasterImpact) {
return new ServiceType(type, criticality, disasterImpact);
} | java |
public static EdisonApplicationProperties edisonApplicationProperties(final String title,
final String group,
final String environment,
... | java |
public StatusDetail statusDetail(final JobDefinition jobDefinition) {
try {
final List<JobInfo> jobs = jobRepository.findLatestBy(jobDefinition.jobType(), numberOfJobs + 1);
return jobs.isEmpty()
? statusDetailWhenNoJobAvailable(jobDefinition)
: to... | java |
protected StatusDetail toStatusDetail(final List<JobInfo> jobInfos,
final JobDefinition jobDefinition) {
final Status status;
final String message;
final JobInfo currentJob = jobInfos.get(0);
final JobInfo lastJob = (!currentJob.getStopped().isPr... | java |
protected final long getNumFailedJobs(final List<JobInfo> jobInfos) {
return jobInfos
.stream()
.filter(job -> JobStatus.ERROR.equals(job.getStatus()))
.count();
} | java |
protected Map<String, String> runningDetailsFor(final JobInfo jobInfo) {
final Map<String, String> details = new HashMap<>();
details.put("Started", ISO_DATE_TIME.format(jobInfo.getStarted()));
if (jobInfo.getStopped().isPresent()) {
details.put("Stopped", ISO_DATE_TIME.format(jobInf... | java |
protected boolean jobTooOld(final JobInfo jobInfo, final JobDefinition jobDefinition) {
final Optional<OffsetDateTime> stopped = jobInfo.getStopped();
if (stopped.isPresent() && jobDefinition.maxAge().isPresent()) {
final OffsetDateTime deadlineToRerun = stopped.get().plus(jobDefinition.maxA... | java |
@Scheduled(fixedRate = KEEP_LAST_JOBS_CLEANUP_INTERVAL)
public void doCleanUp() {
final List<JobInfo> jobs = jobRepository.findAllJobInfoWithoutMessages();
findJobsToDelete(jobs)
.forEach(jobInfo -> jobRepository.removeIfStopped(jobInfo.getJobId()));
} | java |
public Optional<JobDefinition> getJobDefinition(final String jobType) {
return jobDefinitions
.stream()
.filter((j) -> j.jobType().equalsIgnoreCase(jobType))
.findAny();
} | java |
public Optional<String> startAsyncJob(String jobType) {
try {
final JobRunnable jobRunnable = findJobRunnable(jobType);
final JobInfo jobInfo = createJobInfo(jobType);
jobMetaService.aquireRunLock(jobInfo.getJobId(), jobInfo.getJobType());
jobRepository.createOrUp... | java |
public List<JobInfo> findJobs(final Optional<String> type, final int count) {
if (type.isPresent()) {
return jobRepository.findLatestBy(type.get(), count);
} else {
return jobRepository.findLatest(count);
}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.