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
9310e0bc
Commit
9310e0bc
authored
9 years ago
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed constants
parent
fe107bbf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
MetadataServiceClient.java
...ava/org/apache/hadoop/metadata/MetadataServiceClient.java
+12
-12
MetadataDiscoveryResource.java
...oop/metadata/web/resources/MetadataDiscoveryResource.java
+4
-6
No files found.
client/src/main/java/org/apache/hadoop/metadata/MetadataServiceClient.java
View file @
9310e0bc
...
...
@@ -25,11 +25,8 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
import
com.sun.jersey.client.urlconnection.URLConnectionClientHandler
;
import
org.apache.commons.configuration.PropertiesConfiguration
;
import
org.apache.hadoop.metadata.security.SecureClientUtils
;
import
org.apache.hadoop.metadata.typesystem.ITypedReferenceableInstance
;
import
org.apache.hadoop.metadata.typesystem.Referenceable
;
import
org.apache.hadoop.metadata.typesystem.json.InstanceSerialization
;
import
org.apache.hadoop.metadata.typesystem.json.Serialization
;
import
org.apache.http.protocol.HTTP
;
import
org.codehaus.jettison.json.JSONArray
;
import
org.codehaus.jettison.json.JSONException
;
import
org.codehaus.jettison.json.JSONObject
;
...
...
@@ -60,11 +57,14 @@ public class MetadataServiceClient {
public
static
final
String
COUNT
=
"count"
;
public
static
final
String
ROWS
=
"rows"
;
private
static
final
String
BASE_URI
=
"api/metadata/"
;
private
static
final
String
URI_TYPES
=
"types"
;
private
static
final
String
URI_ENTITIES
=
"entities"
;
private
static
final
String
URI_TRAITS
=
"traits"
;
private
static
final
String
URI_SEARCH
=
"discovery/search"
;
public
static
final
String
BASE_URI
=
"api/metadata/"
;
public
static
final
String
URI_TYPES
=
"types"
;
public
static
final
String
URI_ENTITIES
=
"entities"
;
public
static
final
String
URI_TRAITS
=
"traits"
;
public
static
final
String
URI_SEARCH
=
"discovery/search"
;
public
static
final
String
QUERY
=
"query"
;
public
static
final
String
QUERY_TYPE
=
"queryType"
;
private
WebResource
service
;
...
...
@@ -204,7 +204,7 @@ public class MetadataServiceClient {
public
JSONObject
searchEntity
(
String
searchQuery
)
throws
MetadataServiceException
{
WebResource
resource
=
getResource
(
API
.
SEARCH
);
resource
=
resource
.
queryParam
(
"query"
,
searchQuery
);
resource
=
resource
.
queryParam
(
QUERY
,
searchQuery
);
return
callAPIWithResource
(
API
.
SEARCH
,
resource
);
}
...
...
@@ -234,7 +234,7 @@ public class MetadataServiceClient {
*/
public
JSONArray
searchByDSL
(
String
query
)
throws
MetadataServiceException
{
WebResource
resource
=
getResource
(
API
.
SEARCH_DSL
);
resource
=
resource
.
queryParam
(
"query"
,
query
);
resource
=
resource
.
queryParam
(
QUERY
,
query
);
JSONObject
result
=
callAPIWithResource
(
API
.
SEARCH_DSL
,
resource
);
try
{
return
result
.
getJSONObject
(
RESULTS
).
getJSONArray
(
ROWS
);
...
...
@@ -251,7 +251,7 @@ public class MetadataServiceClient {
*/
public
JSONObject
searchByGremlin
(
String
gremlinQuery
)
throws
MetadataServiceException
{
WebResource
resource
=
getResource
(
API
.
SEARCH_GREMLIN
);
resource
=
resource
.
queryParam
(
"query"
,
gremlinQuery
);
resource
=
resource
.
queryParam
(
QUERY
,
gremlinQuery
);
return
callAPIWithResource
(
API
.
SEARCH_GREMLIN
,
resource
);
}
...
...
@@ -263,7 +263,7 @@ public class MetadataServiceClient {
*/
public
JSONObject
searchByFullText
(
String
query
)
throws
MetadataServiceException
{
WebResource
resource
=
getResource
(
API
.
SEARCH_FULL_TEXT
);
resource
=
resource
.
queryParam
(
"query"
,
query
);
resource
=
resource
.
queryParam
(
QUERY
,
query
);
return
callAPIWithResource
(
API
.
SEARCH_FULL_TEXT
,
resource
);
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/MetadataDiscoveryResource.java
View file @
9310e0bc
...
...
@@ -49,8 +49,6 @@ import java.util.Map;
public
class
MetadataDiscoveryResource
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
EntityResource
.
class
);
private
static
final
String
QUERY
=
"query"
;
private
static
final
String
QUERY_TYPE
=
"queryType"
;
private
static
final
String
QUERY_TYPE_DSL
=
"dsl"
;
private
static
final
String
QUERY_TYPE_GREMLIN
=
"gremlin"
;
private
static
final
String
QUERY_TYPE_FULLTEXT
=
"full-text"
;
...
...
@@ -166,8 +164,8 @@ public class MetadataDiscoveryResource {
JSONObject
response
=
new
JSONObject
();
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
QUERY
,
gremlinQuery
);
response
.
put
(
QUERY_TYPE
,
QUERY_TYPE_GREMLIN
);
response
.
put
(
MetadataServiceClient
.
QUERY
,
gremlinQuery
);
response
.
put
(
MetadataServiceClient
.
QUERY_TYPE
,
QUERY_TYPE_GREMLIN
);
JSONArray
list
=
new
JSONArray
();
for
(
Map
<
String
,
String
>
result
:
results
)
{
...
...
@@ -252,8 +250,8 @@ public class MetadataDiscoveryResource {
Preconditions
.
checkArgument
(
count
>=
0
,
"Search Result count should be > 0"
);
response
.
put
(
MetadataServiceClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
QUERY
,
query
);
response
.
put
(
QUERY_TYPE
,
queryType
);
response
.
put
(
MetadataServiceClient
.
QUERY
,
query
);
response
.
put
(
MetadataServiceClient
.
QUERY_TYPE
,
queryType
);
response
.
put
(
MetadataServiceClient
.
COUNT
,
count
);
return
response
;
}
...
...
This diff is collapsed.
Click to expand it.
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