Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
6be16550
Commit
6be16550
authored
May 20, 2015
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Plain Diff
Merged with master
parents
a91e147b
c6a0787e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
18 deletions
+24
-18
MetadataServiceClient.java
...ava/org/apache/hadoop/metadata/MetadataServiceClient.java
+9
-6
EntityResource.java
.../apache/hadoop/metadata/web/resources/EntityResource.java
+3
-7
MetadataDiscoveryResource.java
...oop/metadata/web/resources/MetadataDiscoveryResource.java
+0
-0
RexsterGraphResource.java
...e/hadoop/metadata/web/resources/RexsterGraphResource.java
+3
-3
TypesResource.java
...g/apache/hadoop/metadata/web/resources/TypesResource.java
+1
-1
MetadataDiscoveryJerseyResourceIT.java
...data/web/resources/MetadataDiscoveryJerseyResourceIT.java
+8
-1
No files found.
client/src/main/java/org/apache/hadoop/metadata/MetadataServiceClient.java
View file @
6be16550
...
@@ -57,12 +57,15 @@ public class MetadataServiceClient {
...
@@ -57,12 +57,15 @@ public class MetadataServiceClient {
public
static
final
String
ERROR
=
"error"
;
public
static
final
String
ERROR
=
"error"
;
public
static
final
String
REQUEST_ID
=
"requestId"
;
public
static
final
String
REQUEST_ID
=
"requestId"
;
public
static
final
String
RESULTS
=
"results"
;
public
static
final
String
RESULTS
=
"results"
;
public
static
final
String
TOTAL_SIZE
=
"totalSize"
;
public
static
final
String
COUNT
=
"count"
;
public
static
final
String
BASE_URI
=
"api/metadata/"
;
public
static
final
String
ROWS
=
"rows"
;
public
static
final
String
URI_TYPES
=
"types"
;
public
static
final
String
URI_ENTITIES
=
"entities"
;
private
static
final
String
BASE_URI
=
"api/metadata/"
;
public
static
final
String
URI_TRAITS
=
"traits"
;
private
static
final
String
URI_TYPES
=
"types"
;
public
static
final
String
URI_SEARCH
=
"discovery/search"
;
private
static
final
String
URI_ENTITIES
=
"entities"
;
private
static
final
String
URI_TRAITS
=
"traits"
;
private
static
final
String
URI_SEARCH
=
"discovery/search"
;
private
WebResource
service
;
private
WebResource
service
;
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/EntityResource.java
View file @
6be16550
...
@@ -145,14 +145,10 @@ public class EntityResource {
...
@@ -145,14 +145,10 @@ public class EntityResource {
* Gets the list of entities for a given entity type.
* Gets the list of entities for a given entity type.
*
*
* @param entityType name of a type which is unique
* @param entityType name of a type which is unique
* @param offset starting offset for pagination
* @param resultsPerPage number of results for pagination
*/
*/
@GET
@GET
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Response
getEntityListByType
(
@QueryParam
(
"type"
)
String
entityType
,
public
Response
getEntityListByType
(
@QueryParam
(
"type"
)
String
entityType
)
{
@DefaultValue
(
"0"
)
@QueryParam
(
"offset"
)
Integer
offset
,
@QueryParam
(
"numResults"
)
Integer
resultsPerPage
)
{
Preconditions
.
checkNotNull
(
entityType
,
"Entity type cannot be null"
);
Preconditions
.
checkNotNull
(
entityType
,
"Entity type cannot be null"
);
try
{
try
{
LOG
.
debug
(
"Fetching entity list for type={} "
,
entityType
);
LOG
.
debug
(
"Fetching entity list for type={} "
,
entityType
);
...
@@ -162,7 +158,7 @@ public class EntityResource {
...
@@ -162,7 +158,7 @@ public class EntityResource {
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
"type"
,
entityType
);
response
.
put
(
"type"
,
entityType
);
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
entityList
));
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
entityList
));
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
entityList
.
size
());
response
.
put
(
MetadataServiceClient
.
COUNT
,
entityList
.
size
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
MetadataException
|
IllegalArgumentException
e
)
{
}
catch
(
MetadataException
|
IllegalArgumentException
e
)
{
...
@@ -227,7 +223,7 @@ public class EntityResource {
...
@@ -227,7 +223,7 @@ public class EntityResource {
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
MetadataServiceClient
.
GUID
,
guid
);
response
.
put
(
MetadataServiceClient
.
GUID
,
guid
);
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
traitNames
));
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
traitNames
));
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
traitNames
.
size
());
response
.
put
(
MetadataServiceClient
.
COUNT
,
traitNames
.
size
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
MetadataException
|
IllegalArgumentException
e
)
{
}
catch
(
MetadataException
|
IllegalArgumentException
e
)
{
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/MetadataDiscoveryResource.java
View file @
6be16550
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/RexsterGraphResource.java
View file @
6be16550
...
@@ -165,7 +165,7 @@ public class RexsterGraphResource {
...
@@ -165,7 +165,7 @@ public class RexsterGraphResource {
JSONObject
response
=
new
JSONObject
();
JSONObject
response
=
new
JSONObject
();
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONObject
(
vertexProperties
));
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONObject
(
vertexProperties
));
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
vertexProperties
.
size
());
response
.
put
(
MetadataServiceClient
.
COUNT
,
vertexProperties
.
size
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
throw
new
WebApplicationException
(
throw
new
WebApplicationException
(
...
@@ -276,7 +276,7 @@ public class RexsterGraphResource {
...
@@ -276,7 +276,7 @@ public class RexsterGraphResource {
if
(!
countOnly
)
{
if
(!
countOnly
)
{
response
.
put
(
MetadataServiceClient
.
RESULTS
,
elementArray
);
response
.
put
(
MetadataServiceClient
.
RESULTS
,
elementArray
);
}
}
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
counter
);
response
.
put
(
MetadataServiceClient
.
COUNT
,
counter
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
}
...
@@ -323,7 +323,7 @@ public class RexsterGraphResource {
...
@@ -323,7 +323,7 @@ public class RexsterGraphResource {
JSONObject
response
=
new
JSONObject
();
JSONObject
response
=
new
JSONObject
();
response
.
put
(
MetadataServiceClient
.
RESULTS
,
vertexArray
);
response
.
put
(
MetadataServiceClient
.
RESULTS
,
vertexArray
);
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
counter
);
response
.
put
(
MetadataServiceClient
.
COUNT
,
counter
);
return
response
;
return
response
;
}
}
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/TypesResource.java
View file @
6be16550
...
@@ -157,7 +157,7 @@ public class TypesResource {
...
@@ -157,7 +157,7 @@ public class TypesResource {
JSONObject
response
=
new
JSONObject
();
JSONObject
response
=
new
JSONObject
();
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
result
));
response
.
put
(
MetadataServiceClient
.
RESULTS
,
new
JSONArray
(
result
));
response
.
put
(
MetadataServiceClient
.
TOTAL_SIZE
,
result
.
size
());
response
.
put
(
MetadataServiceClient
.
COUNT
,
result
.
size
());
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
...
...
webapp/src/test/java/org/apache/hadoop/metadata/web/resources/MetadataDiscoveryJerseyResourceIT.java
View file @
6be16550
...
@@ -83,8 +83,12 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -83,8 +83,12 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
JSONObject
results
=
response
.
getJSONObject
(
MetadataServiceClient
.
RESULTS
);
JSONObject
results
=
response
.
getJSONObject
(
MetadataServiceClient
.
RESULTS
);
Assert
.
assertNotNull
(
results
);
Assert
.
assertNotNull
(
results
);
JSONArray
rows
=
results
.
getJSONArray
(
"rows"
);
JSONArray
rows
=
results
.
getJSONArray
(
MetadataServiceClient
.
ROWS
);
Assert
.
assertEquals
(
rows
.
length
(),
1
);
Assert
.
assertEquals
(
rows
.
length
(),
1
);
int
numRows
=
response
.
getInt
(
MetadataServiceClient
.
COUNT
);
Assert
.
assertEquals
(
numRows
,
1
);
}
}
@Test
@Test
...
@@ -164,6 +168,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
...
@@ -164,6 +168,9 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
Assert
.
assertNotNull
(
row
.
get
(
"guid"
));
Assert
.
assertNotNull
(
row
.
get
(
"guid"
));
Assert
.
assertEquals
(
row
.
getString
(
"typeName"
),
"dsl_test_type"
);
Assert
.
assertEquals
(
row
.
getString
(
"typeName"
),
"dsl_test_type"
);
Assert
.
assertNotNull
(
row
.
get
(
"score"
));
Assert
.
assertNotNull
(
row
.
get
(
"score"
));
int
numRows
=
response
.
getInt
(
MetadataServiceClient
.
COUNT
);
Assert
.
assertEquals
(
numRows
,
1
);
}
}
private
void
createTypes
()
throws
Exception
{
private
void
createTypes
()
throws
Exception
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment