idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
42,100
@ GET @ Path ( "{guid}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response getEntityDefinition ( @ PathParam ( "guid" ) String guid ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> EntityResource.getEntityDefinition({})" , guid ) ; } AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . isPerfTrac...
Fetch the complete definition of an entity given its GUID .
610
13
42,101
public Response getEntityListByType ( String entityType ) { try { Preconditions . checkNotNull ( entityType , "Entity type cannot be null" ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Fetching entity list for type={} " , entityType ) ; } final List < String > entityList = metadataService . getEntityList ( entit...
Gets the list of entities for a given entity type .
391
12
42,102
public Response getEntityDefinitionByAttribute ( String entityType , String attribute , String value ) { try { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Fetching entity definition for type={}, qualified name={}" , entityType , value ) ; } entityType = ParamChecker . notEmpty ( entityType , "Entity type cannot be...
Fetch the complete definition of an entity given its qualified name .
661
13
42,103
@ GET @ Path ( "{guid}/traitDefinitions" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response getTraitDefinitionsForEntity ( @ PathParam ( "guid" ) String guid ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> EntityResource.getTraitDefinitionsForEntity({})" , guid ) ; } AtlasPerfTracer perf = null ; try ...
Fetches the trait definitions of all the traits associated to the given entity
586
15
42,104
@ GET @ Path ( "{guid}/traitDefinitions/{traitName}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response getTraitDefinitionForEntity ( @ PathParam ( "guid" ) String guid , @ PathParam ( "traitName" ) String traitName ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> EntityResource.getTraitDefinitionForEn...
Fetches the trait definition for an entity given its guid and trait name
600
15
42,105
@ GET @ Path ( "{guid}/audit" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response getAuditEvents ( @ PathParam ( "guid" ) String guid , @ QueryParam ( "startKey" ) String startKey , @ QueryParam ( "count" ) @ DefaultValue ( "100" ) short count ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> EntityResou...
Returns the entity audit events for a given entity id . The events are returned in the decreasing order of timestamp .
563
22
42,106
public boolean isOrderExpression ( GroovyExpression expr ) { if ( expr instanceof FunctionCallExpression ) { FunctionCallExpression functionCallExpression = ( FunctionCallExpression ) expr ; if ( functionCallExpression . getFunctionName ( ) . equals ( ORDER_METHOD ) ) { return true ; } } return false ; }
Determines if specified expression is an order method call
72
11
42,107
public GroovyExpression generateUnaryHasExpression ( GroovyExpression parent , String fieldName ) { return new FunctionCallExpression ( TraversalStepType . FILTER , parent , HAS_METHOD , new LiteralExpression ( fieldName ) ) ; }
Generates an expression which checks whether the vertices in the query have a field with the given name .
57
21
42,108
protected GroovyExpression generateLoopEmitExpression ( GraphPersistenceStrategies s , IDataType dataType ) { return typeTestExpression ( s , dataType . getName ( ) , getCurrentObjectExpression ( ) ) ; }
Generates the emit expression used in loop expressions .
53
10
42,109
public GroovyExpression generateAliasExpression ( GroovyExpression parent , String alias ) { return new FunctionCallExpression ( TraversalStepType . SIDE_EFFECT , parent , AS_METHOD , new LiteralExpression ( alias ) ) ; }
Generates an alias expression
56
5
42,110
public GroovyExpression generateAdjacentVerticesExpression ( GroovyExpression parent , AtlasEdgeDirection dir ) { return new FunctionCallExpression ( TraversalStepType . FLAT_MAP_TO_ELEMENTS , parent , getGremlinFunctionName ( dir ) ) ; }
Generates an expression that gets the vertices adjacent to the vertex in parent in the specified direction .
64
20
42,111
public GroovyExpression generateAdjacentVerticesExpression ( GroovyExpression parent , AtlasEdgeDirection dir , String label ) { return new FunctionCallExpression ( TraversalStepType . FLAT_MAP_TO_ELEMENTS , parent , getGremlinFunctionName ( dir ) , new LiteralExpression ( label ) ) ; }
Generates an expression that gets the vertices adjacent to the vertex in parent in the specified direction following only edges with the given label .
76
27
42,112
public GroovyExpression generateCountExpression ( GroovyExpression itExpr ) { GroovyExpression collectionExpr = new CastExpression ( itExpr , "Collection" ) ; return new FunctionCallExpression ( collectionExpr , "size" ) ; }
assumes cast already performed
58
5
42,113
public String getAliasNameIfRelevant ( GroovyExpression expr ) { if ( ! ( expr instanceof FunctionCallExpression ) ) { return null ; } FunctionCallExpression fc = ( FunctionCallExpression ) expr ; if ( ! fc . getFunctionName ( ) . equals ( AS_METHOD ) ) { return null ; } LiteralExpression aliasName = ( LiteralExpressio...
Checks if the given expression is an alias expression and if so returns the alias from the expression . Otherwise null is returned .
115
25
42,114
@ GET @ Path ( "stack" ) @ Produces ( MediaType . TEXT_PLAIN ) public String getThreadDump ( ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> AdminResource.getThreadDump()" ) ; } ThreadGroup topThreadGroup = Thread . currentThread ( ) . getThreadGroup ( ) ; while ( topThreadGroup . getParent ( ) != null ) { top...
Fetches the thread stack dump for this application .
285
11
42,115
@ GET @ Path ( "version" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response getVersion ( ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> AdminResource.getVersion()" ) ; } if ( version == null ) { try { PropertiesConfiguration configProperties = new PropertiesConfiguration ( "atlas-buildinfo.properties...
Fetches the version for this application .
317
9
42,116
private Referenceable registerDatabase ( String databaseName ) throws Exception { Referenceable dbRef = getDatabaseReference ( clusterName , databaseName ) ; Database db = hiveClient . getDatabase ( databaseName ) ; if ( db != null ) { if ( dbRef == null ) { dbRef = createDBInstance ( db ) ; dbRef = registerInstance ( ...
Checks if db is already registered else creates and registers db entity
142
13
42,117
private Referenceable registerInstance ( Referenceable referenceable ) throws Exception { String typeName = referenceable . getTypeName ( ) ; LOG . debug ( "creating instance of type {}" , typeName ) ; String entityJSON = InstanceSerialization . toJson ( referenceable , true ) ; LOG . debug ( "Submitting new entity {} ...
Registers an entity in atlas
167
7
42,118
private Referenceable getDatabaseReference ( String clusterName , String databaseName ) throws Exception { LOG . debug ( "Getting reference for database {}" , databaseName ) ; String typeName = HiveDataTypes . HIVE_DB . getName ( ) ; return getEntityReference ( typeName , getDBQualifiedName ( clusterName , databaseName...
Gets reference to the atlas entity for the database
75
11
42,119
public static String getDBQualifiedName ( String clusterName , String dbName ) { return String . format ( "%s@%s" , dbName . toLowerCase ( ) , clusterName ) ; }
Construct the qualified name used to uniquely identify a Database instance in Atlas .
44
14
42,120
private int importTables ( Referenceable databaseReferenceable , String databaseName , final boolean failOnError ) throws Exception { int tablesImported = 0 ; List < String > hiveTables = hiveClient . getAllTables ( databaseName ) ; LOG . info ( "Importing tables {} for db {}" , hiveTables . toString ( ) , databaseName...
Imports all tables for the given db
208
8
42,121
private Referenceable getTableReference ( Table hiveTable ) throws Exception { LOG . debug ( "Getting reference for table {}.{}" , hiveTable . getDbName ( ) , hiveTable . getTableName ( ) ) ; String typeName = HiveDataTypes . HIVE_TABLE . getName ( ) ; String tblQualifiedName = getTableQualifiedName ( getClusterName ( ...
Gets reference for the table
120
6
42,122
public Referenceable createTableInstance ( Referenceable dbReference , Table hiveTable ) throws AtlasHookException { return createOrUpdateTableInstance ( dbReference , null , hiveTable ) ; }
Create a new table instance in Atlas
39
7
42,123
@ Override public GroovyExpression apply ( GroovyExpression expr , OptimizationContext context ) { FunctionCallExpression exprAsFunction = ( FunctionCallExpression ) expr ; GroovyExpression result = exprAsFunction . getCaller ( ) ; List < GroovyExpression > nonExtractableArguments = new ArrayList <> ( ) ; for ( GroovyE...
Expands the given and expression . There is no need to recursively expand the children here . This method is called recursively by GremlinQueryOptimier on the children .
413
38
42,124
private void updateCurrentFunction ( AbstractFunctionExpression parentExpr ) { GroovyExpression expr = parentExpr . getCaller ( ) ; if ( expr instanceof AbstractFunctionExpression ) { AbstractFunctionExpression exprAsFunction = ( AbstractFunctionExpression ) expr ; GroovyExpression exprCaller = exprAsFunction . getCall...
Adds the caller of parentExpr to the current body of the last function that was created .
103
19
42,125
private boolean creatingFunctionShortensGremlin ( GroovyExpression headExpr ) { int tailLength = getTailLength ( ) ; int length = headExpr . toString ( ) . length ( ) - tailLength ; int overhead = 0 ; if ( nextFunctionBodyStart instanceof AbstractFunctionExpression ) { overhead = functionDefLength ; } else { overhead =...
the overall length of the Groovy script .
153
9
42,126
private AtlasEdge createInverseReference ( AtlasAttribute inverseAttribute , AtlasStructType inverseAttributeType , AtlasVertex inverseVertex , AtlasVertex vertex ) throws AtlasBaseException { String propertyName = AtlasGraphUtilsV1 . getQualifiedAttributePropertyKey ( inverseAttributeType , inverseAttribute . getName ...
legacy method to create edges for inverse reference
148
9
42,127
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 ( ) ) { Append...
Get the root logger file location under which the failed log messages will be written .
183
16
42,128
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 : superTypeStores ) { s . assignPosition ( id ) ; } ret...
Assign a storage position to an Id . - try to assign from freePositions - ensure storage capacity . - add entry in idPosMap .
98
30
42,129
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 ) ; } } }
- remove from idPosMap - add to freePositions .
71
13
42,130
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 ) ; } }
- store the typeName - store the immediate attributes in the respective IAttributeStore - call store on each SuperType .
80
24
42,131
void load ( ReferenceableInstance i ) throws RepositoryException { int pos = idPosMap . get ( i . getId ( ) ) ; loadFields ( pos , i ) ; for ( HierarchicalTypeStore s : superTypeStores ) { s . load ( i ) ; } }
- copy over the immediate attribute values from the respective IAttributeStore - call load on each SuperType .
63
21
42,132
public static String getMessageJson ( Object message ) { VersionedMessage < ? > versionedMessage = new VersionedMessage <> ( CURRENT_MESSAGE_VERSION , message ) ; return GSON . toJson ( versionedMessage ) ; }
Get the notification message JSON from the given object .
56
10
42,133
@ 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 ; } SortedMap < String , EntityA...
while we are iterating through the map
153
8
42,134
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 ( attribute . name )...
Validates that the old field mapping can be replaced with new field mapping
364
14
42,135
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 direction: " + dir ) ; } }
Retrieves the titan direction corresponding to the given AtlasEdgeDirection .
65
15
42,136
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 ( this , attrDe...
construct a temporary StructType for a Query Result . This is not registered in the typeSystem . The attributes in the typeDefinition can only reference permanent types .
118
31
42,137
@ 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_DEFAULT ) @ QueryParam ( "offset" ) in...
Search using a given query .
244
6
42,138
@ 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 , @ DefaultValue ( LIMIT_OFFSET_DEFAULT ) @ QueryP...
Search using query DSL format .
573
6
42,139
@ 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.se...
Search using raw gremlin query format .
599
8
42,140
public AndCondition copy ( ) { AndCondition builder = new AndCondition ( ) ; builder . children . addAll ( children ) ; return builder ; }
Makes a copy of this AndExpr .
31
10
42,141
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 ; }
Creates a NativeTitanGraphQuery that can be used to evaluate this condition .
76
17
42,142
public void cache ( AtlasEntityWithExtInfo entity ) { if ( entity != null && entity . getEntity ( ) != null && entity . getEntity ( ) . getGuid ( ) != null ) { entityCacheV2 . put ( entity . getEntity ( ) . getGuid ( ) , entity ) ; } }
Adds the specified instance to the cache
68
7
42,143
@ 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 ) ; } catch ( AtlasBas...
Assumes the User is familiar with the persistence structure of the Repository . The given query is run uninterpreted against the underlying Graph Store . The results are returned as a List of Rows . each row is a Map of Key Value pairs .
93
50
42,144
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 ) ; modifiersField . setInt ( field , ...
Titan loads index backend name to implementation using StandardIndexProvider . ALL_MANAGER_CLASSES But StandardIndexProvider . ALL_MANAGER_CLASSES is a private static final ImmutableMap Only way to inject Solr5Index is to modify this field . So using hacky reflection to add Sol5Index
270
66
42,145
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 configured credent...
Retrieves a password from a configured credential provider or prompts for the password and stores it in the configured credential provider .
249
24
42,146
protected org . apache . commons . configuration . Configuration getConfiguration ( ) { try { return ApplicationProperties . get ( ) ; } catch ( AtlasException e ) { throw new RuntimeException ( "Unable to load configuration: " + ApplicationProperties . APPLICATION_PROPERTIES ) ; } }
Returns the application configuration .
64
5
42,147
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 //algebra. As an example, suppose the ...
Updates this OrCondition in place so that it matches vertices that satisfy the current OrCondition AND that satisfy the provided OrCondition .
456
27
42,148
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 ) ; String day = matcher . group ( 3 ) ; if ...
Validate date format with regular expression .
302
8
42,149
private List < GroovyExpression > expandOrs ( GroovyExpression expr , OptimizationContext context ) { if ( GremlinQueryOptimizer . isOrExpression ( expr ) ) { return expandOrFunction ( expr , context ) ; } return processOtherExpression ( expr , context ) ; }
Recursively traverses the given expression expanding or expressions wherever they are found .
65
16
42,150
private List < GroovyExpression > expandOrFunction ( GroovyExpression expr , OptimizationContext context ) { FunctionCallExpression functionCall = ( FunctionCallExpression ) expr ; GroovyExpression caller = functionCall . getCaller ( ) ; List < GroovyExpression > updatedCallers = null ; if ( caller != null ) { updatedC...
This method takes an or expression and expands it into multiple expressions .
464
13
42,151
private List < GroovyExpression > processOtherExpression ( GroovyExpression source , OptimizationContext context ) { UpdatedExpressions updatedChildren = getUpdatedChildren ( source , context ) ; if ( ! updatedChildren . hasChanges ( ) ) { return Collections . singletonList ( source ) ; } List < GroovyExpression > resu...
This is called when we encounter an expression that is not an or for example an and expressio . For these expressions we process the children and create copies with the cartesian product of the updated arguments .
190
40
42,152
protected List < GrantedAuthority > getAuthorities ( String username ) { final List < GrantedAuthority > grantedAuths = new ArrayList <> ( ) ; grantedAuths . add ( new SimpleGrantedAuthority ( "DATA_SCIENTIST" ) ) ; return grantedAuths ; }
This method will be modified when actual roles are introduced .
62
11
42,153
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 , versionedMessage . getVersion ( ) , mes...
Check the message version against the expected version .
153
9
42,154
@ 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 = validat...
Return the lineage outputs graph for the given datasetName .
107
11
42,155
@ 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 = validateDatasetNameEx...
Return the lineage inputs graph for the given tableName .
105
11
42,156
@ 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 ( data...
Return the schema for the given tableName .
108
9
42,157
@ 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 = AtlasPerfTracer . getPerfTracer ...
Create a new relationship between entities .
139
7
42,158
@ 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 = AtlasPerfTracer . getPerfTracer (...
Update an existing relationship between entities .
140
7
42,159
@ 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 ) ) { perf = At...
Get relationship information between entities using guid .
161
8
42,160
@ 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 ) ) { perf = AtlasPerf...
Delete a relationship between entities using guid .
160
8
42,161
@ 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 ( LOG . is...
Adds a new trait to the list of entities represented by their respective guids
163
15
42,162
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
133
13
42,163
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 ( Typ...
Finds or creates type vertices with the information specified .
405
12
42,164
@ 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 ( ) ; TypesDef typesDef = getTypeFromS...
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 .
188
36
42,165
private void evictionWarningIfNeeded ( ) { // If not logging eviction warnings, just return. if ( evictionWarningThrottle <= 0 ) { return ; } evictionsSinceWarning ++ ; if ( evictionsSinceWarning >= evictionWarningThrottle ) { DateFormat dateFormat = DateFormat . getDateTimeInstance ( ) ; if ( LOGGER . isInfoEnabled ( ...
Logs a warning if a threshold number of evictions has occurred since the last warning .
138
18
42,166
@ 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 , @ QueryParam ( "depth" ) @ DefaultV...
Returns lineage info about entity .
230
6
42,167
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
824
16
42,168
@ 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 indexes for type name={}, definition={...
This is upon adding a new type to Store .
209
10
42,169
@ 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 ) ; } }
Initialize global indices for Titan graph on server activation .
68
11
42,170
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 .
99
16
42,171
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 ( ) ; if ( ! existingNa...
Check ends are the same and relationshipCategory is the same .
457
12
42,172
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 . getProperty ( AtlasC...
Return the ID corresponding to this Atlas instance .
374
9
42,173
@ 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 ) ; } AtlasPerfTracer perf = nul...
Returns the outputs graph for a given entity id .
475
10
42,174
@ 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 ; try { if ( Atla...
Returns the schema for the given dataset id .
542
9
42,175
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
256
4
42,176
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 IllegalStateE...
Get properties for consumer request
184
5
42,177
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
128
12
42,178
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
64
7
42,179
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 ( API . LIST_TYPES . getPath ( ...
Returns all type names with the given category
128
8
42,180
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
151
12
42,181
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
90
6
42,182
public void deleteTrait ( String guid , String traitName ) throws AtlasServiceException { callAPIWithBodyAndParams ( API . DELETE_TRAITS , null , guid , TRAITS , traitName ) ; }
Delete a trait from the given entity
48
7
42,183
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 ( ) { API api = API . DELETE...
Delete the specified entities from the repository
165
7
42,184
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
188
14
42,185
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 . LIST_ENTITIES ) ; resource = ...
List entities for a given entity type
118
7
42,186
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
76
11
42,187
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
167
7
42,188
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
122
10
42,189
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
44
18
42,190
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 ( ) { WebResource re...
Search given query DSL
185
4
42,191
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 = getResource ( API . SEARCH_FULL_TE...
Search given full text search
140
5
42,192
@ VisibleForTesting public JSONObject callAPIWithResource ( API api , WebResource resource ) throws AtlasServiceException { return callAPIWithResource ( toAPIInfo ( api ) , resource , null , JSONObject . class ) ; }
Wrapper methods for compatibility
49
5
42,193
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
65
8
42,194
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
47
8
42,195
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
47
8
42,196
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
47
8
42,197
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
47
8
42,198
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
47
8
42,199
@ 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 secs -= 86400 * 10 ; if ( secs <...
Converts the given java seconds to postgresql seconds . The conversion is valid for any year 100 BC onwards .
174
23