idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
42,000
public static void registerAccessor ( Class < ? > documentType , DocumentAccessor accessor ) { Assert . notNull ( documentType , "documentType may not be null" ) ; Assert . notNull ( accessor , "accessor may not be null" ) ; if ( accessors . containsKey ( documentType ) ) { DocumentAccessor existing = getAccessor ( doc...
Used to register a custom DocumentAccessor for a particular class . Any existing accessor for the class will be overridden .
177
25
42,001
public static void setId ( Object document , String id ) { DocumentAccessor d = getAccessor ( document ) ; if ( d . hasIdMutator ( ) ) { d . setId ( document , id ) ; } }
Will set the id property on the document IF a mutator exists . Otherwise nothing happens .
49
18
42,002
public static List < String > parseAttachmentNames ( JsonParser documentJsonParser ) throws IOException { documentJsonParser . nextToken ( ) ; JsonToken jsonToken ; while ( ( jsonToken = documentJsonParser . nextToken ( ) ) != JsonToken . END_OBJECT ) { if ( CouchDbDocument . ATTACHMENTS_NAME . equals ( documentJsonPar...
Parses a CouchDB document in the form of a JsonParser to get the attachments order . It is important that the JsonParser come straight from the source document and not from an object or the order will be incorrect .
138
47
42,003
@ JsonAnySetter public void setAnonymous ( String key , Object value ) { anonymous ( ) . put ( key , value ) ; }
Exists in order to future proof this class .
30
10
42,004
protected SettableBeanProperty constructSettableProperty ( DeserializationConfig config , BeanDescription beanDesc , String name , AnnotatedMethod setter , JavaType type ) { // need to ensure method is callable (for non-public) if ( config . isEnabled ( MapperFeature . CAN_OVERRIDE_ACCESS_MODIFIERS ) ) { Method member ...
Method copied from org . codehaus . jackson . map . deser . BeanDeserializerFactory
315
21
42,005
private List < String > parseRows ( JsonParser jp , List < String > result ) throws IOException { while ( jp . nextToken ( ) == JsonToken . START_OBJECT ) { while ( jp . nextToken ( ) == JsonToken . FIELD_NAME ) { String fieldName = jp . getCurrentName ( ) ; jp . nextToken ( ) ; if ( "id" . equals ( fieldName ) ) { res...
The token is required to be on the START_ARRAY value for rows .
130
16
42,006
public static BulkDeleteDocument of ( Object o ) { return new BulkDeleteDocument ( Documents . getId ( o ) , Documents . getRevision ( o ) ) ; }
Will create a bulk delete document based on the specified object .
36
12
42,007
public Options param ( String name , String value ) { options . put ( name , value ) ; return this ; }
Adds a parameter to the GET request sent to the database .
24
12
42,008
protected ViewQuery createQuery ( String viewName ) { return new ViewQuery ( ) . dbPath ( db . path ( ) ) . designDocId ( stdDesignDocumentId ) . viewName ( viewName ) ; }
Creates a ViewQuery pre - configured with correct dbPath design document id and view name .
46
19
42,009
protected List < T > queryView ( String viewName , ComplexKey key ) { return db . queryView ( createQuery ( viewName ) . includeDocs ( true ) . key ( key ) , type ) ; }
Allows subclasses to query views with simple String value keys and load the result as the repository s handled type .
46
22
42,010
private void backOff ( ) { try { Thread . sleep ( new Random ( ) . nextInt ( 400 ) ) ; } catch ( InterruptedException ie ) { Thread . currentThread ( ) . interrupt ( ) ; } }
Wait a short while in order to prevent racing initializations from other repositories .
47
15
42,011
public void load ( Reader in ) { try { doLoad ( in ) ; } catch ( Exception e ) { throw Exceptions . propagate ( e ) ; } }
Reads documents from the reader and stores them in the database .
34
13
42,012
public void write ( Collection < ? > objects , boolean allOrNothing , OutputStream out ) { try { JsonGenerator jg = objectMapper . getFactory ( ) . createGenerator ( out , JsonEncoding . UTF8 ) ; jg . writeStartObject ( ) ; if ( allOrNothing ) { jg . writeBooleanField ( "all_or_nothing" , true ) ; } jg . writeArrayFiel...
Writes the objects collection as a bulk operation document . The output stream is flushed and closed by this method .
186
22
42,013
protected void applyDefaultConfiguration ( ObjectMapper om ) { om . configure ( SerializationFeature . WRITE_DATES_AS_TIMESTAMPS , this . writeDatesAsTimestamps ) ; om . setSerializationInclusion ( JsonInclude . Include . NON_NULL ) ; }
This protected method can be overridden in order to change the configuration .
65
14
42,014
public Socket connectSocket ( final Socket sock , final String host , final int port , final InetAddress localAddress , int localPort , final HttpParams params ) throws IOException { if ( host == null ) { throw new IllegalArgumentException ( "Target host may not be null." ) ; } if ( params == null ) { throw new Illegal...
non - javadoc see interface org . apache . http . conn . SocketFactory
391
19
42,015
public Socket createSocket ( final Socket socket , final String host , final int port , final boolean autoClose ) throws IOException , UnknownHostException { SSLSocket sslSocket = ( SSLSocket ) this . socketfactory . createSocket ( socket , host , port , autoClose ) ; hostnameVerifier . verify ( host , sslSocket ) ; //...
non - javadoc see interface LayeredSocketFactory
93
12
42,016
public static Method findMethod ( Class < ? > clazz , String name ) { for ( Method me : clazz . getDeclaredMethods ( ) ) { if ( me . getName ( ) . equalsIgnoreCase ( name ) ) { return me ; } } if ( clazz . getSuperclass ( ) != null ) { return findMethod ( clazz . getSuperclass ( ) , name ) ; } return null ; }
Ignores case when comparing method names
91
7
42,017
public static DbAccessException createDbAccessException ( HttpResponse hr ) { JsonNode responseBody ; try { InputStream content = hr . getContent ( ) ; if ( content != null ) { responseBody = responseBodyAsNode ( IOUtils . toString ( content ) ) ; } else { responseBody = NullNode . getInstance ( ) ; } } catch ( Excepti...
Creates an DbAccessException which specific type is determined by the response code in the http response .
229
21
42,018
@ Override public void afterPropertiesSet ( ) throws Exception { if ( couchDBProperties != null ) { new DirectFieldAccessor ( this ) . setPropertyValues ( couchDBProperties ) ; } LOG . info ( "Starting couchDb connector on {}:{}..." , new Object [ ] { host , port } ) ; LOG . debug ( "host: {}" , host ) ; LOG . debug ( ...
Create the couchDB connection when starting the bean factory
445
10
42,019
public Map < String , DesignDocument . View > generateViews ( final Object repository ) { final Map < String , DesignDocument . View > views = new HashMap < String , DesignDocument . View > ( ) ; final Class < ? > repositoryClass = repository . getClass ( ) ; final Class < ? > handledType = repository instanceof CouchD...
Generates views based on annotations found in a repository class . If the repository class extends org . ektorp . support . CouchDbRepositorySupport its handled type will also examined for annotations eligible for view generation .
204
44
42,020
public boolean mergeWith ( DesignDocument dd , boolean updateOnDiff ) { boolean changed = mergeViews ( dd . views ( ) , updateOnDiff ) ; changed = mergeFunctions ( lists ( ) , dd . lists ( ) , updateOnDiff ) || changed ; changed = mergeFunctions ( shows ( ) , dd . shows ( ) , updateOnDiff ) || changed ; changed = merge...
Merge this design document with the specified document the result being stored in this design document .
129
18
42,021
public boolean isSubType ( String typeName ) throws AtlasException { HierarchicalType cType = typeSystem . getDataType ( HierarchicalType . class , typeName ) ; return ( cType == this || cType . superTypePaths . containsKey ( getName ( ) ) ) ; }
Given type must be a SubType of this type .
65
11
42,022
public List < EntityAuditEvent > listEvents ( String entityId , String startKey , short n ) throws AtlasException { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Listing events for entity id {}, starting timestamp {}, #records {}" , entityId , startKey , n ) ; } Table table = null ; ResultScanner scanner = null ; tr...
List events for the given entity id in decreasing order of timestamp from the given startKey . Returns n results
651
21
42,023
public static org . apache . hadoop . conf . Configuration getHBaseConfiguration ( Configuration atlasConf ) throws AtlasException { Configuration subsetAtlasConf = ApplicationProperties . getSubsetConfiguration ( atlasConf , CONFIG_PREFIX ) ; org . apache . hadoop . conf . Configuration hbaseConf = HBaseConfiguration ...
Converts atlas application properties to hadoop conf
139
10
42,024
public static Titan0Edge createEdge ( Titan0Graph graph , Edge source ) { if ( source == null ) { return null ; } return new Titan0Edge ( graph , source ) ; }
Creates a Titan0Edge that corresponds to the given Gremlin Edge .
40
15
42,025
public static Titan0Vertex createVertex ( Titan0Graph graph , Vertex source ) { if ( source == null ) { return null ; } return new Titan0Vertex ( graph , source ) ; }
Creates a Titan0Vertex that corresponds to the given Gremlin Vertex .
44
17
42,026
protected String errorMessage ( String input , Exception e ) { return String . format ( "Invalid parameter: %s (%s)" , input , e . getMessage ( ) ) ; }
Given a string representation which was unable to be parsed and the exception thrown produce an entity to be sent to the client .
38
24
42,027
private void notifyOfEntityEvent ( Collection < ITypedReferenceableInstance > entityDefinitions , EntityNotification . OperationType operationType ) throws AtlasException { List < EntityNotification > messages = new LinkedList <> ( ) ; for ( IReferenceableInstance entityDefinition : entityDefinitions ) { Referenceable ...
send notification of entity change
248
5
42,028
private GroovyExpression optimize ( GroovyExpression source , GremlinOptimization optimization , OptimizationContext context ) { GroovyExpression result = source ; if ( optimization . appliesTo ( source , context ) ) { //Apply the optimization to the expression. result = optimization . apply ( source , context ) ; } if...
Optimizes the expression using the given optimization
210
9
42,029
public static GroovyExpression copyWithNewLeafNode ( AbstractFunctionExpression expr , GroovyExpression newLeaf ) { AbstractFunctionExpression result = ( AbstractFunctionExpression ) expr . copy ( ) ; //remove leading anonymous traversal expression, if there is one if ( FACTORY . isLeafAnonymousTraversalExpression ( ex...
Recursively copies and follows the caller hierarchy of the expression until we come to a function call with a null caller . The caller of that expression is set to newLeaf .
174
36
42,030
@ Override public void doFilter ( ServletRequest servletRequest , ServletResponse servletResponse , FilterChain filterChain ) throws IOException , ServletException { if ( isFilteredURI ( servletRequest ) ) { LOG . debug ( "Is a filtered URI: {}. Passing request downstream." , ( ( HttpServletRequest ) servletRequest ) ....
Determines if this Atlas server instance is passive and redirects to active if so .
371
18
42,031
@ Override public < T > Collection < T > getPropertyValues ( String propertyName , Class < T > type ) { return Collections . singleton ( getProperty ( propertyName , type ) ) ; }
Gets all of the values of the given property .
43
11
42,032
private boolean isAuthenticated ( ) { Authentication existingAuth = SecurityContextHolder . getContext ( ) . getAuthentication ( ) ; return ! ( ! ( existingAuth != null && existingAuth . isAuthenticated ( ) ) || existingAuth instanceof SSOAuthentication ) ; }
Do not try to validate JWT if user already authenticated via other provider
59
14
42,033
protected String getJWTFromCookie ( HttpServletRequest req ) { String serializedJWT = null ; Cookie [ ] cookies = req . getCookies ( ) ; if ( cookieName != null && cookies != null ) { for ( Cookie cookie : cookies ) { if ( cookieName . equals ( cookie . getName ( ) ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( ...
Encapsulate the acquisition of the JWT token from HTTP cookies within the request .
130
17
42,034
protected String constructLoginURL ( HttpServletRequest request , boolean isXMLRequest ) { String delimiter = "?" ; if ( authenticationProviderUrl . contains ( "?" ) ) { delimiter = "&" ; } StringBuilder loginURL = new StringBuilder ( ) ; if ( isXMLRequest ) { String atlasApplicationURL = "" ; String referalURL = reque...
Create the URL to be used for authentication of the user in the absence of a JWT token within the incoming request .
261
24
42,035
protected boolean validateToken ( SignedJWT jwtToken ) { boolean isValid = validateSignature ( jwtToken ) ; if ( isValid ) { isValid = validateExpiration ( jwtToken ) ; if ( ! isValid ) { LOG . warn ( "Expiration time validation of JWT token failed." ) ; } } else { LOG . warn ( "Signature of JWT token could not be veri...
This method provides a single method for validating the JWT for use in request processing . It provides for the override of specific aspects of this implementation through submethods used within but also allows for the override of the entire token validation algorithm .
102
48
42,036
protected boolean validateSignature ( SignedJWT jwtToken ) { boolean valid = false ; if ( JWSObject . State . SIGNED == jwtToken . getState ( ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "SSO token is in a SIGNED state" ) ; } if ( jwtToken . getSignature ( ) != null ) { if ( LOG . isDebugEnabled ( ) ) { LOG . ...
Verify the signature of the JWT token in this method . This method depends on the public key that was established during init based upon the provisioned public key . Override this method in subclasses in order to customize the signature verification behavior .
238
49
42,037
protected boolean validateExpiration ( SignedJWT jwtToken ) { boolean valid = false ; try { Date expires = jwtToken . getJWTClaimsSet ( ) . getExpirationTime ( ) ; if ( expires == null || new Date ( ) . before ( expires ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "SSO token expiration date has been successful...
Validate that the expiration time of the JWT token has not been violated . If it has then throw an AuthenticationException . Override this method in subclasses in order to customize the expiration validation behavior .
142
41
42,038
boolean hasIncomingEdgesWithLabel ( AtlasVertex vertex , String label ) throws AtlasBaseException { boolean foundEdges = false ; Iterator < AtlasEdge > inEdges = vertex . getEdges ( AtlasEdgeDirection . IN ) . iterator ( ) ; while ( inEdges . hasNext ( ) ) { AtlasEdge edge = inEdges . next ( ) ; if ( label . equals ( e...
Look to see if there are any IN edges with the supplied label
113
13
42,039
private boolean validateAtlasRelationshipType ( AtlasRelationshipType type ) { boolean isValid = false ; try { validateAtlasRelationshipDef ( type . getRelationshipDef ( ) ) ; isValid = true ; } catch ( AtlasBaseException abe ) { LOG . error ( "Validation error for AtlasRelationshipType" , abe ) ; } return isValid ; }
Validate the fields in the the RelationshipType are consistent with respect to themselves .
81
16
42,040
public static void validateAtlasRelationshipDef ( AtlasRelationshipDef relationshipDef ) throws AtlasBaseException { AtlasRelationshipEndDef endDef1 = relationshipDef . getEndDef1 ( ) ; AtlasRelationshipEndDef endDef2 = relationshipDef . getEndDef2 ( ) ; RelationshipCategory relationshipCategory = relationshipDef . get...
Throw an exception so we can junit easily .
603
10
42,041
public static int getCompiledQueryCacheCapacity ( ) { try { return ApplicationProperties . get ( ) . getInt ( COMPILED_QUERY_CACHE_CAPACITY , DEFAULT_COMPILED_QUERY_CACHE_CAPACITY ) ; } catch ( AtlasException e ) { throw new RuntimeException ( e ) ; } }
Get the configuration property that specifies the size of the compiled query cache . This is an optional property . A default is used if it is not present .
80
30
42,042
public static int getCompiledQueryCacheEvictionWarningThrottle ( ) { try { return ApplicationProperties . get ( ) . getInt ( COMPILED_QUERY_CACHE_EVICTION_WARNING_THROTTLE , DEFAULT_COMPILED_QUERY_CACHE_EVICTION_WARNING_THROTTLE ) ; } catch ( AtlasException e ) { throw new RuntimeException ( e ) ; } }
Get the configuration property that specifies the number evictions that pass before a warning is logged . This is an optional property . A default is used if it is not present .
98
34
42,043
public static FieldMapping getFieldMapping ( IDataType type ) { switch ( type . getTypeCategory ( ) ) { case CLASS : case TRAIT : return ( ( HierarchicalType ) type ) . fieldMapping ( ) ; case STRUCT : return ( ( StructType ) type ) . fieldMapping ( ) ; default : throw new IllegalArgumentException ( "Type " + type + " ...
Get the field mappings for the specified data type . Field mappings are only relevant for CLASS TRAIT and STRUCT types .
96
26
42,044
@ Override public String getTypeDefinition ( String typeName ) throws AtlasException { final IDataType dataType = typeSystem . getDataType ( IDataType . class , typeName ) ; return TypesSerialization . toJson ( typeSystem , dataType . getName ( ) ) ; }
Return the definition for the given type .
63
8
42,045
@ Override public CreateUpdateEntitiesResult createEntities ( String entityInstanceDefinition ) throws AtlasException { entityInstanceDefinition = ParamChecker . notEmpty ( entityInstanceDefinition , "Entity instance definition" ) ; ITypedReferenceableInstance [ ] typedInstances = deserializeClassInstances ( entityInst...
Creates an entity instance of the type .
79
9
42,046
private void validateUniqueAttribute ( String entityType , String attributeName ) throws AtlasException { ClassType type = typeSystem . getDataType ( ClassType . class , entityType ) ; AttributeInfo attribute = type . fieldMapping ( ) . fields . get ( attributeName ) ; if ( attribute == null ) { throw new IllegalArgume...
Validate that attribute is unique attribute
139
7
42,047
@ Override public List < String > getEntityList ( String entityType ) throws AtlasException { validateTypeExists ( entityType ) ; return repository . getEntityList ( entityType ) ; }
Return the list of entity guids for the given type in the repository .
41
15
42,048
@ Override public void addTrait ( List < String > entityGuids , ITypedStruct traitInstance ) throws AtlasException { Preconditions . checkNotNull ( entityGuids , "entityGuids list cannot be null" ) ; Preconditions . checkNotNull ( traitInstance , "Trait instance cannot be null" ) ; final String traitName = traitInstanc...
Adds a new trait to the list of existing entities represented by their respective guids
285
16
42,049
public Iterator < AtlasEdge > getAdjacentEdgesByLabel ( AtlasVertex instanceVertex , AtlasEdgeDirection direction , final String edgeLabel ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Finding edges for {} with label {}" , string ( instanceVertex ) , edgeLabel ) ; } if ( instanceVertex != null && edgeLabel != nu...
So traversing all the edges
260
6
42,050
public AtlasEdge getEdgeForLabel ( AtlasVertex vertex , String edgeLabel ) { return getEdgeForLabel ( vertex , edgeLabel , AtlasEdgeDirection . OUT ) ; }
Returns the active edge for the given edge label . If the vertex is deleted and there is no active edge it returns the latest deleted edge
38
27
42,051
public void removeEdge ( AtlasEdge edge ) { String edgeString = null ; if ( LOG . isDebugEnabled ( ) ) { edgeString = string ( edge ) ; LOG . debug ( "Removing {}" , edgeString ) ; } graph . removeEdge ( edge ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . info ( "Removed {}" , edgeString ) ; } }
Remove the specified edge from the graph .
84
8
42,052
public void removeVertex ( AtlasVertex vertex ) { String vertexString = null ; if ( LOG . isDebugEnabled ( ) ) { vertexString = string ( vertex ) ; LOG . debug ( "Removing {}" , vertexString ) ; } graph . removeVertex ( vertex ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . info ( "Removed {}" , vertexString ) ; } }
Remove the specified AtlasVertex from the graph .
87
10
42,053
public Map < String , AtlasVertex > getVerticesForPropertyValues ( String property , List < String > values ) { if ( values . isEmpty ( ) ) { return Collections . emptyMap ( ) ; } Collection < String > nonNullValues = new HashSet <> ( values . size ( ) ) ; for ( String value : values ) { if ( value != null ) { nonNullV...
Finds the Vertices that correspond to the given property values . Property values that are not found in the graph will not be in the map .
279
29
42,054
public Map < String , AtlasVertex > getVerticesForGUIDs ( List < String > guids ) { return getVerticesForPropertyValues ( Constants . GUID_PROPERTY_KEY , guids ) ; }
Finds the Vertices that correspond to the given GUIDs . GUIDs that are not found in the graph will not be in the map .
50
29
42,055
public AtlasVertex getVertexForInstanceByUniqueAttribute ( ClassType classType , IReferenceableInstance instance ) throws AtlasException { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Checking if there is an instance with the same unique attributes for instance {}" , instance . toShortString ( ) ) ; } AtlasVertex r...
For the given type finds an unique attribute and checks if there is an existing instance with the same unique value
268
21
42,056
public List < AtlasVertex > getVerticesForInstancesByUniqueAttribute ( ClassType classType , List < ? extends IReferenceableInstance > instancesForClass ) throws AtlasException { //For each attribute, need to figure out what values to search for and which instance(s) //those values correspond to. Map < String , Attribu...
Finds vertices that match at least one unique attribute of the instances specified . The AtlasVertex at a given index in the result corresponds to the IReferencableInstance at that same index that was passed in . The number of elements in the resultant list is guaranteed to match the number of instances that were passe...
717
85
42,057
public static Titan1Edge createEdge ( Titan1Graph graph , Edge source ) { if ( source == null ) { return null ; } return new Titan1Edge ( graph , source ) ; }
Creates a Titan1Edge that corresponds to the given Gremlin Edge .
40
15
42,058
public static Titan1Vertex createVertex ( Titan1Graph graph , Vertex source ) { if ( source == null ) { return null ; } return new Titan1Vertex ( graph , source ) ; }
Creates a Titan1Vertex that corresponds to the given Gremlin Vertex .
44
17
42,059
public String getAdminStatus ( ) throws AtlasServiceException { String result = AtlasBaseClient . UNKNOWN_STATUS ; WebResource resource = getResource ( service , STATUS . getPath ( ) ) ; JSONObject response = callAPIWithResource ( STATUS , resource , null , JSONObject . class ) ; try { result = response . getString ( "...
Return status of the service instance the client is pointing to .
120
12
42,060
private WebResource getResource ( WebResource service , APIInfo api , String ... pathParams ) { WebResource resource = service . path ( api . getPath ( ) ) ; resource = appendPathParams ( resource , pathParams ) ; return resource ; }
Modify URL to include the path params
55
8
42,061
private ObjectNode objectNodeFromElement ( final AtlasElement element ) { final boolean isEdge = element instanceof AtlasEdge ; final boolean showTypes = mode == AtlasGraphSONMode . EXTENDED ; final List < String > propertyKeys = isEdge ? this . edgePropertyKeys : this . vertexPropertyKeys ; final ElementPropertiesRule...
Creates GraphSON for a single graph element .
535
10
42,062
public static JSONObject jsonFromElement ( final AtlasElement element , final Set < String > propertyKeys , final AtlasGraphSONMode mode ) throws JSONException { final AtlasGraphSONUtility graphson = element instanceof AtlasEdge ? new AtlasGraphSONUtility ( mode , null , propertyKeys ) : new AtlasGraphSONUtility ( mode...
Creates a Jettison JSONObject from a graph element .
89
13
42,063
private static char [ ] getPassword ( TextDevice textDevice , String key ) { boolean noMatch ; char [ ] cred = new char [ 0 ] ; char [ ] passwd1 ; char [ ] passwd2 ; do { passwd1 = textDevice . readPassword ( "Please enter the password value for %s:" , key ) ; passwd2 = textDevice . readPassword ( "Please enter the pas...
Retrieves a password from the command line .
251
10
42,064
private static CredentialProvider getCredentialProvider ( TextDevice textDevice ) throws IOException { String providerPath = textDevice . readLine ( "Please enter the full path to the credential provider:" ) ; if ( providerPath != null ) { Configuration conf = new Configuration ( false ) ; conf . set ( CredentialProvid...
\ Returns a credential provider for the entered JKS path .
109
12
42,065
@ Override public void start ( ) throws AtlasException { if ( ! HAConfiguration . isHAEnabled ( configuration ) ) { LOG . info ( "HA is not enabled, no need to start leader election service" ) ; return ; } cacheActiveStateChangeHandlers ( ) ; serverId = AtlasServerIdSelector . selectServerId ( configuration ) ; joinEle...
Join leader election on starting up .
84
7
42,066
@ Override public void stop ( ) { if ( ! HAConfiguration . isHAEnabled ( configuration ) ) { LOG . info ( "HA is not enabled, no need to stop leader election service" ) ; return ; } try { leaderLatch . close ( ) ; curatorFactory . close ( ) ; } catch ( IOException e ) { LOG . error ( "Error closing leader latch" , e ) ...
Leave leader election process and clean up resources on shutting down .
90
12
42,067
public void addInstance ( IReferenceableInstance instance ) throws AtlasException { ClassType classType = typeSystem . getDataType ( ClassType . class , instance . getTypeName ( ) ) ; ITypedReferenceableInstance newInstance = classType . convert ( instance , Multiplicity . REQUIRED ) ; findReferencedInstancesToPreLoad ...
Adds an instance to be loaded .
144
7
42,068
public static boolean isHAEnabled ( Configuration configuration ) { boolean ret = false ; if ( configuration . containsKey ( HAConfiguration . ATLAS_SERVER_HA_ENABLED_KEY ) ) { ret = configuration . getBoolean ( ATLAS_SERVER_HA_ENABLED_KEY ) ; } else { String [ ] ids = configuration . getStringArray ( HAConfiguration ....
Return whether HA is enabled or not .
117
8
42,069
public static String getBoundAddressForId ( Configuration configuration , String serverId ) { String hostPort = configuration . getString ( ATLAS_SERVER_ADDRESS_PREFIX + serverId ) ; boolean isSecure = configuration . getBoolean ( SecurityProperties . TLS_ENABLED ) ; String protocol = ( isSecure ) ? "https://" : "http:...
Get the web server address that a server instance with the passed ID is bound to .
90
17
42,070
protected org . apache . commons . configuration . Configuration getApplicationConfiguration ( ) { try { return ApplicationProperties . get ( ) ; } catch ( AtlasException e ) { LOG . warn ( "Error reading application configuration" , e ) ; } return null ; }
Returns the metadata application configuration .
55
6
42,071
public static String getUserFromRequest ( HttpServletRequest httpRequest ) { String user = httpRequest . getRemoteUser ( ) ; if ( ! StringUtils . isEmpty ( user ) ) { return user ; } user = httpRequest . getParameter ( "user.name" ) ; // available in query-param if ( ! StringUtils . isEmpty ( user ) ) { return user ; }...
Returns the user of the given request .
157
8
42,072
public static String getRequestURI ( HttpServletRequest httpRequest ) { final StringBuilder url = new StringBuilder ( 100 ) . append ( httpRequest . getRequestURI ( ) ) ; if ( httpRequest . getQueryString ( ) != null ) { url . append ( ' ' ) . append ( httpRequest . getQueryString ( ) ) ; } return url . toString ( ) ; ...
Returns the URI of the given request .
84
8
42,073
public void update ( String serverId ) throws AtlasBaseException { try { CuratorFramework client = curatorFactory . clientInstance ( ) ; HAConfiguration . ZookeeperProperties zookeeperProperties = HAConfiguration . getZookeeperProperties ( configuration ) ; String atlasServerAddress = HAConfiguration . getBoundAddressF...
Update state of the active server instance .
324
8
42,074
public String getActiveServerAddress ( ) { CuratorFramework client = curatorFactory . clientInstance ( ) ; String serverAddress = null ; try { HAConfiguration . ZookeeperProperties zookeeperProperties = HAConfiguration . getZookeeperProperties ( configuration ) ; byte [ ] bytes = client . getData ( ) . forPath ( getZno...
Retrieve state of the active server instance .
144
9
42,075
@ DELETE @ Path ( "/guid/{guid}" ) @ Consumes ( { Servlets . JSON_MEDIA_TYPE , MediaType . APPLICATION_JSON } ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public EntityMutationResponse deleteByGuid ( @ PathParam ( "guid" ) final String guid ) throws AtlasBaseException { AtlasPerfTracer perf = null ; try { if ( AtlasPerf...
Delete an entity identified by its GUID .
178
9
42,076
@ GET @ Path ( "/guid/{guid}/classification/{classificationName}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasClassification getClassification ( @ PathParam ( "guid" ) String guid , @ PathParam ( "classificationName" ) final String classificationName ) throws AtlasBaseException { AtlasPerfTracer perf = null...
Gets the list of classifications for a given entity represented by a guid .
229
16
42,077
@ POST @ Path ( "/guid/{guid}/classifications" ) @ Consumes ( { Servlets . JSON_MEDIA_TYPE , MediaType . APPLICATION_JSON } ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public void addClassifications ( @ PathParam ( "guid" ) final String guid , List < AtlasClassification > classifications ) throws AtlasBaseException { A...
Adds classifications to an existing entity represented by a guid .
225
12
42,078
@ PUT @ Path ( "/guid/{guid}/classifications" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public void updateClassification ( @ PathParam ( "guid" ) final String guid , List < AtlasClassification > classifications ) throws AtlasBaseException { AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . isPerfTraceEnabled...
Updates classifications to an existing entity represented by a guid .
202
13
42,079
@ DELETE @ Path ( "/guid/{guid}/classification/{classificationName}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public void deleteClassification ( @ PathParam ( "guid" ) String guid , @ PathParam ( "classificationName" ) final String classificationName ) throws AtlasBaseException { AtlasPerfTracer perf = null ; try { ...
Deletes a given classification from an existing entity represented by a guid .
244
14
42,080
@ GET @ Path ( "/bulk" ) @ Consumes ( Servlets . JSON_MEDIA_TYPE ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasEntitiesWithExtInfo getByGuids ( @ QueryParam ( "guid" ) List < String > guids ) throws AtlasBaseException { AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . isPerfTraceEnabled ( PERF_LOG )...
Bulk API to retrieve list of entities identified by its GUIDs .
210
14
42,081
@ DELETE @ Path ( "/bulk" ) @ Consumes ( Servlets . JSON_MEDIA_TYPE ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public EntityMutationResponse deleteByGuids ( @ QueryParam ( "guid" ) final List < String > guids ) throws AtlasBaseException { AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . isPerfTraceEnabled ( ...
Bulk API to delete list of entities identified by its GUIDs
171
13
42,082
@ POST @ Path ( "/bulk/classification" ) @ Consumes ( { Servlets . JSON_MEDIA_TYPE , MediaType . APPLICATION_JSON } ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public void addClassification ( ClassificationAssociateRequest request ) throws AtlasBaseException { AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . ...
Bulk API to associate a tag to multiple entities
300
10
42,083
private void validateUniqueAttribute ( AtlasEntityType entityType , Map < String , Object > attributes ) throws AtlasBaseException { if ( MapUtils . isEmpty ( attributes ) ) { throw new AtlasBaseException ( AtlasErrorCode . ATTRIBUTE_UNIQUE_INVALID , entityType . getTypeName ( ) , "" ) ; } for ( String attributeName : ...
Validate that each attribute given is an unique attribute
159
10
42,084
public static < T > T notNull ( T obj , String name ) { if ( obj == null ) { throw new IllegalArgumentException ( name + " cannot be null" ) ; } return obj ; }
Check that a value is not null . If null throws an IllegalArgumentException .
44
17
42,085
public static < T > Collection < T > notEmpty ( Collection < T > list , String name ) { notNull ( list , name ) ; if ( list . isEmpty ( ) ) { throw new IllegalArgumentException ( String . format ( "Collection %s is empty" , name ) ) ; } return list ; }
Check that a list is not null and not empty .
68
11
42,086
public static void lessThan ( long value , long maxValue , String name ) { if ( value <= 0 ) { throw new IllegalArgumentException ( name + " should be > 0, current value " + value ) ; } if ( value > maxValue ) { throw new IllegalArgumentException ( name + " should be <= " + maxValue + ", current value " + value ) ; } }
Checks that the given value is < = max value .
84
12
42,087
@ GET @ Path ( "/typedef/name/{name}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasBaseTypeDef getTypeDefByName ( @ PathParam ( "name" ) String name ) throws AtlasBaseException { AtlasBaseTypeDef ret = typeDefStore . getByName ( name ) ; return ret ; }
Get type definition by it s name
78
7
42,088
@ GET @ Path ( "/enumdef/guid/{guid}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasEnumDef getEnumDefByGuid ( @ PathParam ( "guid" ) String guid ) throws AtlasBaseException { AtlasEnumDef ret = typeDefStore . getEnumDefByGuid ( guid ) ; return ret ; }
Get the enum definition for the given guid
86
8
42,089
@ GET @ Path ( "/structdef/guid/{guid}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasStructDef getStructDefByGuid ( @ PathParam ( "guid" ) String guid ) throws AtlasBaseException { AtlasStructDef ret = typeDefStore . getStructDefByGuid ( guid ) ; return ret ; }
Get the struct definition for the given guid
82
8
42,090
@ GET @ Path ( "/classificationdef/guid/{guid}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasClassificationDef getClassificationDefByGuid ( @ PathParam ( "guid" ) String guid ) throws AtlasBaseException { AtlasClassificationDef ret = typeDefStore . getClassificationDefByGuid ( guid ) ; return ret ; }
Get the classification definition for the given guid
87
8
42,091
@ GET @ Path ( "/entitydef/guid/{guid}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasEntityDef getEntityDefByGuid ( @ PathParam ( "guid" ) String guid ) throws AtlasBaseException { AtlasEntityDef ret = typeDefStore . getEntityDefByGuid ( guid ) ; return ret ; }
Get the Entity definition for the given guid
82
8
42,092
@ GET @ Path ( "/relationshipdef/guid/{guid}" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasRelationshipDef getRelationshipDefByGuid ( @ PathParam ( "guid" ) String guid ) throws AtlasBaseException { AtlasRelationshipDef ret = typeDefStore . getRelationshipDefByGuid ( guid ) ; return ret ; }
Get the relationship definition for the given guid
87
8
42,093
private SearchFilter getSearchFilter ( HttpServletRequest httpServletRequest ) { SearchFilter ret = new SearchFilter ( ) ; Set < String > keySet = httpServletRequest . getParameterMap ( ) . keySet ( ) ; for ( String key : keySet ) { ret . setParam ( String . valueOf ( key ) , String . valueOf ( httpServletRequest . get...
Populate a SearchFilter on the basis of the Query Parameters
96
12
42,094
public boolean equalsContents ( Object o ) { if ( this == o ) { return true ; } if ( o == null ) { return false ; } if ( o . getClass ( ) != getClass ( ) ) { return false ; } if ( ! super . equalsContents ( o ) ) { return false ; } Referenceable obj = ( Referenceable ) o ; if ( ! traitNames . equals ( obj . getTraits (...
Matches traits values associated with this Referenceable and skips the id match
102
15
42,095
private void validateEntityAssociations ( String guid , List < AtlasClassification > classifications ) throws AtlasBaseException { List < String > entityClassifications = getClassificationNames ( guid ) ; for ( AtlasClassification classification : classifications ) { String newClassification = classification . getTypeN...
Validate if classification is not already associated with the entities
134
11
42,096
public static AtlasElementPropertyConfig includeProperties ( final Set < String > vertexPropertyKeys , final Set < String > edgePropertyKeys ) { return new AtlasElementPropertyConfig ( vertexPropertyKeys , edgePropertyKeys , ElementPropertiesRule . INCLUDE , ElementPropertiesRule . INCLUDE ) ; }
Construct a configuration that includes the specified properties from both vertices and edges .
66
15
42,097
public static AtlasElementPropertyConfig excludeProperties ( final Set < String > vertexPropertyKeys , final Set < String > edgePropertyKeys ) { return new AtlasElementPropertyConfig ( vertexPropertyKeys , edgePropertyKeys , ElementPropertiesRule . EXCLUDE , ElementPropertiesRule . EXCLUDE ) ; }
Construct a configuration that excludes the specified properties from both vertices and edges .
66
15
42,098
@ GET @ Path ( "/dsl" ) @ Consumes ( Servlets . JSON_MEDIA_TYPE ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasSearchResult searchUsingDSL ( @ QueryParam ( "query" ) String query , @ QueryParam ( "typeName" ) String typeName , @ QueryParam ( "classification" ) String classification , @ QueryParam ( "limit" ) i...
Retrieve data for the specified DSL
352
7
42,099
@ GET @ Path ( "/attribute" ) @ Consumes ( Servlets . JSON_MEDIA_TYPE ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public AtlasSearchResult searchUsingAttribute ( @ QueryParam ( "attrName" ) String attrName , @ QueryParam ( "attrValuePrefix" ) String attrValuePrefix , @ QueryParam ( "typeName" ) String typeName , @ Quer...
Retrieve data for the specified attribute search query
350
9