idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
1,000 | @ 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 = AtlasPerfTracer . getPerfTracer ( PERF_... | Create a new relationship between entities . |
1,001 | @ 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 = AtlasPerfTracer . getPerfTracer ( PERF_... | Update an existing relationship between entities . |
1,002 | @ 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 ) ) { perf = AtlasPer... | Get relationship information between entities using guid . |
1,003 | @ 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 ) ) { perf = AtlasPerfTracer . ... | Delete a relationship between entities using guid . |
1,004 | 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 ( LOG . isDebugEnabled ( ) ) { LOG . deb... | Adds a new trait to the list of entities represented by their respective guids |
1,005 | 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 !=... | Find vertex for the given type category and name else create new vertex |
1,006 | 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 > ( ) { public String apply ( TypeVertexInf... | Finds or creates type vertices with the information specified . |
1,007 | public IDataType onTypeFault ( String typeName ) throws AtlasException { Context context = new Context ( ) ; TypesDef typesDef = getTypeFromStore ( typeName , context ) ; if ( typesDef . isEmpty ( ) ) { return null ; } TransientTypeSystem transientTypeSystem = typeSystem . createTransientTypeSystem ( context . getTypes... | Check the type store for the requested type . If found in the type store the type and any required super and attribute types are loaded from the type store and added to the cache . |
1,008 | private void evictionWarningIfNeeded ( ) { if ( evictionWarningThrottle <= 0 ) { return ; } evictionsSinceWarning ++ ; if ( evictionsSinceWarning >= evictionWarningThrottle ) { DateFormat dateFormat = DateFormat . getDateTimeInstance ( ) ; if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "There have been " + evictio... | Logs a warning if a threshold number of evictions has occurred since the last warning . |
1,009 | @ 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 , @ QueryParam ( "depth" ) @ DefaultValue (... | Returns lineage info about entity . |
1,010 | 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 graph" ) ; management . c... | Initializes the indices for the graph - create indices for Global AtlasVertex Keys |
1,011 | public void onAdd ( Collection < ? extends IDataType > dataTypes ) throws AtlasException { AtlasGraphManagement management = provider . get ( ) . getManagementSystem ( ) ; for ( IDataType dataType : dataTypes ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Creating indexes for type name={}, definition={}" , dataTy... | This is upon adding a new type to Store . |
1,012 | 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 ) ; } } | Initialize global indices for Titan graph on server activation . |
1,013 | public static CreateUpdateEntitiesResult fromJson ( String json ) throws AtlasServiceException { GuidMapping guidMapping = AtlasType . fromJson ( json , GuidMapping . class ) ; EntityResult entityResult = EntityResult . fromString ( json ) ; CreateUpdateEntitiesResult result = new CreateUpdateEntitiesResult ( ) ; resul... | Deserializes the given json into an instance of CreateUpdateEntitiesResult . |
1,014 | public static void preUpdateCheck ( AtlasRelationshipDef newRelationshipDef , AtlasRelationshipDef existingRelationshipDef ) throws AtlasBaseException { String existingName = existingRelationshipDef . getName ( ) ; String newName = newRelationshipDef . getName ( ) ; if ( ! existingName . equals ( newName ) ) { throw ne... | Check ends are the same and relationshipCategory is the same . |
1,015 | public static String selectServerId ( Configuration configuration ) throws AtlasException { String [ ] ids = configuration . getStringArray ( HAConfiguration . ATLAS_SERVER_IDS ) ; String matchingServerId = null ; int appPort = Integer . parseInt ( System . getProperty ( AtlasConstants . SYSTEM_PROPERTY_APP_PORT ) ) ; ... | Return the ID corresponding to this Atlas instance . |
1,016 | @ 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 ) ; } AtlasPerfTracer perf = null ; tr... | Returns the outputs graph for a given entity id . |
1,017 | @ 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 ; try { if ( AtlasPerfT... | Returns the schema for the given dataset id . |
1,018 | 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 ( AtlasCl... | Creates cluster entity |
1,019 | private Properties getConsumerProperties ( NotificationType type ) { String groupId = properties . getProperty ( type . toString ( ) . toLowerCase ( ) + "." + CONSUMER_GROUP_ID_PROPERTY ) ; if ( StringUtils . isEmpty ( groupId ) ) { throw new IllegalStateException ( "No configuration group id set for the notification t... | Get properties for consumer request |
1,020 | public List < String > createTraitType ( String traitName , ImmutableSet < String > superTraits , AttributeDefinition ... attributeDefinitions ) throws AtlasServiceException { HierarchicalTypeDefinition < TraitType > piiTrait = TypesUtil . createTraitTypeDef ( traitName , superTraits , attributeDefinitions ) ; String t... | Creates trait type with specifiedName superTraits and attributes |
1,021 | public List < String > listTypes ( ) throws AtlasServiceException { final JSONObject jsonObject = callAPIWithQueryParams ( API . LIST_TYPES , null ) ; return extractResults ( jsonObject , AtlasClient . RESULTS , new ExtractOperation < String , String > ( ) ) ; } | Returns all type names in the system |
1,022 | public List < String > listTypes ( final DataTypes . TypeCategory category ) throws AtlasServiceException { JSONObject response = callAPIWithRetries ( API . LIST_TYPES , null , new ResourceCreator ( ) { public WebResource createResource ( ) { WebResource resource = getResource ( API . LIST_TYPES . getPath ( ) ) ; resou... | Returns all type names with the given category |
1,023 | 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_PARTIAL , v... | Supports Partial updates Updates property for the entity corresponding to guid |
1,024 | 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_TRA... | Associate trait to an entity |
1,025 | public void deleteTrait ( String guid , String traitName ) throws AtlasServiceException { callAPIWithBodyAndParams ( API . DELETE_TRAITS , null , guid , TRAITS , traitName ) ; } | Delete a trait from the given entity |
1,026 | public EntityResult deleteEntities ( final String ... guids ) throws AtlasServiceException { LOG . debug ( "Deleting entities: {}" , guids ) ; JSONObject jsonResponse = callAPIWithRetries ( API . DELETE_ENTITIES , null , new ResourceCreator ( ) { public WebResource createResource ( ) { API api = API . DELETE_ENTITIES ;... | Delete the specified entities from the repository |
1,027 | public EntityResult deleteEntity ( String entityType , String uniqueAttributeName , String uniqueAttributeValue ) throws AtlasServiceException { LOG . debug ( "Deleting entity type: {}, attributeName: {}, attributeValue: {}" , entityType , uniqueAttributeName , uniqueAttributeValue ) ; API api = API . DELETE_ENTITY ; W... | Supports Deletion of an entity identified by its unique attribute value |
1,028 | public List < String > listEntities ( final String entityType ) throws AtlasServiceException { JSONObject jsonResponse = callAPIWithRetries ( API . LIST_ENTITIES , null , new ResourceCreator ( ) { public WebResource createResource ( ) { WebResource resource = getResource ( API . LIST_ENTITIES ) ; resource = resource . ... | List entities for a given entity type |
1,029 | 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 > ( ) ) ; } | List traits for a given entity identified by its GUID |
1,030 | 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 Extra... | Get all trait definitions for an entity |
1,031 | 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 . getString ... | Get trait definition for a given entity and traitname |
1,032 | public List < EntityAuditEvent > getEntityAuditEvents ( String entityId , short numResults ) throws AtlasServiceException { return getEntityAuditEvents ( entityId , null , numResults ) ; } | Get the latest numResults entity audit events in decreasing order of timestamp for the given entity id |
1,033 | 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 ( ) { public WebResource createResource ( ) { WebResource resource = ge... | Search given query DSL |
1,034 | public JSONObject searchByFullText ( final String query , final int limit , final int offset ) throws AtlasServiceException { return callAPIWithRetries ( API . SEARCH_FULL_TEXT , null , new ResourceCreator ( ) { public WebResource createResource ( ) { WebResource resource = getResource ( API . SEARCH_FULL_TEXT ) ; reso... | Search given full text search |
1,035 | public JSONObject callAPIWithResource ( API api , WebResource resource ) throws AtlasServiceException { return callAPIWithResource ( toAPIInfo ( api ) , resource , null , JSONObject . class ) ; } | Wrapper methods for compatibility |
1,036 | 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 ) ; } } | Writes primitive boolean to the output stream |
1,037 | public void writeShort ( int value ) { try { buffer . writeInt ( 2 ) ; buffer . writeShort ( value ) ; } catch ( Exception e ) { throw new BinaryWriteFailedException ( e ) ; } } | Writes primitive short to the output stream |
1,038 | public void writeInt ( int value ) { try { buffer . writeInt ( 4 ) ; buffer . writeInt ( value ) ; } catch ( Exception e ) { throw new BinaryWriteFailedException ( e ) ; } } | Writes primitive integer to the output stream |
1,039 | public void writeLong ( long value ) { try { buffer . writeInt ( 8 ) ; buffer . writeLong ( value ) ; } catch ( Exception e ) { throw new BinaryWriteFailedException ( e ) ; } } | Writes primitive long to the output stream |
1,040 | public void writeFloat ( float value ) { try { buffer . writeInt ( 4 ) ; buffer . writeFloat ( value ) ; } catch ( Exception e ) { throw new BinaryWriteFailedException ( e ) ; } } | Writes primitive float to the output stream |
1,041 | public void writeDouble ( double value ) { try { buffer . writeInt ( 8 ) ; buffer . writeDouble ( value ) ; } catch ( Exception e ) { throw new BinaryWriteFailedException ( e ) ; } } | Writes primitive double to the output stream |
1,042 | @ SuppressWarnings ( "checkstyle:magicnumber" ) private static long toPgSecs ( final long seconds ) { long secs = seconds ; secs -= 946684800L ; if ( secs < - 13165977600L ) { secs -= 86400 * 10 ; if ( secs < - 15773356800L ) { int years = ( int ) ( ( secs + 15773356800L ) / - 3155823050L ) ; years ++ ; years -= years ... | Converts the given java seconds to postgresql seconds . The conversion is valid for any year 100 BC onwards . |
1,043 | public void saveAll ( PGConnection connection , Stream < TEntity > entities ) throws SQLException { try ( PgBinaryWriter bw = new PgBinaryWriter ( configuration . getBufferSize ( ) ) ) { bw . open ( new PGCopyOutputStream ( connection , mapping . getCopyCommand ( ) , 1 ) ) ; entities . forEach ( entity -> saveEntitySyn... | Save stream of entities |
1,044 | 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 toUpperCaseAsciiOnly ( s . sub... | fooBar - > FOOBar FooBar - > FOOBar foo - > FOO |
1,045 | static ExecutableElement findLargestPublicConstructor ( TypeElement typeElement ) { List < ExecutableElement > constructors = FluentIterable . from ( ElementFilter . constructorsIn ( typeElement . getEnclosedElements ( ) ) ) . filter ( FILTER_NON_PUBLIC ) . toList ( ) ; if ( constructors . size ( ) == 0 ) { return null... | Returns the public constructor in a given class with the largest number of arguments or null if there are no public constructors . |
1,046 | static boolean isSingleton ( Types types , TypeElement element ) { return isSingleton ( types , element , element . asType ( ) ) ; } | A singleton is defined by a class with a public static final field named INSTANCE with a type assignable from itself . |
1,047 | static boolean isParcelable ( Elements elements , Types types , TypeMirror type ) { TypeMirror parcelableType = elements . getTypeElement ( PARCELABLE_CLASS_NAME ) . asType ( ) ; return types . isAssignable ( type , parcelableType ) ; } | Returns true if a type implements Parcelable |
1,048 | 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... | Finds an annotation with the given name on the given element or null if not found . |
1,049 | private static boolean extractAndLoadLibraryFile ( String libFolderForCurrentOS , String libraryFileName , String targetFolder ) { String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName ; String uuid = UUID . randomUUID ( ) . toString ( ) ; String extractedLibFileName = String . format ( "secp256k... | Extracts and loads the specified library file to the target folder |
1,050 | 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 ) { System . err . println ( "Failed to load native lib... | Loads native library using the given path and name of the library . |
1,051 | private static void loadSecp256k1NativeLibrary ( ) throws Exception { if ( extracted ) { return ; } String secp256k1NativeLibraryPath = System . getProperty ( "fr.acinq.secp256k1.lib.path" ) ; String secp256k1NativeLibraryName = System . getProperty ( "fr.acinq.secp256k1.lib.name" ) ; if ( secp256k1NativeLibraryName ==... | Loads secp256k1 native library using given path and name of the library . |
1,052 | public static String absoluteHrefOf ( final String path ) { try { return fromCurrentServletMapping ( ) . path ( path ) . build ( ) . toString ( ) ; } catch ( final IllegalStateException e ) { return path ; } } | Returns an absolute URL for the specified path . |
1,053 | public void disable ( final String jobType , final String comment ) { setValue ( jobType , KEY_DISABLED , comment != null ? comment : "" ) ; } | Disables a job type i . e . prevents it from being started |
1,054 | public Set < String > findAllJobTypes ( ) { return stream ( collection . find ( ) . maxTime ( 500 , TimeUnit . MILLISECONDS ) . spliterator ( ) , false ) . map ( doc -> doc . getString ( ID ) ) . collect ( toSet ( ) ) ; } | Returns all job types having state information . |
1,055 | 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 ; } else { throw new IllegalArgumentExceptio... | Updates the document if it is already present in the repository . |
1,056 | public void delete ( final K key , final long maxTime , final TimeUnit timeUnit ) { collectionWithWriteTimeout ( maxTime , timeUnit ) . deleteOne ( byId ( key ) ) ; } | Deletes the document identified by key . |
1,057 | protected Document byId ( final K key ) { if ( key != null ) { return new Document ( ID , key . toString ( ) ) ; } else { throw new NullPointerException ( "Key must not be null" ) ; } } | Returns a query that is selecting documents by ID . |
1,058 | 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_" ) ) . collect ( toMap ( key -> key , document :: get ) ) ; final ... | Returns the current state of the specified job type . |
1,059 | public static ServiceType serviceType ( final String type , final Criticality criticality , final String disasterImpact ) { return new ServiceType ( type , criticality , disasterImpact ) ; } | Creates a ServiceType . |
1,060 | public static EdisonApplicationProperties edisonApplicationProperties ( final String title , final String group , final String environment , final String description ) { final EdisonApplicationProperties edisonApplicationProperties = new EdisonApplicationProperties ( ) ; edisonApplicationProperties . setTitle ( title )... | Only used in tests . |
1,061 | public StatusDetail statusDetail ( final JobDefinition jobDefinition ) { try { final List < JobInfo > jobs = jobRepository . findLatestBy ( jobDefinition . jobType ( ) , numberOfJobs + 1 ) ; return jobs . isEmpty ( ) ? statusDetailWhenNoJobAvailable ( jobDefinition ) : toStatusDetail ( jobs , jobDefinition ) ; } catch ... | Returns a StatusDetail for a JobDefinition . The Status of the StatusDetail is calculated using the last job executions and depends on the configuration of the calculator . |
1,062 | 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 ( ) . isPresent ( ) && currentJob . getStatus ( ) == JobStatu... | Calculates the StatusDetail from the last job executions . |
1,063 | protected final long getNumFailedJobs ( final List < JobInfo > jobInfos ) { return jobInfos . stream ( ) . filter ( job -> JobStatus . ERROR . equals ( job . getStatus ( ) ) ) . count ( ) ; } | Returns the number of failed jobs . |
1,064 | 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 . ... | Returns additional information like job uri running state started and stopped timestamps . |
1,065 | 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 ( jobDefinitio... | Calculates whether or not the last job execution is too old . |
1,066 | @ Scheduled ( fixedRate = KEEP_LAST_JOBS_CLEANUP_INTERVAL ) public void doCleanUp ( ) { final List < JobInfo > jobs = jobRepository . findAllJobInfoWithoutMessages ( ) ; findJobsToDelete ( jobs ) . forEach ( jobInfo -> jobRepository . removeIfStopped ( jobInfo . getJobId ( ) ) ) ; } | Execute the cleanup of the given repository . |
1,067 | public Optional < JobDefinition > getJobDefinition ( final String jobType ) { return jobDefinitions . stream ( ) . filter ( ( j ) -> j . jobType ( ) . equalsIgnoreCase ( jobType ) ) . findAny ( ) ; } | Returns an optional JobDefinition matching the given jobType . |
1,068 | public Optional < String > startAsyncJob ( String jobType ) { try { final JobRunnable jobRunnable = findJobRunnable ( jobType ) ; final JobInfo jobInfo = createJobInfo ( jobType ) ; jobMetaService . aquireRunLock ( jobInfo . getJobId ( ) , jobInfo . getJobType ( ) ) ; jobRepository . createOrUpdate ( jobInfo ) ; return... | Starts a job asynchronously in the background . |
1,069 | 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 ) ; } } | Find the latest jobs optionally restricted to jobs of a specified type . |
1,070 | private void clearRunLocks ( ) { jobMetaService . runningJobs ( ) . forEach ( ( RunningJob runningJob ) -> { final Optional < JobInfo > jobInfoOptional = jobRepository . findOne ( runningJob . jobId ) ; if ( jobInfoOptional . isPresent ( ) && jobInfoOptional . get ( ) . isStopped ( ) ) { jobMetaService . releaseRunLock... | Checks all run locks and releases the lock if the job is stopped . |
1,071 | public static VersionInfoProperties versionInfoProperties ( final String version , final String commit , final String urlTemplate ) { final VersionInfoProperties p = new VersionInfoProperties ( ) ; p . version = version ; p . commit = commit ; p . urlTemplate = urlTemplate ; return p ; } | Used for testing purposes . |
1,072 | public StatusDetail withDetail ( final String key , final String value ) { final LinkedHashMap < String , String > newDetails = new LinkedHashMap < > ( details ) ; newDetails . put ( key , value ) ; return statusDetail ( name , status , message , newDetails ) ; } | Create a copy of this StatusDetail add a detail and return the new StatusDetail . |
1,073 | public StatusDetail withoutDetail ( final String key ) { final LinkedHashMap < String , String > newDetails = new LinkedHashMap < > ( details ) ; newDetails . remove ( key ) ; return statusDetail ( name , status , message , newDetails ) ; } | Create a copy of this StatusDetail remove a detail and return the new StatusDetail . |
1,074 | public static DatasourceDependencyBuilder mongoDependency ( final List < Datasource > datasources ) { return new DatasourceDependencyBuilder ( ) . withDatasources ( datasources ) . withType ( DatasourceDependency . TYPE_DB ) . withSubtype ( DatasourceDependency . SUBTYPE_MONGODB ) ; } | Creates a ServiceDependencyBuilder with type = db and subtype = MongoDB . |
1,075 | public static DatasourceDependencyBuilder redisDependency ( final List < Datasource > datasources ) { return new DatasourceDependencyBuilder ( ) . withDatasources ( datasources ) . withType ( DatasourceDependency . TYPE_DB ) . withSubtype ( DatasourceDependency . SUBTYPE_REDIS ) ; } | Creates a ServiceDependencyBuilder with type = db and subtype = Redis . |
1,076 | public static DatasourceDependencyBuilder cassandraDependency ( final List < Datasource > datasources ) { return new DatasourceDependencyBuilder ( ) . withDatasources ( datasources ) . withType ( DatasourceDependency . TYPE_DB ) . withSubtype ( DatasourceDependency . SUBTYPE_CASSANDRA ) ; } | Creates a ServiceDependencyBuilder with type = db and subtype = Cassandra . |
1,077 | public static DatasourceDependencyBuilder elasticSearchDependency ( final List < Datasource > datasources ) { return new DatasourceDependencyBuilder ( ) . withDatasources ( datasources ) . withType ( DatasourceDependency . TYPE_DB ) . withSubtype ( DatasourceDependency . SUBTYPE_ELASTICSEARCH ) ; } | Creates a ServiceDependencyBuilder with type = db and subtype = ElasticSearch . |
1,078 | public static DatasourceDependencyBuilder kafkaDependency ( final List < Datasource > datasources ) { return new DatasourceDependencyBuilder ( ) . withDatasources ( datasources ) . withType ( DatasourceDependency . TYPE_QUEUE ) . withSubtype ( DatasourceDependency . SUBTYPE_KAFKA ) ; } | Creates a ServiceDependencyBuilder with type = queue and subtype = Kafka . |
1,079 | public static LdapProperties ldapProperties ( final String host , final int port , final List < String > baseDn , final String roleBaseDn , final String rdnIdentifier , final List < String > prefix , final EncryptionType encryptionType , final String ... whitelistedPaths ) { final LdapProperties ldap = new LdapProperti... | Creates Ldap properties . Primarily used in tests . |
1,080 | public static ServiceDependencyBuilder restServiceDependency ( final String url ) { return new ServiceDependencyBuilder ( ) . withUrl ( url ) . withType ( ServiceDependency . TYPE_SERVICE ) . withSubtype ( ServiceDependency . SUBTYPE_REST ) . withMethods ( singletonList ( "GET" ) ) . withMediaTypes ( singletonList ( "a... | Creates a ServiceDependencyBuilder with type = service and subtype = REST . |
1,081 | public static ServiceDependencyBuilder serviceDependency ( final String url ) { return new ServiceDependencyBuilder ( ) . withUrl ( url ) . withType ( ServiceDependency . TYPE_SERVICE ) . withSubtype ( ServiceDependency . SUBTYPE_OTHER ) ; } | Creates a generic ServiceDependencyBuilder with type = service and subtype = OTHER . |
1,082 | public static Datasource datasource ( final String node , final int port , final String resource ) { return new Datasource ( node , port , resource ) ; } | Creates a Datasource from node port and resource descriptors . |
1,083 | public static JobDefinition manuallyTriggerableJobDefinition ( final String jobType , final String jobName , final String description , final int restarts , final Optional < Duration > maxAge ) { return new DefaultJobDefinition ( jobType , jobName , description , maxAge , Optional . empty ( ) , Optional . empty ( ) , r... | Create a JobDefinition for a job that will not be triggered automatically by a job trigger . |
1,084 | public byte [ ] getData ( ) { byte [ ] data = new byte [ frameData . length + 2 ] ; int first2 = ( FRAME_SYNC << 2 ) ; if ( blockSizeVariable ) first2 ++ ; IOUtils . putInt2BE ( data , 0 , first2 ) ; System . arraycopy ( frameData , 0 , data , 2 , frameData . length ) ; return data ; } | Returns the contents including the sync header |
1,085 | public void setUtc ( String utc ) { if ( utc == null ) { this . utc = null ; } else { if ( utc . length ( ) != 20 ) { throw new IllegalArgumentException ( "Must be of the form YYYYMMDDTHHMMSS.sssZ" ) ; } } } | Sets the ISO - 8601 UTC time of the file which must be YYYYMMDDTHHMMSS . sssZ or null |
1,086 | public void processPacket ( OggPacket packet ) { SkeletonPacket skel = SkeletonPacketFactory . create ( packet ) ; if ( packet . isBeginningOfStream ( ) ) { fishead = ( SkeletonFishead ) skel ; } else if ( skel instanceof SkeletonFisbone ) { SkeletonFisbone bone = ( SkeletonFisbone ) skel ; fisbones . add ( bone ) ; bo... | Processes and tracks the next packet for the stream |
1,087 | public SkeletonFisbone addBoneForStream ( int sid ) { SkeletonFisbone bone = new SkeletonFisbone ( ) ; bone . setSerialNumber ( sid ) ; fisbones . add ( bone ) ; if ( sid == - 1 || bonesByStream . containsKey ( sid ) ) { throw new IllegalArgumentException ( "Invalid / duplicate sid " + sid ) ; } bonesByStream . put ( s... | Adds a new fisbone for the given stream |
1,088 | protected int addPacket ( OggPacket packet , int offset ) { if ( packet . isBeginningOfStream ( ) ) { isBOS = true ; } if ( packet . isEndOfStream ( ) ) { isEOS = true ; } int size = packet . getData ( ) . length ; for ( int i = numLVs ; i < 255 ; i ++ ) { int remains = size - offset ; int toAdd = 255 ; if ( remains < ... | Adds as much of the packet s data as we can do . |
1,089 | public boolean isChecksumValid ( ) { if ( checksum == 0 ) return true ; int crc = CRCUtils . getCRC ( getHeader ( ) ) ; if ( data != null && data . length > 0 ) { crc = CRCUtils . getCRC ( data , crc ) ; } return ( checksum == crc ) ; } | Is the checksum for the page valid? |
1,090 | protected boolean hasSpaceFor ( int bytes ) { int reqLVs = ( int ) Math . ceil ( bytes / 255.0 ) ; if ( numLVs + reqLVs > 255 ) { return false ; } return true ; } | Does this Page have space for the given number of bytes? |
1,091 | public int getDataSize ( ) { int size = 0 ; for ( int i = 0 ; i < numLVs ; i ++ ) { size += IOUtils . toInt ( lvs [ i ] ) ; } return size ; } | How big is the page excluding headers? |
1,092 | protected byte [ ] getHeader ( ) { byte [ ] header = new byte [ MINIMUM_PAGE_SIZE + numLVs ] ; header [ 0 ] = ( byte ) 'O' ; header [ 1 ] = ( byte ) 'g' ; header [ 2 ] = ( byte ) 'g' ; header [ 3 ] = ( byte ) 'S' ; header [ 4 ] = 0 ; byte flags = 0 ; if ( isContinue ) { flags += 1 ; } if ( isBOS ) { flags += 2 ; } if (... | Gets the header but with a blank CRC field |
1,093 | protected OggStreamPacket createNext ( OggPacket packet ) { if ( type == OggStreamIdentifier . OGG_VORBIS ) { return VorbisPacketFactory . create ( packet ) ; } else if ( type == OggStreamIdentifier . SPEEX_AUDIO ) { return SpeexPacketFactory . create ( packet ) ; } else if ( type == OggStreamIdentifier . OPUS_AUDIO ) ... | Creates an appropriate high level packet |
1,094 | public boolean populate ( OggPacket packet ) { if ( type == OggStreamIdentifier . OGG_FLAC ) { if ( tags == null ) { tags = new FlacTags ( packet ) ; return true ; } else { return false ; } } OggStreamPacket sPacket = createNext ( packet ) ; if ( sPacket instanceof OggAudioTagsHeader ) { tags = ( OggAudioTagsHeader ) s... | Populates with the next header |
1,095 | public static long readUE7 ( InputStream stream ) throws IOException { int i ; long v = 0 ; while ( ( i = stream . read ( ) ) >= 0 ) { v = v << 7 ; if ( ( i & 128 ) == 128 ) { v += ( i & 127 ) ; } else { v += i ; break ; } } return v ; } | Gets the integer value that is stored in UTF - 8 like fashion in Big Endian but with the high bit on each number indicating if it continues or not |
1,096 | public static String removeNullPadding ( String str ) { int idx = str . indexOf ( 0 ) ; if ( idx == - 1 ) { return str ; } return str . substring ( 0 , idx ) ; } | Strips off any null padding if any from the string |
1,097 | public static void writeUTF8 ( OutputStream out , String str ) throws IOException { byte [ ] s = str . getBytes ( UTF8 ) ; out . write ( s ) ; } | Writes the string out as UTF - 8 |
1,098 | public static boolean byteRangeMatches ( byte [ ] wanted , byte [ ] within , int withinOffset ) { for ( int i = 0 ; i < wanted . length ; i ++ ) { if ( wanted [ i ] != within [ i + withinOffset ] ) return false ; } return true ; } | Checks to see if the wanted byte pattern is found in the within bytes from the given offset |
1,099 | protected static MediaType toMediaType ( OggStreamType type ) { if ( type == OggStreamIdentifier . UNKNOWN ) { return OGG_GENERAL ; } else { return MediaType . parse ( type . mimetype ) ; } } | Converts from our type to Tika s type |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.