BUG-33250 Apache Incubation Related changes- take 2. Contributed by Venkatesh Seetharam
This commit is contained in:
parent
ee14333849
commit
2ee6663954
|
|
@ -20,21 +20,27 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
<parent>
|
||||
<artifactId>metadata-governance</artifactId>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<version>0.1-incubating-SNAPSHOT</version>
|
||||
</parent>
|
||||
-->
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>metadata-governance</artifactId>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<version>0.1-incubating-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>falcon-bridge</artifactId>
|
||||
<description>Apache Metadata Falcon Bridge Module</description>
|
||||
<name>Apache Metadata Falcon Bridge</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<artifactId>metadata-falcontypes</artifactId>
|
||||
<properties>
|
||||
<falcon.version>0.6.0.2.2.0.0-2041</falcon.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.falcon</groupId>
|
||||
<artifactId>falcon-client</artifactId>
|
||||
<version>${falcon.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- falcon-client depends on jersey-client in provided scope. Hence explicit dependency -->
|
||||
|
|
@ -20,32 +20,60 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
<parent>
|
||||
<artifactId>metadata-governance</artifactId>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<version>0.1-incubating-SNAPSHOT</version>
|
||||
</parent>
|
||||
-->
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>metadata-governance</artifactId>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<version>0.1-incubating-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>hive-bridge</artifactId>
|
||||
<description>Apache Metadata Hive Bridge Module</description>
|
||||
<name>Apache Metadata Hive Bridge</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<artifactId>metadata-hivetypes</artifactId>
|
||||
<properties>
|
||||
<hive.version>0.14.0</hive.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-metastore</artifactId>
|
||||
<version>${hive.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-avatica</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-exec</artifactId>
|
||||
<version>${hive.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-avatica</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-avatica</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-core</artifactId>
|
||||
|
|
@ -56,26 +84,45 @@
|
|||
<artifactId>gson</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<artifactId>metadata-typesystem</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<artifactId>metadata-repository</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>resources/*-site.xml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -28,15 +28,15 @@ import org.apache.hadoop.hive.metastore.api.Partition;
|
|||
import org.apache.hadoop.hive.metastore.api.SerDeInfo;
|
||||
import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
|
||||
import org.apache.hadoop.hive.metastore.api.Table;
|
||||
import org.apache.hadoop.metadata.ITypedReferenceableInstance;
|
||||
import org.apache.hadoop.metadata.ITypedStruct;
|
||||
import org.apache.hadoop.metadata.typesystem.ITypedReferenceableInstance;
|
||||
import org.apache.hadoop.metadata.typesystem.ITypedStruct;
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.Referenceable;
|
||||
import org.apache.hadoop.metadata.Struct;
|
||||
import org.apache.hadoop.metadata.typesystem.Referenceable;
|
||||
import org.apache.hadoop.metadata.typesystem.Struct;
|
||||
import org.apache.hadoop.metadata.repository.MetadataRepository;
|
||||
import org.apache.hadoop.metadata.typesystem.persistence.IRepository;
|
||||
import org.apache.hadoop.metadata.repository.IRepository;
|
||||
import org.apache.hadoop.metadata.typesystem.persistence.Id;
|
||||
import org.apache.hadoop.metadata.typesystem.persistence.RepositoryException;
|
||||
import org.apache.hadoop.metadata.repository.RepositoryException;
|
||||
import org.apache.hadoop.metadata.typesystem.types.IDataType;
|
||||
import org.apache.hadoop.metadata.typesystem.types.Multiplicity;
|
||||
import org.apache.hadoop.metadata.typesystem.types.StructType;
|
||||
|
|
@ -1,166 +1,166 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.repository.MetadataRepository;
|
||||
import org.apache.hadoop.metadata.repository.RepositoryException;
|
||||
import org.apache.hadoop.metadata.typesystem.ITypedReferenceableInstance;
|
||||
import org.apache.hadoop.metadata.typesystem.Referenceable;
|
||||
import org.apache.hadoop.metadata.typesystem.types.AttributeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.AttributeInfo;
|
||||
import org.apache.hadoop.metadata.typesystem.types.ClassType;
|
||||
import org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.Multiplicity;
|
||||
import org.apache.hadoop.metadata.typesystem.types.TypeSystem;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class ABridge implements IBridge {
|
||||
|
||||
protected static final Logger LOG = BridgeManager.LOG;
|
||||
protected ArrayList<Class<? extends AEntityBean>> typeBeanClasses
|
||||
= new ArrayList<Class<? extends AEntityBean>>();
|
||||
MetadataRepository repo;
|
||||
|
||||
protected ABridge(MetadataRepository repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
protected HierarchicalTypeDefinition<ClassType> createClassTypeDef(String name,
|
||||
ImmutableList<String>
|
||||
superTypes,
|
||||
AttributeDefinition...
|
||||
attrDefs) {
|
||||
return new HierarchicalTypeDefinition(ClassType.class, name, superTypes, attrDefs);
|
||||
}
|
||||
|
||||
public ArrayList<Class<? extends AEntityBean>> getTypeBeanClasses() {
|
||||
return typeBeanClasses;
|
||||
}
|
||||
|
||||
public AEntityBean get(String id) throws RepositoryException {
|
||||
// get from the system by id (?)
|
||||
ITypedReferenceableInstance ref = repo.getEntityDefinition(id);
|
||||
// turn into a HiveLineageBean
|
||||
try {
|
||||
Class<AEntityBean> c = getTypeBeanInListByName(ref.getTypeName());
|
||||
return this.convertFromITypedReferenceable(ref,
|
||||
getTypeBeanInListByName(ref.getTypeName()));
|
||||
} catch (BridgeException | InstantiationException | IllegalAccessException |
|
||||
IllegalArgumentException | InvocationTargetException | NoSuchMethodException |
|
||||
SecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String create(AEntityBean bean) throws MetadataException {
|
||||
|
||||
ClassType type = TypeSystem.getInstance()
|
||||
.getDataType(ClassType.class, bean.getClass().getSimpleName());
|
||||
ITypedReferenceableInstance refBean = null;
|
||||
try {
|
||||
refBean = type.convert(this.convertToReferencable(bean), Multiplicity.REQUIRED);
|
||||
String id = repo.createEntity(refBean, type.getName());
|
||||
return id;
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new MetadataException("Cannot create entity");
|
||||
|
||||
}
|
||||
|
||||
public Iterable<String> list() throws RepositoryException {
|
||||
List<String> returnList = null;
|
||||
for (Class c : typeBeanClasses) {
|
||||
List<String> inBetweenList = repo.getEntityList(c.getSimpleName());
|
||||
try {
|
||||
returnList.addAll(inBetweenList);
|
||||
} catch (NullPointerException e) {
|
||||
returnList = inBetweenList;
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
protected final boolean containsType(String s) {
|
||||
for (Class c : typeBeanClasses) {
|
||||
if (c.getSimpleName().equals(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected final Class<AEntityBean> getTypeBeanInListByName(String s) throws BridgeException {
|
||||
if (containsType(s)) {
|
||||
for (Class c : typeBeanClasses) {
|
||||
if (c.getSimpleName().equals(s)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BridgeException("No EntityBean Definition Found");
|
||||
}
|
||||
throw new BridgeException("No EntityBean Definition Found");
|
||||
}
|
||||
|
||||
protected final <T extends AEntityBean> Referenceable convertToReferencable(T o)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
Referenceable selfAware = new Referenceable(o.getClass().getSimpleName());
|
||||
// TODO - support non-primitive types and deep inspection
|
||||
for (Field f : o.getClass().getFields()) {
|
||||
selfAware.set(f.getName(), f.get(o));
|
||||
}
|
||||
return selfAware;
|
||||
}
|
||||
|
||||
protected final <T extends AEntityBean> T convertFromITypedReferenceable(
|
||||
ITypedReferenceableInstance instance, Class<? extends AEntityBean> c)
|
||||
throws InstantiationException, IllegalAccessException, IllegalArgumentException,
|
||||
InvocationTargetException, NoSuchMethodException, SecurityException, BridgeException {
|
||||
if (!instance.getTypeName().equals(c.getSimpleName())) {
|
||||
throw new BridgeException("ReferenceableInstance type not the same as bean");
|
||||
}
|
||||
Object retObj = this.getClass().newInstance();
|
||||
for (Entry<String, AttributeInfo> e : instance.fieldMapping().fields.entrySet()) {
|
||||
try {
|
||||
|
||||
String convertedName = e.getKey().substring(0, 1).toUpperCase() +
|
||||
e.getKey().substring(1);
|
||||
this.getClass().getMethod("set" + convertedName,
|
||||
Class.forName(e.getValue().dataType().getName()))
|
||||
.invoke(this, instance.get(e.getKey()));
|
||||
} catch (MetadataException | ClassNotFoundException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
return (T) retObj;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.repository.MetadataRepository;
|
||||
import org.apache.hadoop.metadata.repository.RepositoryException;
|
||||
import org.apache.hadoop.metadata.typesystem.ITypedReferenceableInstance;
|
||||
import org.apache.hadoop.metadata.typesystem.Referenceable;
|
||||
import org.apache.hadoop.metadata.typesystem.types.AttributeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.AttributeInfo;
|
||||
import org.apache.hadoop.metadata.typesystem.types.ClassType;
|
||||
import org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.Multiplicity;
|
||||
import org.apache.hadoop.metadata.typesystem.types.TypeSystem;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class ABridge implements IBridge {
|
||||
|
||||
protected static final Logger LOG = BridgeManager.LOG;
|
||||
protected ArrayList<Class<? extends AEntityBean>> typeBeanClasses
|
||||
= new ArrayList<Class<? extends AEntityBean>>();
|
||||
MetadataRepository repo;
|
||||
|
||||
protected ABridge(MetadataRepository repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
protected HierarchicalTypeDefinition<ClassType> createClassTypeDef(String name,
|
||||
ImmutableList<String>
|
||||
superTypes,
|
||||
AttributeDefinition...
|
||||
attrDefs) {
|
||||
return new HierarchicalTypeDefinition(ClassType.class, name, superTypes, attrDefs);
|
||||
}
|
||||
|
||||
public ArrayList<Class<? extends AEntityBean>> getTypeBeanClasses() {
|
||||
return typeBeanClasses;
|
||||
}
|
||||
|
||||
public AEntityBean get(String id) throws RepositoryException {
|
||||
// get from the system by id (?)
|
||||
ITypedReferenceableInstance ref = repo.getEntityDefinition(id);
|
||||
// turn into a HiveLineageBean
|
||||
try {
|
||||
Class<AEntityBean> c = getTypeBeanInListByName(ref.getTypeName());
|
||||
return this.convertFromITypedReferenceable(ref,
|
||||
getTypeBeanInListByName(ref.getTypeName()));
|
||||
} catch (BridgeException | InstantiationException | IllegalAccessException |
|
||||
IllegalArgumentException | InvocationTargetException | NoSuchMethodException |
|
||||
SecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String create(AEntityBean bean) throws MetadataException {
|
||||
|
||||
ClassType type = TypeSystem.getInstance()
|
||||
.getDataType(ClassType.class, bean.getClass().getSimpleName());
|
||||
ITypedReferenceableInstance refBean = null;
|
||||
try {
|
||||
refBean = type.convert(this.convertToReferencable(bean), Multiplicity.REQUIRED);
|
||||
String id = repo.createEntity(refBean, type.getName());
|
||||
return id;
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new MetadataException("Cannot create entity");
|
||||
|
||||
}
|
||||
|
||||
public Iterable<String> list() throws RepositoryException {
|
||||
List<String> returnList = null;
|
||||
for (Class c : typeBeanClasses) {
|
||||
List<String> inBetweenList = repo.getEntityList(c.getSimpleName());
|
||||
try {
|
||||
returnList.addAll(inBetweenList);
|
||||
} catch (NullPointerException e) {
|
||||
returnList = inBetweenList;
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
protected final boolean containsType(String s) {
|
||||
for (Class c : typeBeanClasses) {
|
||||
if (c.getSimpleName().equals(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected final Class<AEntityBean> getTypeBeanInListByName(String s) throws BridgeException {
|
||||
if (containsType(s)) {
|
||||
for (Class c : typeBeanClasses) {
|
||||
if (c.getSimpleName().equals(s)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BridgeException("No EntityBean Definition Found");
|
||||
}
|
||||
throw new BridgeException("No EntityBean Definition Found");
|
||||
}
|
||||
|
||||
protected final <T extends AEntityBean> Referenceable convertToReferencable(T o)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
Referenceable selfAware = new Referenceable(o.getClass().getSimpleName());
|
||||
// TODO - support non-primitive types and deep inspection
|
||||
for (Field f : o.getClass().getFields()) {
|
||||
selfAware.set(f.getName(), f.get(o));
|
||||
}
|
||||
return selfAware;
|
||||
}
|
||||
|
||||
protected final <T extends AEntityBean> T convertFromITypedReferenceable(
|
||||
ITypedReferenceableInstance instance, Class<? extends AEntityBean> c)
|
||||
throws InstantiationException, IllegalAccessException, IllegalArgumentException,
|
||||
InvocationTargetException, NoSuchMethodException, SecurityException, BridgeException {
|
||||
if (!instance.getTypeName().equals(c.getSimpleName())) {
|
||||
throw new BridgeException("ReferenceableInstance type not the same as bean");
|
||||
}
|
||||
Object retObj = this.getClass().newInstance();
|
||||
for (Entry<String, AttributeInfo> e : instance.fieldMapping().fields.entrySet()) {
|
||||
try {
|
||||
|
||||
String convertedName = e.getKey().substring(0, 1).toUpperCase() +
|
||||
e.getKey().substring(1);
|
||||
this.getClass().getMethod("set" + convertedName,
|
||||
Class.forName(e.getValue().dataType().getName()))
|
||||
.invoke(this, instance.get(e.getKey()));
|
||||
} catch (MetadataException | ClassNotFoundException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
return (T) retObj;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +1,106 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.typesystem.types.AttributeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.ClassType;
|
||||
import org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.Multiplicity;
|
||||
import org.apache.hadoop.metadata.typesystem.types.TypeSystem;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
@Singleton
|
||||
public class BridgeTypeBootstrapper {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BridgeTypeBootstrapper.class);
|
||||
private final Map<Class, IBridge> bridges;
|
||||
private boolean isSetup = false;
|
||||
|
||||
@Inject
|
||||
BridgeTypeBootstrapper(Map<Class, IBridge> bridges)
|
||||
throws MetadataException {
|
||||
this.bridges = bridges;
|
||||
}
|
||||
|
||||
public final static HierarchicalTypeDefinition<ClassType>
|
||||
convertEntityBeanToClassTypeDefinition(
|
||||
Class<? extends AEntityBean> class1) {
|
||||
ArrayList<AttributeDefinition> attDefAL = new ArrayList<AttributeDefinition>();
|
||||
for (Field f : class1.getFields()) {
|
||||
try {
|
||||
attDefAL.add(BridgeTypeBootstrapper.convertFieldtoAttributeDefiniton(f));
|
||||
} catch (MetadataException e) {
|
||||
BridgeManager.LOG.error("Class " + class1.getName()
|
||||
+ " cannot be converted to TypeDefinition");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
HierarchicalTypeDefinition<ClassType> typeDef = new HierarchicalTypeDefinition<>(
|
||||
ClassType.class, class1.getSimpleName(), null,
|
||||
(AttributeDefinition[]) attDefAL
|
||||
.toArray(new AttributeDefinition[0]));
|
||||
|
||||
return typeDef;
|
||||
}
|
||||
|
||||
public final static AttributeDefinition convertFieldtoAttributeDefiniton(
|
||||
Field f) throws MetadataException {
|
||||
|
||||
return new AttributeDefinition(f.getName(),
|
||||
f.getType().getSimpleName().toLowerCase(), Multiplicity.REQUIRED, false, null);
|
||||
}
|
||||
|
||||
public synchronized boolean bootstrap() throws MetadataException {
|
||||
if (isSetup)
|
||||
return false;
|
||||
else {
|
||||
LOG.info("Bootstrapping types");
|
||||
_bootstrap();
|
||||
isSetup = true;
|
||||
LOG.info("Bootstrapping complete");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void _bootstrap() throws MetadataException {
|
||||
TypeSystem ts = TypeSystem.getInstance();
|
||||
for (IBridge bridge : bridges.values()) {
|
||||
LOG.info("Registering bridge, %s", bridge.getClass().getSimpleName());
|
||||
loadTypes(bridge, ts);
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean loadTypes(IBridge bridge, TypeSystem ts)
|
||||
throws MetadataException {
|
||||
for (Class<? extends AEntityBean> clazz : bridge.getTypeBeanClasses()) {
|
||||
LOG.info("Registering %s", clazz.getSimpleName());
|
||||
ts.defineClassType(BridgeTypeBootstrapper
|
||||
.convertEntityBeanToClassTypeDefinition(clazz));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.typesystem.types.AttributeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.ClassType;
|
||||
import org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition;
|
||||
import org.apache.hadoop.metadata.typesystem.types.Multiplicity;
|
||||
import org.apache.hadoop.metadata.typesystem.types.TypeSystem;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
@Singleton
|
||||
public class BridgeTypeBootstrapper {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BridgeTypeBootstrapper.class);
|
||||
private final Map<Class, IBridge> bridges;
|
||||
private boolean isSetup = false;
|
||||
|
||||
@Inject
|
||||
BridgeTypeBootstrapper(Map<Class, IBridge> bridges)
|
||||
throws MetadataException {
|
||||
this.bridges = bridges;
|
||||
}
|
||||
|
||||
public final static HierarchicalTypeDefinition<ClassType>
|
||||
convertEntityBeanToClassTypeDefinition(
|
||||
Class<? extends AEntityBean> class1) {
|
||||
ArrayList<AttributeDefinition> attDefAL = new ArrayList<AttributeDefinition>();
|
||||
for (Field f : class1.getFields()) {
|
||||
try {
|
||||
attDefAL.add(BridgeTypeBootstrapper.convertFieldtoAttributeDefiniton(f));
|
||||
} catch (MetadataException e) {
|
||||
BridgeManager.LOG.error("Class " + class1.getName()
|
||||
+ " cannot be converted to TypeDefinition");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
HierarchicalTypeDefinition<ClassType> typeDef = new HierarchicalTypeDefinition<>(
|
||||
ClassType.class, class1.getSimpleName(), null,
|
||||
(AttributeDefinition[]) attDefAL
|
||||
.toArray(new AttributeDefinition[0]));
|
||||
|
||||
return typeDef;
|
||||
}
|
||||
|
||||
public final static AttributeDefinition convertFieldtoAttributeDefiniton(
|
||||
Field f) throws MetadataException {
|
||||
|
||||
return new AttributeDefinition(f.getName(),
|
||||
f.getType().getSimpleName().toLowerCase(), Multiplicity.REQUIRED, false, null);
|
||||
}
|
||||
|
||||
public synchronized boolean bootstrap() throws MetadataException {
|
||||
if (isSetup)
|
||||
return false;
|
||||
else {
|
||||
LOG.info("Bootstrapping types");
|
||||
_bootstrap();
|
||||
isSetup = true;
|
||||
LOG.info("Bootstrapping complete");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void _bootstrap() throws MetadataException {
|
||||
TypeSystem ts = TypeSystem.getInstance();
|
||||
for (IBridge bridge : bridges.values()) {
|
||||
LOG.info("Registering bridge, %s", bridge.getClass().getSimpleName());
|
||||
loadTypes(bridge, ts);
|
||||
}
|
||||
}
|
||||
|
||||
private final boolean loadTypes(IBridge bridge, TypeSystem ts)
|
||||
throws MetadataException {
|
||||
for (Class<? extends AEntityBean> clazz : bridge.getTypeBeanClasses()) {
|
||||
LOG.info("Registering %s", clazz.getSimpleName());
|
||||
ts.defineClassType(BridgeTypeBootstrapper
|
||||
.convertEntityBeanToClassTypeDefinition(clazz));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,89 +1,89 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge.module;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Scopes;
|
||||
import com.google.inject.multibindings.MapBinder;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.hadoop.metadata.RepositoryMetadataModule;
|
||||
import org.apache.hadoop.metadata.bridge.BridgeTypeBootstrapper;
|
||||
import org.apache.hadoop.metadata.bridge.IBridge;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BridgeModule extends AbstractModule {
|
||||
public static final Logger LOG = LoggerFactory
|
||||
.getLogger(BridgeModule.class);
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
install(new RepositoryMetadataModule());
|
||||
|
||||
// make sure the BridgeTypeBootstrapper is only ever created once
|
||||
bind(BridgeTypeBootstrapper.class).in(Scopes.SINGLETON);
|
||||
|
||||
// Load the configured bridge classes and add them to the map binder
|
||||
MapBinder<Class, IBridge> mapbinder = MapBinder.newMapBinder(binder(),
|
||||
Class.class, IBridge.class);
|
||||
|
||||
String propsURI = System.getProperty("bridgeManager.propsFile",
|
||||
"bridge-manager.properties");
|
||||
|
||||
List<Class<? extends IBridge>> bridges = getBridgeClasses(propsURI);
|
||||
for (Class<? extends IBridge> bridgeClass : bridges) {
|
||||
mapbinder.addBinding(bridgeClass).to(bridgeClass).in(Scopes.SINGLETON);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the bridge classes from the configuration file
|
||||
*/
|
||||
private List<Class<? extends IBridge>> getBridgeClasses(
|
||||
String bridgePropFileName) {
|
||||
List<Class<? extends IBridge>> aBList = new ArrayList<Class<? extends IBridge>>();
|
||||
|
||||
PropertiesConfiguration config = new PropertiesConfiguration();
|
||||
|
||||
try {
|
||||
LOG.info("Loading : Active Bridge List");
|
||||
config.load(bridgePropFileName);
|
||||
String[] activeBridgeList = ((String) config
|
||||
.getProperty("BridgeManager.activeBridges")).split(",");
|
||||
LOG.info("Loaded : Active Bridge List");
|
||||
|
||||
for (String s : activeBridgeList) {
|
||||
Class<? extends IBridge> bridgeCls = (Class<? extends IBridge>) Class
|
||||
.forName(s);
|
||||
aBList.add(bridgeCls);
|
||||
}
|
||||
|
||||
} catch (ConfigurationException | IllegalArgumentException
|
||||
| SecurityException | ClassNotFoundException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return aBList;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge.module;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Scopes;
|
||||
import com.google.inject.multibindings.MapBinder;
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.PropertiesConfiguration;
|
||||
import org.apache.hadoop.metadata.RepositoryMetadataModule;
|
||||
import org.apache.hadoop.metadata.bridge.BridgeTypeBootstrapper;
|
||||
import org.apache.hadoop.metadata.bridge.IBridge;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BridgeModule extends AbstractModule {
|
||||
public static final Logger LOG = LoggerFactory
|
||||
.getLogger(BridgeModule.class);
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
install(new RepositoryMetadataModule());
|
||||
|
||||
// make sure the BridgeTypeBootstrapper is only ever created once
|
||||
bind(BridgeTypeBootstrapper.class).in(Scopes.SINGLETON);
|
||||
|
||||
// Load the configured bridge classes and add them to the map binder
|
||||
MapBinder<Class, IBridge> mapbinder = MapBinder.newMapBinder(binder(),
|
||||
Class.class, IBridge.class);
|
||||
|
||||
String propsURI = System.getProperty("bridgeManager.propsFile",
|
||||
"bridge-manager.properties");
|
||||
|
||||
List<Class<? extends IBridge>> bridges = getBridgeClasses(propsURI);
|
||||
for (Class<? extends IBridge> bridgeClass : bridges) {
|
||||
mapbinder.addBinding(bridgeClass).to(bridgeClass).in(Scopes.SINGLETON);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the bridge classes from the configuration file
|
||||
*/
|
||||
private List<Class<? extends IBridge>> getBridgeClasses(
|
||||
String bridgePropFileName) {
|
||||
List<Class<? extends IBridge>> aBList = new ArrayList<Class<? extends IBridge>>();
|
||||
|
||||
PropertiesConfiguration config = new PropertiesConfiguration();
|
||||
|
||||
try {
|
||||
LOG.info("Loading : Active Bridge List");
|
||||
config.load(bridgePropFileName);
|
||||
String[] activeBridgeList = ((String) config
|
||||
.getProperty("BridgeManager.activeBridges")).split(",");
|
||||
LOG.info("Loaded : Active Bridge List");
|
||||
|
||||
for (String s : activeBridgeList) {
|
||||
Class<? extends IBridge> bridgeCls = (Class<? extends IBridge>) Class
|
||||
.forName(s);
|
||||
aBList.add(bridgeCls);
|
||||
}
|
||||
|
||||
} catch (ConfigurationException | IllegalArgumentException
|
||||
| SecurityException | ClassNotFoundException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return aBList;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +1,82 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.web.resources;
|
||||
|
||||
import org.apache.hadoop.metadata.bridge.hivelineage.HiveLineageBridge;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
//@Path("bridge/hive")
|
||||
@Singleton
|
||||
public class HiveLineageResource {
|
||||
|
||||
private final HiveLineageBridge bridge = null;
|
||||
|
||||
/*
|
||||
//@Inject
|
||||
public HiveLineageResource(HiveLineageBridge bridge) {
|
||||
this.bridge = bridge;
|
||||
}
|
||||
|
||||
//@Inject
|
||||
public HiveLineageResource(Map<Class<? extends IBridge>, IBridge> bridges) {
|
||||
this.bridge = (HiveLineageBridge) bridges.get(HiveLineageBridge.class);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonElement getById(@PathParam("id") String id) throws RepositoryException {
|
||||
// get the lineage bean
|
||||
HiveLineage hlb = (HiveLineage) bridge.get(id);
|
||||
// turn it into a JsonTree & return
|
||||
return new Gson().toJsonTree(hlb);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonElement list() throws RepositoryException {
|
||||
// make a new JsonArray to be returned
|
||||
JsonArray ja = new JsonArray();
|
||||
// iterate over each item returned by the hive bridge's list() method
|
||||
for (String s: bridge.list()) {
|
||||
// they are GUIDs so make them into JsonPrimitives
|
||||
ja.add(new JsonPrimitive(s));
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonElement addLineage(@Context HttpServletRequest request)
|
||||
throws IOException, MetadataException {
|
||||
// create a reader
|
||||
try (Reader reader = new InputStreamReader(request.getInputStream())) {
|
||||
// deserialize
|
||||
HiveLineage bean = new Gson().fromJson(reader, HiveLineage.class);
|
||||
String id = bridge.create(bean);
|
||||
|
||||
JsonObject jo = new JsonObject();
|
||||
jo.addProperty("id", id);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.web.resources;
|
||||
|
||||
import org.apache.hadoop.metadata.bridge.hivelineage.HiveLineageBridge;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
//@Path("bridge/hive")
|
||||
@Singleton
|
||||
public class HiveLineageResource {
|
||||
|
||||
private final HiveLineageBridge bridge = null;
|
||||
|
||||
/*
|
||||
//@Inject
|
||||
public HiveLineageResource(HiveLineageBridge bridge) {
|
||||
this.bridge = bridge;
|
||||
}
|
||||
|
||||
//@Inject
|
||||
public HiveLineageResource(Map<Class<? extends IBridge>, IBridge> bridges) {
|
||||
this.bridge = (HiveLineageBridge) bridges.get(HiveLineageBridge.class);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonElement getById(@PathParam("id") String id) throws RepositoryException {
|
||||
// get the lineage bean
|
||||
HiveLineage hlb = (HiveLineage) bridge.get(id);
|
||||
// turn it into a JsonTree & return
|
||||
return new Gson().toJsonTree(hlb);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonElement list() throws RepositoryException {
|
||||
// make a new JsonArray to be returned
|
||||
JsonArray ja = new JsonArray();
|
||||
// iterate over each item returned by the hive bridge's list() method
|
||||
for (String s: bridge.list()) {
|
||||
// they are GUIDs so make them into JsonPrimitives
|
||||
ja.add(new JsonPrimitive(s));
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonElement addLineage(@Context HttpServletRequest request)
|
||||
throws IOException, MetadataException {
|
||||
// create a reader
|
||||
try (Reader reader = new InputStreamReader(request.getInputStream())) {
|
||||
// deserialize
|
||||
HiveLineage bean = new Gson().fromJson(reader, HiveLineage.class);
|
||||
String id = bridge.create(bean);
|
||||
|
||||
JsonObject jo = new JsonObject();
|
||||
jo.addProperty("id", id);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#BridgeManager.activebridges denotes which bridge defintions to load from the classpath (Comma seperated list of fully qualified class paths)
|
||||
#
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#BridgeManager.activebridges denotes which bridge defintions to load from the classpath (Comma seperated list of fully qualified class paths)
|
||||
#
|
||||
BridgeManager.activeBridges=org.apache.hadoop.metadata.bridge.hivelineage.HiveLineageBridge
|
||||
|
|
@ -1,58 +1,58 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import org.apache.hadoop.metadata.RepositoryMetadataModule;
|
||||
import org.apache.hadoop.metadata.repository.MetadataRepository;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
@Guice(modules = RepositoryMetadataModule.class)
|
||||
public class BridgeManagerTest {
|
||||
|
||||
@Inject
|
||||
MetadataRepository repo;
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testLoadPropertiesFile() throws Exception {
|
||||
BridgeManager bm = new BridgeManager(repo);
|
||||
System.out.println(bm.getActiveBridges().size());
|
||||
|
||||
Assert.assertEquals(bm.activeBridges.get(0).getClass().getSimpleName(),
|
||||
"HiveLineageBridge");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanConvertion() {
|
||||
|
||||
//Tests Conversion of Bean to Type
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIRefConvertion() {
|
||||
|
||||
//Tests Conversion of IRef cast to Bean
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import org.apache.hadoop.metadata.RepositoryMetadataModule;
|
||||
import org.apache.hadoop.metadata.repository.MetadataRepository;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
@Guice(modules = RepositoryMetadataModule.class)
|
||||
public class BridgeManagerTest {
|
||||
|
||||
@Inject
|
||||
MetadataRepository repo;
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testLoadPropertiesFile() throws Exception {
|
||||
BridgeManager bm = new BridgeManager(repo);
|
||||
System.out.println(bm.getActiveBridges().size());
|
||||
|
||||
Assert.assertEquals(bm.activeBridges.get(0).getClass().getSimpleName(),
|
||||
"HiveLineageBridge");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeanConvertion() {
|
||||
|
||||
//Tests Conversion of Bean to Type
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIRefConvertion() {
|
||||
|
||||
//Tests Conversion of IRef cast to Bean
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,34 +1,34 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import org.apache.hadoop.metadata.bridge.module.BridgeModule;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Guice(modules = {BridgeModule.class})
|
||||
public class TestBridgeModule {
|
||||
|
||||
@Test
|
||||
public void loadAnything() {
|
||||
// if it makes it here, the BridgeModule loaded successfully
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
import org.apache.hadoop.metadata.bridge.module.BridgeModule;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Guice(modules = {BridgeModule.class})
|
||||
public class TestBridgeModule {
|
||||
|
||||
@Test
|
||||
public void loadAnything() {
|
||||
// if it makes it here, the BridgeModule loaded successfully
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,25 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
public class TestGenericBridges {
|
||||
|
||||
|
||||
//TODO Build Generic Tests for non-lineage Bridge
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge;
|
||||
|
||||
public class TestGenericBridges {
|
||||
|
||||
|
||||
//TODO Build Generic Tests for non-lineage Bridge
|
||||
}
|
||||
|
|
@ -1,86 +1,86 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge.hivelineage;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.bridge.BridgeTypeBootstrapper;
|
||||
import org.apache.hadoop.metadata.bridge.hivelineage.hook.HiveLineage;
|
||||
import org.apache.hadoop.metadata.bridge.module.BridgeModule;
|
||||
import org.apache.hadoop.metadata.repository.RepositoryException;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
|
||||
@Guice(modules = {BridgeModule.class})
|
||||
public class TestHiveLineageBridge {
|
||||
|
||||
@Inject
|
||||
HiveLineageBridge bridge;
|
||||
|
||||
@Inject
|
||||
BridgeTypeBootstrapper bootstrapper;
|
||||
|
||||
HiveLineage hlb;
|
||||
|
||||
// the id of one.json in the repo (test #1)
|
||||
String oneId;
|
||||
|
||||
private HiveLineage loadHiveLineageBean(String path) throws IOException {
|
||||
return new Gson().fromJson(new InputStreamReader(this.getClass().getResourceAsStream(path)),
|
||||
HiveLineage.class);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public void bootstrap() throws IOException, MetadataException {
|
||||
bootstrapper.bootstrap();
|
||||
hlb = loadHiveLineageBean("/one.json");
|
||||
}
|
||||
|
||||
@Test(priority = 1, enabled = false)
|
||||
public void testCreate() throws MetadataException {
|
||||
// add the lineage bean to the repo
|
||||
oneId = bridge.create(hlb);
|
||||
|
||||
// make sure this actually did worked
|
||||
Assert.assertNotNull(oneId);
|
||||
}
|
||||
|
||||
@Test(priority = 2, enabled = false)
|
||||
public void testGet() throws RepositoryException, IOException {
|
||||
Object bean = bridge.get(oneId);
|
||||
|
||||
Assert.assertEquals(hlb, bean);
|
||||
}
|
||||
|
||||
@Test(priority = 3, enabled = false)
|
||||
public void testList() throws RepositoryException {
|
||||
List<String> list = IteratorUtils.toList(bridge.list().iterator());
|
||||
|
||||
Assert.assertEquals(list.size(), 1);
|
||||
Assert.assertEquals(list.get(0), oneId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.metadata.bridge.hivelineage;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.hadoop.metadata.MetadataException;
|
||||
import org.apache.hadoop.metadata.bridge.BridgeTypeBootstrapper;
|
||||
import org.apache.hadoop.metadata.bridge.hivelineage.hook.HiveLineage;
|
||||
import org.apache.hadoop.metadata.bridge.module.BridgeModule;
|
||||
import org.apache.hadoop.metadata.repository.RepositoryException;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
|
||||
@Guice(modules = {BridgeModule.class})
|
||||
public class TestHiveLineageBridge {
|
||||
|
||||
@Inject
|
||||
HiveLineageBridge bridge;
|
||||
|
||||
@Inject
|
||||
BridgeTypeBootstrapper bootstrapper;
|
||||
|
||||
HiveLineage hlb;
|
||||
|
||||
// the id of one.json in the repo (test #1)
|
||||
String oneId;
|
||||
|
||||
private HiveLineage loadHiveLineageBean(String path) throws IOException {
|
||||
return new Gson().fromJson(new InputStreamReader(this.getClass().getResourceAsStream(path)),
|
||||
HiveLineage.class);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public void bootstrap() throws IOException, MetadataException {
|
||||
bootstrapper.bootstrap();
|
||||
hlb = loadHiveLineageBean("/one.json");
|
||||
}
|
||||
|
||||
@Test(priority = 1, enabled = false)
|
||||
public void testCreate() throws MetadataException {
|
||||
// add the lineage bean to the repo
|
||||
oneId = bridge.create(hlb);
|
||||
|
||||
// make sure this actually did worked
|
||||
Assert.assertNotNull(oneId);
|
||||
}
|
||||
|
||||
@Test(priority = 2, enabled = false)
|
||||
public void testGet() throws RepositoryException, IOException {
|
||||
Object bean = bridge.get(oneId);
|
||||
|
||||
Assert.assertEquals(hlb, bean);
|
||||
}
|
||||
|
||||
@Test(priority = 3, enabled = false)
|
||||
public void testList() throws RepositoryException {
|
||||
List<String> list = IteratorUtils.toList(bridge.list().iterator());
|
||||
|
||||
Assert.assertEquals(list.size(), 1);
|
||||
Assert.assertEquals(list.get(0), oneId);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#BridgeManager.activebridges denotes which bridge defintions to load from the classpath (Comma seperated list of fully qualified class paths)
|
||||
#
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#BridgeManager.activebridges denotes which bridge defintions to load from the classpath (Comma seperated list of fully qualified class paths)
|
||||
#
|
||||
BridgeManager.activeBridges=org.apache.hadoop.metadata.bridge.hivelineage.HiveLineageBridge
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#BridgeManager.activebridges denotes which bridge defintions to load from the classpath (Comma seperated list of fully qualified class paths)
|
||||
#
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#BridgeManager.activebridges denotes which bridge defintions to load from the classpath (Comma seperated list of fully qualified class paths)
|
||||
#
|
||||
BridgeManager.activeBridges=org.apache.hadoop.metadata.bridge.HiveLineage
|
||||
|
|
@ -24,12 +24,12 @@
|
|||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<artifactId>metadata-governance</artifactId>
|
||||
<version>0.1-incubating-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>metadata-bridge-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>metadata-bridge-core</module>
|
||||
<module>metadata-bridge-hive</module>
|
||||
<module>metadata-bridge</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
target
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.hadoop.metadata</groupId>
|
||||
<artifactId>metadata-bridge-parent</artifactId>
|
||||
<version>0.1-incubating-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>metadata-bridge</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>metadata-bridge-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>metadata-bridge-hive</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
43
pom.xml
43
pom.xml
|
|
@ -80,8 +80,6 @@
|
|||
<tinkerpop.version>2.5.0</tinkerpop.version>
|
||||
<titan.version>0.5.3</titan.version>
|
||||
<hadoop.version>2.5.0</hadoop.version>
|
||||
<hive.version>0.14.0</hive.version>
|
||||
<falcon.version>0.6.0.2.2.0.0-2041</falcon.version>
|
||||
|
||||
<!-- scala versions -->
|
||||
<scala.version>2.10.4</scala.version>
|
||||
|
|
@ -206,7 +204,6 @@
|
|||
<module>webapp</module>
|
||||
<module>docs</module>
|
||||
<module>tools</module>
|
||||
<module>metadata-bridge-parent</module>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
|
|
@ -267,39 +264,6 @@
|
|||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- hive -->
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-metastore</artifactId>
|
||||
<version>${hive.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-avatica</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-exec</artifactId>
|
||||
<version>${hive.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-avatica</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.calcite</groupId>
|
||||
<artifactId>calcite-avatica</artifactId>
|
||||
|
|
@ -312,12 +276,6 @@
|
|||
<version>0.9.2-incubating</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.falcon</groupId>
|
||||
<artifactId>falcon-client</artifactId>
|
||||
<version>${falcon.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jsp-2.1</artifactId>
|
||||
|
|
@ -932,7 +890,6 @@
|
|||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
<forkMode>always</forkMode>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,221 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<xsl:output method="html" indent="yes"/>
|
||||
<xsl:decimal-format decimal-separator="." grouping-separator=","/>
|
||||
|
||||
<xsl:key name="files" match="file" use="@name"/>
|
||||
|
||||
<!-- Checkstyle XML Style Sheet by Stephane Bailliez <sbailliez@apache.org> -->
|
||||
<!-- Part of the Checkstyle distribution found at http://checkstyle.sourceforge.net -->
|
||||
<!-- Usage (generates checkstyle_report.html): -->
|
||||
<!-- <checkstyle failonviolation="false" config="${check.config}"> -->
|
||||
<!-- <fileset dir="${src.dir}" includes="**/*.java"/> -->
|
||||
<!-- <formatter type="xml" toFile="${doc.dir}/checkstyle_report.xml"/> -->
|
||||
<!-- </checkstyle> -->
|
||||
<!-- <style basedir="${doc.dir}" destdir="${doc.dir}" -->
|
||||
<!-- includes="checkstyle_report.xml" -->
|
||||
<!-- style="${doc.dir}/checkstyle-noframes-sorted.xsl"/> -->
|
||||
|
||||
<xsl:template match="checkstyle">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
.bannercell {
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
body {
|
||||
margin-left: 10;
|
||||
margin-right: 10;
|
||||
font:normal 80% arial,helvetica,sanserif;
|
||||
background-color:#FFFFFF;
|
||||
color:#000000;
|
||||
}
|
||||
.a td {
|
||||
background: #efefef;
|
||||
}
|
||||
.b td {
|
||||
background: #fff;
|
||||
}
|
||||
th, td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
th {
|
||||
font-weight:bold;
|
||||
background: #ccc;
|
||||
color: black;
|
||||
}
|
||||
table, th, td {
|
||||
font-size:100%;
|
||||
border: none
|
||||
}
|
||||
table.log tr td, tr th {
|
||||
|
||||
}
|
||||
h2 {
|
||||
font-weight:bold;
|
||||
font-size:140%;
|
||||
margin-bottom: 5;
|
||||
}
|
||||
h3 {
|
||||
font-size:100%;
|
||||
font-weight:bold;
|
||||
background: #525D76;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 5px;
|
||||
margin-right: 2px;
|
||||
margin-left: 2px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a name="top"></a>
|
||||
<!-- jakarta logo -->
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="bannercell" rowspan="2">
|
||||
<!--a href="http://jakarta.apache.org/">
|
||||
<img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
|
||||
</a-->
|
||||
</td>
|
||||
<td class="text-align:right">
|
||||
<h2>CheckStyle Audit</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-align:right">Designed for use with
|
||||
<a href='http://checkstyle.sourceforge.net/'>CheckStyle</a>
|
||||
and<a href='http://jakarta.apache.org'>Ant</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1"/>
|
||||
|
||||
<!-- Summary part -->
|
||||
<xsl:apply-templates select="." mode="summary"/>
|
||||
<hr size="1" width="100%" align="left"/>
|
||||
|
||||
<!-- Package List part -->
|
||||
<xsl:apply-templates select="." mode="filelist"/>
|
||||
<hr size="1" width="100%" align="left"/>
|
||||
|
||||
<!-- For each package create its part -->
|
||||
<xsl:apply-templates
|
||||
select="file[@name and generate-id(.) = generate-id(key('files', @name))]"/>
|
||||
|
||||
<hr size="1" width="100%" align="left"/>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="checkstyle" mode="filelist">
|
||||
<h3>Files</h3>
|
||||
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Errors</th>
|
||||
</tr>
|
||||
<xsl:for-each
|
||||
select="file[@name and generate-id(.) = generate-id(key('files', @name))]">
|
||||
<xsl:sort data-type="number" order="descending"
|
||||
select="count(key('files', @name)/error)"/>
|
||||
<xsl:variable name="errorCount" select="count(error)"/>
|
||||
<tr>
|
||||
<xsl:call-template name="alternated-row"/>
|
||||
<td>
|
||||
<a href="#f-{@name}">
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$errorCount"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="file">
|
||||
<a name="f-{@name}"></a>
|
||||
<h3>File
|
||||
<xsl:value-of select="@name"/>
|
||||
</h3>
|
||||
|
||||
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
||||
<tr>
|
||||
<th>Error Description</th>
|
||||
<th>Line</th>
|
||||
</tr>
|
||||
<xsl:for-each select="key('files', @name)/error">
|
||||
<xsl:sort data-type="number" order="ascending" select="@line"/>
|
||||
<tr>
|
||||
<xsl:call-template name="alternated-row"/>
|
||||
<td>
|
||||
<xsl:value-of select="@message"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="@line"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
<a href="#top">Back to top</a>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="checkstyle" mode="summary">
|
||||
<h3>Summary</h3>
|
||||
<xsl:variable name="fileCount"
|
||||
select="count(file[@name and generate-id(.) = generate-id(key('files', @name))])"/>
|
||||
<xsl:variable name="errorCount" select="count(file/error)"/>
|
||||
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
||||
<tr>
|
||||
<th>Files</th>
|
||||
<th>Errors</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<xsl:call-template name="alternated-row"/>
|
||||
<td>
|
||||
<xsl:value-of select="$fileCount"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="$errorCount"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="alternated-row">
|
||||
<xsl:attribute name="class">
|
||||
<xsl:if test="position() mod 2 = 1">a</xsl:if>
|
||||
<xsl:if test="position() mod 2 = 0">b</xsl:if>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<!--
|
||||
|
||||
Checkstyle configuration for Falcon that is based on the sun_checks.xml file
|
||||
Checkstyle configuration for Metadata that is based on the sun_checks.xml file
|
||||
that is bundled with Checkstyle and includes checks for:
|
||||
|
||||
- the Java Language Specification at
|
||||
|
|
@ -210,7 +210,7 @@
|
|||
This generates too many false-positives on wrapped 'throws' clauses
|
||||
to be really useful. Disabled for now.
|
||||
|
||||
Falcon style is:
|
||||
Metadata style is:
|
||||
* Spaces, not tabs.
|
||||
* Indent by four spaces.
|
||||
* Indent by four spaces when wrapping a line.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<FindBugsFilter>
|
||||
<!--
|
||||
Disable encoding as this might give an impression that DGI code base is
|
||||
"Internationalization" ready, but we haven't done anything consciously to guarantee that.
|
||||
-->
|
||||
<Match>
|
||||
<Bug pattern="DM_DEFAULT_ENCODING"/>
|
||||
</Match>
|
||||
</FindBugsFilter>
|
||||
|
|
@ -147,11 +147,6 @@
|
|||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-metastore</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@
|
|||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
<configuration>
|
||||
<skip>${skipTests}</skip>
|
||||
<skip>${skipITs}</skip>
|
||||
<!--only skip int tests -->
|
||||
<connectors>
|
||||
<!--
|
||||
|
|
@ -291,6 +291,10 @@
|
|||
<contextPath>/</contextPath>
|
||||
<useTestClasspath>true</useTestClasspath>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>metadata.log.dir</name>
|
||||
<value>${project.build.directory}/logs</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>keystore.file</name>
|
||||
<value>
|
||||
|
|
|
|||
Loading…
Reference in New Issue