http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/customer_table.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/customer_table.xml b/lens-examples/src/main/resources/customer_table.xml index af308c2..28067bb 100644 --- a/lens-examples/src/main/resources/customer_table.xml +++ b/lens-examples/src/main/resources/customer_table.xml @@ -22,12 +22,12 @@ <x_dimension_table dimension_name="customer" table_name="customer_table" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="name" name="name" type="STRING"/> - <column comment="" name="gender" type="STRING"/> - <column comment="" name="age" type="INT"/> - <column comment="" name="city_id" type="INT"/> - <column comment="" name="customer_credit_status" type="STRING"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="name" name="name" _type="STRING"/> + <column comment="" name="gender" _type="STRING"/> + <column comment="" name="age" _type="INT"/> + <column comment="" name="city_id" _type="INT"/> + <column comment="" name="customer_credit_status" _type="STRING"/> </columns> <properties> <property name="dim4.prop" value="d1"/> @@ -40,7 +40,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/customer"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc>
http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/dim_table.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/dim_table.xml b/lens-examples/src/main/resources/dim_table.xml index 10c9ac0..7659555 100644 --- a/lens-examples/src/main/resources/dim_table.xml +++ b/lens-examples/src/main/resources/dim_table.xml @@ -22,10 +22,10 @@ <x_dimension_table dimension_name="sample_dim" table_name="dim_table" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="name" name="name" type="STRING"/> - <column comment="more details" name="detail" type="STRING"/> - <column comment="d2 ID" name="d2id" type="INT"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="name" name="name" _type="STRING"/> + <column comment="more details" name="detail" _type="STRING"/> + <column comment="d2 ID" name="d2id" _type="INT"/> </columns> <properties> <property name="dim1.prop" value="d1"/> @@ -38,7 +38,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/dim1"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/dim_table2.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/dim_table2.xml b/lens-examples/src/main/resources/dim_table2.xml index e72f9c5..3a449c4 100644 --- a/lens-examples/src/main/resources/dim_table2.xml +++ b/lens-examples/src/main/resources/dim_table2.xml @@ -22,9 +22,9 @@ <x_dimension_table dimension_name="sample_dim2" table_name="dim_table2" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="name" name="name" type="STRING"/> - <column comment="more details for dim2" name="detail2" type="STRING"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="name" name="name" _type="STRING"/> + <column comment="more details for dim2" name="detail2" _type="STRING"/> </columns> <properties> <property name="dim2.prop" value="d2"/> @@ -37,7 +37,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/dim2"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/dim_table3.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/dim_table3.xml b/lens-examples/src/main/resources/dim_table3.xml index 7955426..4f67af8 100644 --- a/lens-examples/src/main/resources/dim_table3.xml +++ b/lens-examples/src/main/resources/dim_table3.xml @@ -22,10 +22,10 @@ <x_dimension_table dimension_name="sample_db_dim" table_name="dim_table3" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="name" name="name" type="STRING"/> - <column comment="more details" name="detail" type="STRING"/> - <column comment="d2 ID" name="d2id" type="INT"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="name" name="name" _type="STRING"/> + <column comment="more details" name="detail" _type="STRING"/> + <column comment="d2 ID" name="d2id" _type="INT"/> </columns> <properties> <property name="dim3.prop" value="d1"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/dim_table4.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/dim_table4.xml b/lens-examples/src/main/resources/dim_table4.xml index 9de1cd7..56c22b3 100644 --- a/lens-examples/src/main/resources/dim_table4.xml +++ b/lens-examples/src/main/resources/dim_table4.xml @@ -22,10 +22,10 @@ <x_dimension_table dimension_name="sample_dim" table_name="dim_table4" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="name" name="name" type="STRING"/> - <column comment="more details" name="detail" type="STRING"/> - <column comment="d2 ID" name="d2id" type="INT"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="name" name="name" _type="STRING"/> + <column comment="more details" name="detail" _type="STRING"/> + <column comment="d2 ID" name="d2id" _type="INT"/> </columns> <properties> <property name="dim4.prop" value="d1"/> @@ -38,7 +38,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/dim4"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/fact1.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/fact1.xml b/lens-examples/src/main/resources/fact1.xml index c934a64..effdfac 100644 --- a/lens-examples/src/main/resources/fact1.xml +++ b/lens-examples/src/main/resources/fact1.xml @@ -22,10 +22,10 @@ <x_fact_table cube_name="sample_cube" name="fact1" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="dim1" type="INT"/> - <column comment="" name="measure2" type="BIGINT"/> - <column comment="" name="measure3" type="INT"/> - <column comment="" name="measure4" type="FLOAT"/> + <column comment="" name="dim1" _type="INT"/> + <column comment="" name="measure2" _type="BIGINT"/> + <column comment="" name="measure3" _type="INT"/> + <column comment="" name="measure4" _type="FLOAT"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="true"/> @@ -39,7 +39,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/fact1_local"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/fact2.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/fact2.xml b/lens-examples/src/main/resources/fact2.xml index 3298fc1..f1633f3 100644 --- a/lens-examples/src/main/resources/fact2.xml +++ b/lens-examples/src/main/resources/fact2.xml @@ -22,11 +22,11 @@ <x_fact_table cube_name="sample_cube" name="fact2" weight="200.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="dim1" type="INT"/> - <column comment="" name="dim3" type="INT"/> - <column comment="" name="measure2" type="INT"/> - <column comment="" name="measure3" type="FLOAT"/> - <column comment="" name="measure4" type="FLOAT"/> + <column comment="" name="dim1" _type="INT"/> + <column comment="" name="dim3" _type="INT"/> + <column comment="" name="measure2" _type="INT"/> + <column comment="" name="measure3" _type="FLOAT"/> + <column comment="" name="measure4" _type="FLOAT"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="true"/> @@ -40,7 +40,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/fact2_local"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/product.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/product.xml b/lens-examples/src/main/resources/product.xml index bb91997..2ab07f1 100644 --- a/lens-examples/src/main/resources/product.xml +++ b/lens-examples/src/main/resources/product.xml @@ -22,16 +22,16 @@ <x_dimension name="product" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <attributes> - <dim_attribute name="id" type="INT"/> - <dim_attribute name="SKU_number" type="INT" /> - <dim_attribute name="description" type="STRING" /> - <dim_attribute name="color" type="STRING" /> - <dim_attribute name="weight" type="FLOAT" /> - <dim_attribute name="category" type="STRING" /> - <dim_attribute name="manufacturer" type="STRING" /> + <dim_attribute name="id" _type="INT"/> + <dim_attribute name="SKU_number" _type="INT" /> + <dim_attribute name="description" _type="STRING" /> + <dim_attribute name="color" _type="STRING" /> + <dim_attribute name="weight" _type="FLOAT" /> + <dim_attribute name="category" _type="STRING" /> + <dim_attribute name="manufacturer" _type="STRING" /> </attributes> <expressions> - <expression name="isHeavy" type="boolean"> + <expression name="isHeavy" _type="boolean"> <expr_spec expr = "weight > 10" end_time="2015-04-12T00:00:00"/> <expr_spec expr = "weight > 50" start_time="2015-04-12T00:00:00"/> </expression> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/product_db_table.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/product_db_table.xml b/lens-examples/src/main/resources/product_db_table.xml index 867d37b..dabb008 100644 --- a/lens-examples/src/main/resources/product_db_table.xml +++ b/lens-examples/src/main/resources/product_db_table.xml @@ -22,13 +22,13 @@ <x_dimension_table dimension_name="product" table_name="product_db_table" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="SKU_number" name="SKU_number" type="INT"/> - <column comment="" name="description" type="STRING"/> - <column comment="" name="color" type="STRING"/> - <column comment="Category" name="category" type="STRING"/> - <column comment="" name="weight" type="FLOAT"/> - <column comment="" name="manufacturer" type="STRING"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="SKU_number" name="SKU_number" _type="INT"/> + <column comment="" name="description" _type="STRING"/> + <column comment="" name="color" _type="STRING"/> + <column comment="Category" name="category" _type="STRING"/> + <column comment="" name="weight" _type="FLOAT"/> + <column comment="" name="manufacturer" _type="STRING"/> </columns> <properties> <property name="dim4.prop" value="d1"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/product_table.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/product_table.xml b/lens-examples/src/main/resources/product_table.xml index 303f3ad..e039c0d 100644 --- a/lens-examples/src/main/resources/product_table.xml +++ b/lens-examples/src/main/resources/product_table.xml @@ -22,12 +22,12 @@ <x_dimension_table dimension_name="product" table_name="product_table" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="ID" name="id" type="INT"/> - <column comment="SKU_number" name="SKU_number" type="INT"/> - <column comment="" name="description" type="STRING"/> - <column comment="" name="color" type="STRING"/> - <column comment="" name="weight" type="FLOAT"/> - <column comment="" name="manufacturer" type="STRING"/> + <column comment="ID" name="id" _type="INT"/> + <column comment="SKU_number" name="SKU_number" _type="INT"/> + <column comment="" name="description" _type="STRING"/> + <column comment="" name="color" _type="STRING"/> + <column comment="" name="weight" _type="FLOAT"/> + <column comment="" name="manufacturer" _type="STRING"/> </columns> <properties> <property name="dim4.prop" value="d1"/> @@ -41,8 +41,8 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/product"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> - <column comment="Category" name="category" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> + <column comment="Category" name="category" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/rawfact.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/rawfact.xml b/lens-examples/src/main/resources/rawfact.xml index 8191eb2..65e27b6 100644 --- a/lens-examples/src/main/resources/rawfact.xml +++ b/lens-examples/src/main/resources/rawfact.xml @@ -22,13 +22,13 @@ <x_fact_table cube_name="sample_cube" name="rawfact" weight="500.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="dim1" type="INT"/> - <column comment="" name="dim2" type="INT"/> - <column comment="" name="dim3" type="INT"/> - <column comment="" name="measure1" type="BIGINT"/> - <column comment="" name="measure2" type="INT"/> - <column comment="" name="measure3" type="FLOAT"/> - <column comment="" name="measure4" type="FLOAT"/> + <column comment="" name="dim1" _type="INT"/> + <column comment="" name="dim2" _type="INT"/> + <column comment="" name="dim3" _type="INT"/> + <column comment="" name="measure1" _type="BIGINT"/> + <column comment="" name="measure2" _type="INT"/> + <column comment="" name="measure3" _type="FLOAT"/> + <column comment="" name="measure4" _type="FLOAT"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="false"/> @@ -42,7 +42,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/rawfact"> <part_cols> - <column comment="Time column" name="dt" type="STRING"/> + <column comment="Time column" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sales-aggr-continuous-fact.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sales-aggr-continuous-fact.xml b/lens-examples/src/main/resources/sales-aggr-continuous-fact.xml index 781a615..74f1686 100644 --- a/lens-examples/src/main/resources/sales-aggr-continuous-fact.xml +++ b/lens-examples/src/main/resources/sales-aggr-continuous-fact.xml @@ -22,19 +22,19 @@ <x_fact_table cube_name="sales" name="sales_aggr_continuous_fact" weight="50.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="order_time" type="TIMESTAMP"/> - <column comment="" name="delivery_time" type="TIMESTAMP"/> - <column comment="" name="customer_id" type="INT"/> - <column comment="" name="product_id" type="INT"/> - <column comment="" name="promotion_id" type="INT"/> - <column comment="" name="customer_city_id" type="INT"/> - <column comment="" name="production_city_id" type="INT"/> - <column comment="" name="delivery_city_id" type="INT"/> - <column comment="" name="unit_sales" type="BIGINT"/> - <column comment="" name="store_sales" type="DOUBLE"/> - <column comment="" name="store_cost" type="DOUBLE"/> - <column comment="" name="max_line_item_price" type="FLOAT"/> - <column comment="" name="max_line_item_discount" type="FLOAT"/> + <column comment="" name="order_time" _type="TIMESTAMP"/> + <column comment="" name="delivery_time" _type="TIMESTAMP"/> + <column comment="" name="customer_id" _type="INT"/> + <column comment="" name="product_id" _type="INT"/> + <column comment="" name="promotion_id" _type="INT"/> + <column comment="" name="customer_city_id" _type="INT"/> + <column comment="" name="production_city_id" _type="INT"/> + <column comment="" name="delivery_city_id" _type="INT"/> + <column comment="" name="unit_sales" _type="BIGINT"/> + <column comment="" name="store_sales" _type="DOUBLE"/> + <column comment="" name="store_cost" _type="DOUBLE"/> + <column comment="" name="max_line_item_price" _type="FLOAT"/> + <column comment="" name="max_line_item_discount" _type="FLOAT"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="true"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sales-aggr-fact1.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sales-aggr-fact1.xml b/lens-examples/src/main/resources/sales-aggr-fact1.xml index 728c775..9ced07b 100644 --- a/lens-examples/src/main/resources/sales-aggr-fact1.xml +++ b/lens-examples/src/main/resources/sales-aggr-fact1.xml @@ -22,19 +22,19 @@ <x_fact_table cube_name="sales" name="sales_aggr_fact1" weight="300.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="order_time" type="TIMESTAMP"/> - <column comment="" name="delivery_time" type="TIMESTAMP"/> - <column comment="" name="customer_id" type="INT"/> - <column comment="" name="product_id" type="INT"/> - <column comment="" name="promotion_id" type="INT"/> - <column comment="" name="customer_city_id" type="INT"/> - <column comment="" name="production_city_id" type="INT"/> - <column comment="" name="delivery_city_id" type="INT"/> - <column comment="" name="unit_sales" type="BIGINT"/> - <column comment="" name="store_sales" type="DOUBLE"/> - <column comment="" name="store_cost" type="DOUBLE"/> - <column comment="" name="max_line_item_price" type="FLOAT"/> - <column comment="" name="max_line_item_discount" type="FLOAT"/> + <column comment="" name="order_time" _type="TIMESTAMP"/> + <column comment="" name="delivery_time" _type="TIMESTAMP"/> + <column comment="" name="customer_id" _type="INT"/> + <column comment="" name="product_id" _type="INT"/> + <column comment="" name="promotion_id" _type="INT"/> + <column comment="" name="customer_city_id" _type="INT"/> + <column comment="" name="production_city_id" _type="INT"/> + <column comment="" name="delivery_city_id" _type="INT"/> + <column comment="" name="unit_sales" _type="BIGINT"/> + <column comment="" name="store_sales" _type="DOUBLE"/> + <column comment="" name="store_cost" _type="DOUBLE"/> + <column comment="" name="max_line_item_price" _type="FLOAT"/> + <column comment="" name="max_line_item_discount" _type="FLOAT"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="true"/> @@ -48,9 +48,9 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/aggrfact1"> <part_cols> - <column comment="Process time partition" name="pt" type="STRING"/> - <column comment="Order time partition" name="ot" type="STRING"/> - <column comment="Delivery time partition" name="dt" type="STRING"/> + <column comment="Process time partition" name="pt" _type="STRING"/> + <column comment="Order time partition" name="ot" _type="STRING"/> + <column comment="Delivery time partition" name="dt" _type="STRING"/> </part_cols> <time_part_cols>pt</time_part_cols> <time_part_cols>ot</time_part_cols> @@ -65,9 +65,9 @@ <table_desc external="true" field_delimiter="," table_location="/tmp/db-storage.db" storage_handler_name="org.apache.lens.storage.db.DBStorageHandler"> <part_cols> - <column comment="Process time partition" name="pt" type="STRING"/> - <column comment="Order time partition" name="ot" type="STRING"/> - <column comment="Delivery time partition" name="dt" type="STRING"/> + <column comment="Process time partition" name="pt" _type="STRING"/> + <column comment="Order time partition" name="ot" _type="STRING"/> + <column comment="Delivery time partition" name="dt" _type="STRING"/> </part_cols> <table_parameters> <property name="lens.metastore.native.db.name" value="default"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sales-aggr-fact2.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sales-aggr-fact2.xml b/lens-examples/src/main/resources/sales-aggr-fact2.xml index 61edf64..b0038f8 100644 --- a/lens-examples/src/main/resources/sales-aggr-fact2.xml +++ b/lens-examples/src/main/resources/sales-aggr-fact2.xml @@ -22,16 +22,16 @@ <x_fact_table cube_name="sales" name="sales_aggr_fact2" weight="100.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="order_time" type="TIMESTAMP"/> - <column comment="" name="delivery_time" type="TIMESTAMP"/> - <column comment="" name="product_id" type="INT"/> - <column comment="" name="promotion_id" type="INT"/> - <column comment="" name="customer_city_id" type="INT"/> - <column comment="" name="production_city_id" type="INT"/> - <column comment="" name="delivery_city_id" type="INT"/> - <column comment="" name="unit_sales" type="BIGINT"/> - <column comment="" name="store_sales" type="DOUBLE"/> - <column comment="" name="store_cost" type="DOUBLE"/> + <column comment="" name="order_time" _type="TIMESTAMP"/> + <column comment="" name="delivery_time" _type="TIMESTAMP"/> + <column comment="" name="product_id" _type="INT"/> + <column comment="" name="promotion_id" _type="INT"/> + <column comment="" name="customer_city_id" _type="INT"/> + <column comment="" name="production_city_id" _type="INT"/> + <column comment="" name="delivery_city_id" _type="INT"/> + <column comment="" name="unit_sales" _type="BIGINT"/> + <column comment="" name="store_sales" _type="DOUBLE"/> + <column comment="" name="store_cost" _type="DOUBLE"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="true"/> @@ -46,7 +46,7 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/aggrfact2"> <part_cols> - <column comment="Delivery time partition" name="dt" type="STRING"/> + <column comment="Delivery time partition" name="dt" _type="STRING"/> </part_cols> <time_part_cols>dt</time_part_cols> </table_desc> @@ -59,9 +59,9 @@ <table_desc external="true" field_delimiter="," table_location="/tmp/db-storage.db" storage_handler_name="org.apache.lens.storage.db.DBStorageHandler"> <part_cols> - <column comment="Process time partition" name="pt" type="STRING"/> - <column comment="Order time partition" name="ot" type="STRING"/> - <column comment="Delivery time partition" name="dt" type="STRING"/> + <column comment="Process time partition" name="pt" _type="STRING"/> + <column comment="Order time partition" name="ot" _type="STRING"/> + <column comment="Delivery time partition" name="dt" _type="STRING"/> </part_cols> <table_parameters> <property name="lens.metastore.native.db.name" value="default"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sales-cube.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sales-cube.xml b/lens-examples/src/main/resources/sales-cube.xml index e9e48ce..e944821 100644 --- a/lens-examples/src/main/resources/sales-cube.xml +++ b/lens-examples/src/main/resources/sales-cube.xml @@ -29,57 +29,57 @@ <!-- means dt-20days <= ot <= dt-1hour --> </properties> <measures> - <measure name="unit_sales" type="BIGINT" default_aggr="SUM" display_string="Unit Sales" format_string="#,###"/> - <measure name="store_sales" type="DOUBLE" default_aggr="SUM" display_string="Store Sales" format_string="#,###.##"/> - <measure name="store_cost" type="DOUBLE" default_aggr="SUM" display_string="Store Cost" format_string="#,###.00" + <measure name="unit_sales" _type="BIGINT" default_aggr="SUM" display_string="Unit Sales" format_string="#,###"/> + <measure name="store_sales" _type="DOUBLE" default_aggr="SUM" display_string="Store Sales" format_string="#,###.##"/> + <measure name="store_cost" _type="DOUBLE" default_aggr="SUM" display_string="Store Cost" format_string="#,###.00" start_time='2015-03-01T00:00:00' /> - <measure name="line_item_quantity" type="INT" default_aggr="SUM" display_string="Line item quantity"/> - <measure name="line_item_product_price" type="FLOAT" default_aggr="SUM" display_string="Line item product price"/> - <measure name="line_item_discount_amount" type="FLOAT" default_aggr="SUM" display_string="Line item discount"/> - <measure name="line_item_tax" type="FLOAT" default_aggr="SUM" display_string="Line item tax"/> - <measure name="max_line_item_price" type="FLOAT" default_aggr="MAX" display_string="Maximum Line item price"/> - <measure name="max_line_item_discount" type="FLOAT" default_aggr="MAX" + <measure name="line_item_quantity" _type="INT" default_aggr="SUM" display_string="Line item quantity"/> + <measure name="line_item_product_price" _type="FLOAT" default_aggr="SUM" display_string="Line item product price"/> + <measure name="line_item_discount_amount" _type="FLOAT" default_aggr="SUM" display_string="Line item discount"/> + <measure name="line_item_tax" _type="FLOAT" default_aggr="SUM" display_string="Line item tax"/> + <measure name="max_line_item_price" _type="FLOAT" default_aggr="MAX" display_string="Maximum Line item price"/> + <measure name="max_line_item_discount" _type="FLOAT" default_aggr="MAX" display_string="Maximum Line item discount"/> - <measure name="rating" type="FLOAT" default_aggr="AVG" + <measure name="rating" _type="FLOAT" default_aggr="AVG" display_string="Rating"/> </measures> <dim_attributes> - <dim_attribute name="customer_id" type="INT" /> - <dim_attribute name="product_id" type="INT" /> - <dim_attribute name="promotion_id" type="INT" /> - <dim_attribute name="order_id" type="INT" /> - <dim_attribute name="order_line_number" type="INT" /> - <dim_attribute name="order_time" type="TIMESTAMP" /> - <dim_attribute name="delivery_time" type="TIMESTAMP" /> - <dim_attribute name="customer_city_id" type="INT" start_time='2015-03-01T00:00:00' /> - <dim_attribute name="production_city_id" type="INT" /> - <dim_attribute name="delivery_city_id" type="INT" /> - <dim_attribute name="customer_city_name" type="string" description="City name to which the customer belongs" + <dim_attribute name="customer_id" _type="INT" /> + <dim_attribute name="product_id" _type="INT" /> + <dim_attribute name="promotion_id" _type="INT" /> + <dim_attribute name="order_id" _type="INT" /> + <dim_attribute name="order_line_number" _type="INT" /> + <dim_attribute name="order_time" _type="TIMESTAMP" /> + <dim_attribute name="delivery_time" _type="TIMESTAMP" /> + <dim_attribute name="customer_city_id" _type="INT" start_time='2015-03-01T00:00:00' /> + <dim_attribute name="production_city_id" _type="INT" /> + <dim_attribute name="delivery_city_id" _type="INT" /> + <dim_attribute name="customer_city_name" _type="string" description="City name to which the customer belongs" display_string="Customer City"> <chain_ref_column chain_name="customer_city" ref_col="name" /> </dim_attribute> <dim_attribute name="production_location"> <hierarchy> - <dim_attribute name="production_city_name" type="STRING" description="City name in which the product was produced" + <dim_attribute name="production_city_name" _type="STRING" description="City name in which the product was produced" display_string="Production City"> <chain_ref_column chain_name="production_city" ref_col="name" /> </dim_attribute> - <dim_attribute name="production_state" type="STRING" description="State name in which the product was produced" + <dim_attribute name="production_state" _type="STRING" description="State name in which the product was produced" display_string="Production State"/> - <dim_attribute name="production_country" type="STRING" description="Country name in which the product was produced" + <dim_attribute name="production_country" _type="STRING" description="Country name in which the product was produced" display_string="Production Country"/> </hierarchy> </dim_attribute> - <dim_attribute name="delivery_city_name" type="STRING" description="City name to which the product was delivered" + <dim_attribute name="delivery_city_name" _type="STRING" description="City name to which the product was delivered" display_string="Delivery City"> <chain_ref_column chain_name="delivery_city" ref_col="name" /> </dim_attribute> </dim_attributes> <expressions> - <expression name="profit" type="DOUBLE" display_string="Profit"> + <expression name="profit" _type="DOUBLE" display_string="Profit"> <expr_spec expr="store_sales - store_cost"/> </expression> - <expression name="promotion_sales" type="DOUBLE" display_string="Promotion sales"> + <expression name="promotion_sales" _type="DOUBLE" display_string="Promotion sales"> <expr_spec expr="sum(case when promotion_id = 0 then 0 else store_sales end)" start_time='2015-04-12T00:00:00'/> <expr_spec expr="sum(case when promotion_id = -1 then 0 when promotion_id = -1 then 0 else store_sales end)" end_time="2015-04-12T00:00:00"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sales-raw-fact.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sales-raw-fact.xml b/lens-examples/src/main/resources/sales-raw-fact.xml index 4c2d571..05d925b 100644 --- a/lens-examples/src/main/resources/sales-raw-fact.xml +++ b/lens-examples/src/main/resources/sales-raw-fact.xml @@ -22,23 +22,23 @@ <x_fact_table cube_name="sales" name="sales_raw_fact" weight="500.0" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <columns> - <column comment="" name="order_time" type="TIMESTAMP"/> - <column comment="" name="delivery_time" type="TIMESTAMP"/> - <column comment="" name="customer_id" type="INT"/> - <column comment="" name="product_id" type="INT"/> - <column comment="" name="order_id" type="INT"/> - <column comment="" name="promotion_id" type="INT"/> - <column comment="" name="order_line_number" type="INT"/> - <column comment="" name="customer_city_id" type="INT"/> - <column comment="" name="production_city_id" type="INT"/> - <column comment="" name="delivery_city_id" type="INT"/> - <column comment="" name="unit_sales" type="BIGINT"/> - <column comment="" name="store_sales" type="DOUBLE"/> - <column comment="" name="store_cost" type="DOUBLE"/> - <column comment="" name="line_item_quantity" type="INT"/> - <column comment="" name="line_item_product_price" type="INT"/> - <column comment="" name="line_item_discount_amount" type="INT"/> - <column comment="" name="line_item_tax" type="INT"/> + <column comment="" name="order_time" _type="TIMESTAMP"/> + <column comment="" name="delivery_time" _type="TIMESTAMP"/> + <column comment="" name="customer_id" _type="INT"/> + <column comment="" name="product_id" _type="INT"/> + <column comment="" name="order_id" _type="INT"/> + <column comment="" name="promotion_id" _type="INT"/> + <column comment="" name="order_line_number" _type="INT"/> + <column comment="" name="customer_city_id" _type="INT"/> + <column comment="" name="production_city_id" _type="INT"/> + <column comment="" name="delivery_city_id" _type="INT"/> + <column comment="" name="unit_sales" _type="BIGINT"/> + <column comment="" name="store_sales" _type="DOUBLE"/> + <column comment="" name="store_cost" _type="DOUBLE"/> + <column comment="" name="line_item_quantity" _type="INT"/> + <column comment="" name="line_item_product_price" _type="INT"/> + <column comment="" name="line_item_discount_amount" _type="INT"/> + <column comment="" name="line_item_tax" _type="INT"/> </columns> <properties> <property name="cube.fact.is.aggregated" value="false"/> @@ -51,9 +51,9 @@ <storage_name>local</storage_name> <table_desc external="true" field_delimiter="," table_location="/tmp/examples/rawfact"> <part_cols> - <column comment="Process time partition" name="pt" type="STRING"/> - <column comment="Order time partition" name="ot" type="STRING"/> - <column comment="Delivery time partition" name="dt" type="STRING"/> + <column comment="Process time partition" name="pt" _type="STRING"/> + <column comment="Order time partition" name="ot" _type="STRING"/> + <column comment="Delivery time partition" name="dt" _type="STRING"/> </part_cols> <time_part_cols>pt</time_part_cols> <time_part_cols>ot</time_part_cols> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sample-cube.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sample-cube.xml b/lens-examples/src/main/resources/sample-cube.xml index 3b5abea..4046e82 100644 --- a/lens-examples/src/main/resources/sample-cube.xml +++ b/lens-examples/src/main/resources/sample-cube.xml @@ -25,19 +25,19 @@ <property name="cube.sample_cube.timed.dimensions.list" value="dt"/> </properties> <measures> - <measure name="measure1" type="BIGINT"/> - <measure name="measure2" type="INT" default_aggr="SUM"/> - <measure name="measure3" type="FLOAT" default_aggr="MAX" start_time='2013-12-12T00:00:00'/> - <measure name="measure4" type="DOUBLE" default_aggr="MIN"/> + <measure name="measure1" _type="BIGINT"/> + <measure name="measure2" _type="INT" default_aggr="SUM"/> + <measure name="measure3" _type="FLOAT" default_aggr="MAX" start_time='2013-12-12T00:00:00'/> + <measure name="measure4" _type="DOUBLE" default_aggr="MIN"/> </measures> <dim_attributes> - <dim_attribute name="dim1" type="INT"/> - <dim_attribute name="dim2" type="INT" start_time='2013-12-01T00:00:00'/> - <dim_attribute name="dim3" type="INT"> + <dim_attribute name="dim1" _type="INT"/> + <dim_attribute name="dim2" _type="INT" start_time='2013-12-01T00:00:00'/> + <dim_attribute name="dim3" _type="INT"> </dim_attribute> </dim_attributes> <expressions> - <expression name="expr_msr5" type="DOUBLE"> + <expression name="expr_msr5" _type="DOUBLE"> <expr_spec expr = "measure3 + measure4" start_time='2013-12-12T00:00:00' /> <expr_spec expr = "measure3 + measure4 + 0.01" end_time='2013-12-12T00:00:00'/> </expression> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sample-db-only-dimension.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sample-db-only-dimension.xml b/lens-examples/src/main/resources/sample-db-only-dimension.xml index 2e8aa64..809e66e 100644 --- a/lens-examples/src/main/resources/sample-db-only-dimension.xml +++ b/lens-examples/src/main/resources/sample-db-only-dimension.xml @@ -22,10 +22,10 @@ <x_dimension name="sample_db_dim" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <attributes> - <dim_attribute name="id" type="INT"/> - <dim_attribute name="name" type="STRING"/> - <dim_attribute name="detail" type="STRING" start_time='2013-12-01T00:00:00'/> - <dim_attribute name="d2id" type="INT" start_time='2013-12-01T00:00:00'/> + <dim_attribute name="id" _type="INT"/> + <dim_attribute name="name" _type="STRING"/> + <dim_attribute name="detail" _type="STRING" start_time='2013-12-01T00:00:00'/> + <dim_attribute name="d2id" _type="INT" start_time='2013-12-01T00:00:00'/> </attributes> <join_chains> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sample-dimension.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sample-dimension.xml b/lens-examples/src/main/resources/sample-dimension.xml index 3c2589c..778a4c4 100644 --- a/lens-examples/src/main/resources/sample-dimension.xml +++ b/lens-examples/src/main/resources/sample-dimension.xml @@ -22,10 +22,10 @@ <x_dimension name="sample_dim" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <attributes> - <dim_attribute name="id" type="INT"/> - <dim_attribute name="name" type="STRING"/> - <dim_attribute name="detail" type="STRING" start_time='2013-12-01T00:00:00'/> - <dim_attribute name="d2id" type="INT" start_time='2013-12-01T00:00:00'/> + <dim_attribute name="id" _type="INT"/> + <dim_attribute name="name" _type="STRING"/> + <dim_attribute name="detail" _type="STRING" start_time='2013-12-01T00:00:00'/> + <dim_attribute name="d2id" _type="INT" start_time='2013-12-01T00:00:00'/> </attributes> <join_chains> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-examples/src/main/resources/sample-dimension2.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/sample-dimension2.xml b/lens-examples/src/main/resources/sample-dimension2.xml index 9740507..0f4fad8 100644 --- a/lens-examples/src/main/resources/sample-dimension2.xml +++ b/lens-examples/src/main/resources/sample-dimension2.xml @@ -22,9 +22,9 @@ <x_dimension name="sample_dim2" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> <attributes> - <dim_attribute name="id" type="INT"/> - <dim_attribute name="name" type="STRING"/> - <dim_attribute name="detail2" type="STRING" start_time='2013-12-01T00:00:00'/> + <dim_attribute name="id" _type="INT"/> + <dim_attribute name="name" _type="STRING"/> + <dim_attribute name="detail2" _type="STRING" start_time='2013-12-01T00:00:00'/> </attributes> <properties> <property name="dimension.sample_dim2.timed.dimension" value="dt"/> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-ml-lib/src/main/java/org/apache/lens/ml/server/MLApp.java ---------------------------------------------------------------------- diff --git a/lens-ml-lib/src/main/java/org/apache/lens/ml/server/MLApp.java b/lens-ml-lib/src/main/java/org/apache/lens/ml/server/MLApp.java index e6e3c02..002d420 100644 --- a/lens-ml-lib/src/main/java/org/apache/lens/ml/server/MLApp.java +++ b/lens-ml-lib/src/main/java/org/apache/lens/ml/server/MLApp.java @@ -24,8 +24,11 @@ import java.util.Set; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +import org.apache.lens.api.util.MoxyJsonConfigurationContextResolver; + import org.glassfish.jersey.filter.LoggingFilter; import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.glassfish.jersey.moxy.json.MoxyJsonFeature; @ApplicationPath("/ml") public class MLApp extends Application { @@ -44,6 +47,8 @@ public class MLApp extends Application { classes.add(MLServiceResource.class); classes.add(MultiPartFeature.class); classes.add(LoggingFilter.class); + classes.add(MoxyJsonConfigurationContextResolver.class); + classes.add(MoxyJsonFeature.class); for (Class<?> cls : additionalClasses) { classes.add(cls); } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLRunner.java ---------------------------------------------------------------------- diff --git a/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLRunner.java b/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLRunner.java index ef3d53e..3493709 100644 --- a/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLRunner.java +++ b/lens-ml-lib/src/test/java/org/apache/lens/ml/TestMLRunner.java @@ -39,8 +39,6 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.ql.metadata.Hive; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.media.multipart.MultiPartFeature; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; @@ -48,7 +46,6 @@ import org.testng.annotations.Test; import lombok.extern.slf4j.Slf4j; - @Test @Slf4j public class TestMLRunner extends LensJerseyTest { @@ -71,11 +68,6 @@ public class TestMLRunner extends LensJerseyTest { return UriBuilder.fromUri("http://localhost/").port(getTestPort()).path("/lensapi").build(); } - @Override - protected void configureClient(ClientConfig config) { - config.register(MultiPartFeature.class); - } - @BeforeTest public void setUp() throws Exception { super.setUp(); http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server-api/src/main/java/org/apache/lens/server/api/driver/InMemoryResultSet.java ---------------------------------------------------------------------- diff --git a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/InMemoryResultSet.java b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/InMemoryResultSet.java index f6434da..0d64471 100644 --- a/lens-server-api/src/main/java/org/apache/lens/server/api/driver/InMemoryResultSet.java +++ b/lens-server-api/src/main/java/org/apache/lens/server/api/driver/InMemoryResultSet.java @@ -80,7 +80,7 @@ public abstract class InMemoryResultSet extends LensResultSet { * @see org.apache.lens.server.api.driver.LensResultSet#toQueryResult() */ public InMemoryQueryResult toQueryResult() throws LensException { - List<ResultRow> rows = new ArrayList<ResultRow>(); + List<ResultRow> rows = new ArrayList<>(); while (hasNext()) { rows.add(next()); } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/pom.xml ---------------------------------------------------------------------- diff --git a/lens-server/pom.xml b/lens-server/pom.xml index ba91e76..064197d 100644 --- a/lens-server/pom.xml +++ b/lens-server/pom.xml @@ -126,19 +126,10 @@ <artifactId>jersey-media-multipart</artifactId> </dependency> <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-json-jackson</artifactId> - </dependency> - <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> </dependency> <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-moxy</artifactId> - </dependency> - - <dependency> <groupId>org.glassfish.grizzly</groupId> <artifactId>grizzly-framework</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/BaseApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/BaseApp.java b/lens-server/src/main/java/org/apache/lens/server/BaseApp.java new file mode 100644 index 0000000..07f6837 --- /dev/null +++ b/lens-server/src/main/java/org/apache/lens/server/BaseApp.java @@ -0,0 +1,53 @@ +/** + * 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. + */ +package org.apache.lens.server; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.core.Application; + +import org.apache.lens.api.jaxb.LensJAXBContextResolver; +import org.apache.lens.api.util.MoxyJsonConfigurationContextResolver; +import org.apache.lens.server.error.LensJAXBValidationExceptionMapper; + +import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.glassfish.jersey.moxy.json.MoxyJsonFeature; + +public abstract class BaseApp extends Application { + + @Override + public Set<Class<?>> getClasses() { + final Set<Class<?>> classes = new HashSet<>(); + // register root resource + classes.add(getResource()); + classes.add(MultiPartFeature.class); + classes.add(LensJAXBContextResolver.class); + classes.add(LensJAXBValidationExceptionMapper.class); + classes.add(LensRequestContextInitFilter.class); + classes.add(LoggingFilter.class); + classes.add(LensApplicationListener.class); + classes.add(MoxyJsonConfigurationContextResolver.class); + classes.add(MoxyJsonFeature.class); + return classes; + } + + protected abstract Class getResource(); +} http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/LensServer.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/LensServer.java b/lens-server/src/main/java/org/apache/lens/server/LensServer.java index 61eb37f..092ecda 100644 --- a/lens-server/src/main/java/org/apache/lens/server/LensServer.java +++ b/lens-server/src/main/java/org/apache/lens/server/LensServer.java @@ -121,7 +121,6 @@ public class LensServer { private ResourceConfig getUIApp() { ResourceConfig uiApp = ResourceConfig.forApplicationClass(UIApp.class); - uiApp.register(new LoggingFilter(Logger.getLogger(LensServer.class.getName() + ".ui_request"), true)); uiApp.setApplicationName("Lens UI"); return uiApp; } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/ServerModeFilter.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/ServerModeFilter.java b/lens-server/src/main/java/org/apache/lens/server/ServerModeFilter.java index 630b95e..e87fe46 100644 --- a/lens-server/src/main/java/org/apache/lens/server/ServerModeFilter.java +++ b/lens-server/src/main/java/org/apache/lens/server/ServerModeFilter.java @@ -39,25 +39,28 @@ public class ServerModeFilter implements ContainerRequestFilter { switch (LensServices.get().getServiceMode()) { case READ_ONLY: // Allows all requests on session and only GET everywhere - if (!requestContext.getUriInfo().getPath().startsWith("/session")) { + if (!requestContext.getUriInfo().getPath().startsWith("session")) { if (!requestContext.getMethod().equals("GET")) { - throw new NotAllowedException("Server is in readonly mode", "GET", (String[]) null); + throw new NotAllowedException("Server is in readonly mode. Request on path:" + + requestContext.getUriInfo().getPath(), "GET", (String[]) null); } } break; case METASTORE_READONLY: // Allows GET on metastore and all other requests - if (requestContext.getUriInfo().getPath().startsWith("/metastore")) { + if (requestContext.getUriInfo().getPath().startsWith("metastore")) { if (!requestContext.getMethod().equals("GET")) { - throw new NotAllowedException("Metastore is in readonly mode", "GET", (String[]) null); + throw new NotAllowedException("Metastore is in readonly mode. Request on path:" + + requestContext.getUriInfo().getPath(), "GET", (String[]) null); } } break; case METASTORE_NODROP: // Does not allows DROP on metastore, all other request are allowed - if (requestContext.getUriInfo().getPath().startsWith("/metastore")) { + if (requestContext.getUriInfo().getPath().startsWith("metastore")) { if (requestContext.getMethod().equals("DELETE")) { - throw new NotAllowedException("Metastore is in nodrop mode", "GET", new String[]{"PUT", "POST"}); + throw new NotAllowedException("Metastore is in nodrop mode. Request on path:" + + requestContext.getUriInfo().getPath(), "GET", new String[]{"PUT", "POST"}); } } break; http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java index fc67df1..a1acd1a 100644 --- a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java +++ b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java @@ -701,7 +701,7 @@ public class CubeMetastoreServiceImpl extends BaseLensService implements CubeMet storageName); List<Partition> parts = client.getPartitionsByFilter(storageTableName, filter); List<String> timePartCols = client.getTimePartColNamesOfTable(storageTableName); - return xpartitionListFromPartitionList(parts, timePartCols); + return xpartitionListFromPartitionList(fact, parts, timePartCols); } catch (HiveException exc) { throw new LensException(exc); } finally { @@ -737,31 +737,31 @@ public class CubeMetastoreServiceImpl extends BaseLensService implements CubeMet } } - private CubeDimensionTable checkDimensionStorage(LensSessionHandle sessionid, String dimension, String storage) + private CubeDimensionTable checkDimTableStorage(LensSessionHandle sessionid, String dimTable, String storage) throws HiveException, LensException { CubeMetastoreClient client = getClient(sessionid); - if (!client.isDimensionTable(dimension)) { - throw new NotFoundException("Dimension table not found: " + dimension); + if (!client.isDimensionTable(dimTable)) { + throw new NotFoundException("Dimension table not found: " + dimTable); } - CubeDimensionTable cdt = client.getDimensionTable(dimension); + CubeDimensionTable cdt = client.getDimensionTable(dimTable); if (!cdt.getStorages().contains(storage)) { - throw new NotFoundException("Storage " + storage + " not found for dimension " + dimension); + throw new NotFoundException("Storage " + storage + " not found for dimension table " + dimTable); } return cdt; } @Override public XPartitionList getAllPartitionsOfDimTableStorage( - LensSessionHandle sessionid, String dimension, String storageName, String filter) + LensSessionHandle sessionid, String dimTable, String storageName, String filter) throws LensException { try { acquire(sessionid); - checkDimensionStorage(sessionid, dimension, storageName); + checkDimTableStorage(sessionid, dimTable, storageName); CubeMetastoreClient client = getClient(sessionid); - String storageTableName = MetastoreUtil.getFactOrDimtableStorageTableName(dimension, storageName); + String storageTableName = MetastoreUtil.getFactOrDimtableStorageTableName(dimTable, storageName); List<Partition> partitions = client.getPartitionsByFilter(storageTableName, filter); List<String> timePartCols = client.getTimePartColNamesOfTable(storageTableName); - return xpartitionListFromPartitionList(partitions, timePartCols); + return xpartitionListFromPartitionList(dimTable, partitions, timePartCols); } catch (HiveException exc) { throw new LensException(exc); } finally { @@ -774,7 +774,7 @@ public class CubeMetastoreServiceImpl extends BaseLensService implements CubeMet String dimTblName, String storageName, XPartition partition) throws LensException { try { acquire(sessionid); - checkDimensionStorage(sessionid, dimTblName, storageName); + checkDimTableStorage(sessionid, dimTblName, storageName); return getClient(sessionid).addPartition(storagePartSpecFromXPartition(partition), storageName).size(); } catch (HiveException exc) { throw new LensException(exc); @@ -828,7 +828,7 @@ public class CubeMetastoreServiceImpl extends BaseLensService implements CubeMet String dimTblName, String storageName, XPartitionList partitions) throws LensException { try { acquire(sessionid); - checkDimensionStorage(sessionid, dimTblName, storageName); + checkDimTableStorage(sessionid, dimTblName, storageName); return getClient(sessionid).addPartitions(storagePartSpecListFromXPartitionList(partitions), storageName).size(); } catch (HiveException exc) { throw new LensException(exc); http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java b/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java index 70323d3..6fd19a0 100644 --- a/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java +++ b/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java @@ -792,20 +792,22 @@ public final class JAXBUtils { return nonTimePartSpec; } - public static XPartitionList xpartitionListFromPartitionList(List<Partition> partitions, List<String> timePartCols) - throws HiveException { + public static XPartitionList xpartitionListFromPartitionList(String cubeTableName, List<Partition> partitions, + List<String> timePartCols) throws HiveException { XPartitionList xPartitionList = new XPartitionList(); xPartitionList.getPartition(); if (partitions != null) { for (Partition partition : partitions) { - xPartitionList.getPartition().add(xpartitionFromPartition(partition, timePartCols)); + xPartitionList.getPartition().add(xpartitionFromPartition(cubeTableName, partition, timePartCols)); } } return xPartitionList; } - public static XPartition xpartitionFromPartition(Partition p, List<String> timePartCols) throws HiveException { + public static XPartition xpartitionFromPartition(String cubeTableName, Partition p, List<String> timePartCols) + throws HiveException { XPartition xp = new XPartition(); + xp.setFactOrDimensionTableName(cubeTableName); xp.setPartitionParameters(new XProperties()); xp.setSerdeParameters(new XProperties()); xp.setName(p.getCompleteName()); http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreApp.java b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreApp.java index 520c698..3ea11c1 100644 --- a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreApp.java +++ b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreApp.java @@ -18,34 +18,15 @@ */ package org.apache.lens.server.metastore; - -import java.util.HashSet; -import java.util.Set; - import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; -import org.apache.lens.api.jaxb.LensJAXBContextResolver; -import org.apache.lens.server.LensApplicationListener; -import org.apache.lens.server.LensRequestContextInitFilter; -import org.apache.lens.server.error.LensJAXBValidationExceptionMapper; - -import org.glassfish.jersey.filter.LoggingFilter; -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.apache.lens.server.BaseApp; @ApplicationPath("/") -public class MetastoreApp extends Application { +public class MetastoreApp extends BaseApp { + @Override - public Set<Class<?>> getClasses() { - final Set<Class<?>> classes = new HashSet<Class<?>>(); - // register root resource - classes.add(MetastoreResource.class); - classes.add(LoggingFilter.class); - classes.add(MultiPartFeature.class); - classes.add(LensApplicationListener.class); - classes.add(LensJAXBContextResolver.class); - classes.add(LensRequestContextInitFilter.class); - classes.add(LensJAXBValidationExceptionMapper.class); - return classes; + protected Class getResource() { + return MetastoreResource.class; } } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java index fb937c6..e7d545c 100644 --- a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java +++ b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java @@ -40,8 +40,6 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.hive.ql.metadata.HiveException; -import org.glassfish.jersey.media.multipart.FormDataParam; - import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; @@ -850,11 +848,9 @@ public class MetastoreResource { * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ - @Consumes({MediaType.MULTIPART_FORM_DATA}) @POST @Path("/facts") - public APIResult createFactTable(@FormDataParam("sessionid") LensSessionHandle sessionid, - @FormDataParam("fact") XFactTable fact) + public APIResult createFactTable(@QueryParam("sessionid") LensSessionHandle sessionid, XFactTable fact) throws LensException { checkSessionId(sessionid); try { @@ -1093,6 +1089,8 @@ public class MetastoreResource { XPartition partition) { checkSessionId(sessionid); checkNonNullArgs("Partition is null", partition); + checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(), + partition.getUpdatePeriod()); try { return successOrPartialOrFailure(getSvc().addPartitionToFactStorage(sessionid, factName, storage, partition), 1); } catch (LensException exc) { @@ -1121,6 +1119,8 @@ public class MetastoreResource { XPartition partition) { checkSessionId(sessionid); checkNonNullArgs("Partition is null", partition); + checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(), + partition.getUpdatePeriod()); try { getSvc().updatePartition(sessionid, factName, storage, partition); } catch (LensException exc) { @@ -1239,8 +1239,8 @@ public class MetastoreResource { */ @POST @Path("/dimtables") - public APIResult createDimensionTable(@FormDataParam("sessionid") LensSessionHandle sessionid, - @FormDataParam("dimensionTable") XDimensionTable dimensionTable) { + public APIResult createDimensionTable(@QueryParam("sessionid") LensSessionHandle sessionid, + XDimensionTable dimensionTable) { checkSessionId(sessionid); try { getSvc().createDimensionTable(sessionid, dimensionTable); @@ -1514,6 +1514,8 @@ public class MetastoreResource { XPartition partition) { checkSessionId(sessionid); checkNonNullArgs("Partition is null", partition); + checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(), + partition.getUpdatePeriod()); try { return successOrPartialOrFailure(getSvc().addPartitionToDimStorage(sessionid, dimTableName, storage, partition), 1); @@ -1538,10 +1540,12 @@ public class MetastoreResource { @Path("/dimtables/{dimTableName}/storages/{storage}/partition") public APIResult updatePartitionOfDimStorage(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimTableName") String dimTableName, - @PathParam("storage") String storage, + @PathParam("storage") String storage, XPartition partition) { checkSessionId(sessionid); checkNonNullArgs("Partition is null", partition); + checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(), + partition.getUpdatePeriod()); try { getSvc().updatePartition(sessionid, dimTableName, storage, partition); } catch (LensException exc) { http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java index 9db034a..9126268 100644 --- a/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java +++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryApp.java @@ -18,32 +18,18 @@ */ package org.apache.lens.server.query; -import java.util.HashSet; -import java.util.Set; - import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -import org.apache.lens.server.LensApplicationListener; -import org.apache.lens.server.LensRequestContextInitFilter; -import org.glassfish.jersey.filter.LoggingFilter; -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.apache.lens.server.BaseApp; /** * The Class QueryApp. */ @ApplicationPath("/queryapi") -public class QueryApp extends Application { +public class QueryApp extends BaseApp { + @Override - public Set<Class<?>> getClasses() { - final Set<Class<?>> classes = new HashSet<Class<?>>(); - // register root resource - classes.add(QueryServiceResource.class); - classes.add(MultiPartFeature.class); - classes.add(LensRequestContextInitFilter.class); - classes.add(LoggingFilter.class); - classes.add(LensApplicationListener.class); - return classes; + protected Class getResource() { + return QueryServiceResource.class; } } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java b/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java index bb4cfd2..6e1a709 100644 --- a/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java +++ b/lens-server/src/main/java/org/apache/lens/server/query/QueryServiceResource.java @@ -207,7 +207,7 @@ public class QueryServiceResource { @Consumes({MediaType.MULTIPART_FORM_DATA}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN}) @MultiPurposeResource(formParamName = "operation") - public LensAPIResult<? extends QuerySubmitResult> query(@FormDataParam("sessionid") LensSessionHandle sessionid, + public LensAPIResult<QuerySubmitResult> query(@FormDataParam("sessionid") LensSessionHandle sessionid, @FormDataParam("query") String query, @FormDataParam("operation") String operation, @FormDataParam("conf") LensConf conf, @DefaultValue("30000") @FormDataParam("timeoutmillis") Long timeoutmillis, @DefaultValue("") @FormDataParam("queryName") String queryName) throws LensException { @@ -351,7 +351,7 @@ public class QueryServiceResource { @Consumes({MediaType.MULTIPART_FORM_DATA}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN}) @MultiPurposeResource(formParamName = "operation") - public LensAPIResult<? extends QuerySubmitResult> prepareQuery( + public LensAPIResult<QuerySubmitResult> prepareQuery( @FormDataParam("sessionid") LensSessionHandle sessionid, @FormDataParam("query") String query, @DefaultValue("") @FormDataParam("operation") String operation, @FormDataParam("conf") LensConf conf, @DefaultValue("") @FormDataParam("queryName") String queryName) throws LensException { http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryApp.java b/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryApp.java index e55ed13..494df08 100644 --- a/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryApp.java +++ b/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryApp.java @@ -18,31 +18,17 @@ */ package org.apache.lens.server.query.save; -import java.util.HashSet; -import java.util.Set; - import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -import org.apache.lens.server.LensApplicationListener; -import org.apache.lens.server.LensRequestContextInitFilter; -import org.glassfish.jersey.filter.LoggingFilter; -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.apache.lens.server.BaseApp; /** * The Class SavedQueryApp. */ @ApplicationPath("/savedquery") -public class SavedQueryApp extends Application { +public class SavedQueryApp extends BaseApp { @Override - public Set<Class<?>> getClasses() { - final Set<Class<?>> classes = new HashSet<Class<?>>(); - classes.add(SavedQueryResource.class); - classes.add(MultiPartFeature.class); - classes.add(LensRequestContextInitFilter.class); - classes.add(LoggingFilter.class); - classes.add(LensApplicationListener.class); - return classes; + protected Class getResource() { + return SavedQueryResource.class; } } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryResource.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryResource.java b/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryResource.java index 5c247be..02541c5 100644 --- a/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryResource.java +++ b/lens-server/src/main/java/org/apache/lens/server/query/save/SavedQueryResource.java @@ -35,7 +35,7 @@ import javax.ws.rs.core.UriInfo; import org.apache.lens.api.LensConf; import org.apache.lens.api.LensSessionHandle; import org.apache.lens.api.error.ErrorCollection; -import org.apache.lens.api.query.QuerySubmitResult; +import org.apache.lens.api.query.QueryHandle; import org.apache.lens.api.query.save.ListResponse; import org.apache.lens.api.query.save.ParameterParserResponse; import org.apache.lens.api.query.save.ResourceModifiedResponse; @@ -253,7 +253,7 @@ public class SavedQueryResource { @POST @Path("/savedqueries/{id}") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN}) - public LensAPIResult<? extends QuerySubmitResult> run( + public LensAPIResult<QueryHandle> run( @PathParam("id") long id, @Context UriInfo info, @FormDataParam("sessionid") LensSessionHandle sessionid, http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerApp.java b/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerApp.java index 0ea8544..91bc54f 100644 --- a/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerApp.java +++ b/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerApp.java @@ -18,28 +18,18 @@ */ package org.apache.lens.server.scheduler; -import java.util.HashSet; -import java.util.Set; - import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -import org.apache.lens.server.LensApplicationListener; -import org.glassfish.jersey.filter.LoggingFilter; +import org.apache.lens.server.BaseApp; /** * The Class SchedulerApp. */ -@ApplicationPath("/queryscheduler") -public class SchedulerApp extends Application { +@ApplicationPath("/scheduler") +public class SchedulerApp extends BaseApp { + @Override - public Set<Class<?>> getClasses() { - final Set<Class<?>> classes = new HashSet<Class<?>>(); - // register root resource - classes.add(ScheduleResource.class); - classes.add(LensApplicationListener.class); - classes.add(LoggingFilter.class); - return classes; + protected Class getResource() { + return ScheduleResource.class; } } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/session/SessionApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/session/SessionApp.java b/lens-server/src/main/java/org/apache/lens/server/session/SessionApp.java index a499968..a56bc89 100644 --- a/lens-server/src/main/java/org/apache/lens/server/session/SessionApp.java +++ b/lens-server/src/main/java/org/apache/lens/server/session/SessionApp.java @@ -18,31 +18,18 @@ */ package org.apache.lens.server.session; -import java.util.HashSet; -import java.util.Set; - import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -import org.apache.lens.server.LensApplicationListener; - -import org.glassfish.jersey.filter.LoggingFilter; -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.apache.lens.server.BaseApp; /** * The Class SessionApp. */ @ApplicationPath("/session") -public class SessionApp extends Application { +public class SessionApp extends BaseApp { + @Override - public Set<Class<?>> getClasses() { - final Set<Class<?>> classes = new HashSet<Class<?>>(); - // register root resource - classes.add(SessionResource.class); - classes.add(MultiPartFeature.class); - classes.add(LoggingFilter.class); - classes.add(LensApplicationListener.class); - return classes; + protected Class getResource() { + return SessionResource.class; } } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/session/SessionResource.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/session/SessionResource.java b/lens-server/src/main/java/org/apache/lens/server/session/SessionResource.java index 3ba5edd..ac77418 100644 --- a/lens-server/src/main/java/org/apache/lens/server/session/SessionResource.java +++ b/lens-server/src/main/java/org/apache/lens/server/session/SessionResource.java @@ -45,7 +45,7 @@ import lombok.extern.slf4j.Slf4j; * <p></p> * This provides api for all things in session. */ -@Path("/session") +@Path("session") @Slf4j public class SessionResource { http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/java/org/apache/lens/server/ui/UIApp.java ---------------------------------------------------------------------- diff --git a/lens-server/src/main/java/org/apache/lens/server/ui/UIApp.java b/lens-server/src/main/java/org/apache/lens/server/ui/UIApp.java index c22a1aa..de4ce33 100644 --- a/lens-server/src/main/java/org/apache/lens/server/ui/UIApp.java +++ b/lens-server/src/main/java/org/apache/lens/server/ui/UIApp.java @@ -18,32 +18,28 @@ */ package org.apache.lens.server.ui; -import java.util.HashSet; import java.util.Set; import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; -import org.apache.lens.server.AuthenticationFilter; -import org.apache.lens.server.LensApplicationListener; - -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.apache.lens.server.BaseApp; /** * The Class UIApp. */ @ApplicationPath("/ui") -public class UIApp extends Application { +public class UIApp extends BaseApp { + + @Override + protected Class getResource() { + return StaticFileResource.class; + } public Set<Class<?>> getClasses() { - final Set<Class<?>> classes = new HashSet<Class<?>>(); - classes.add(StaticFileResource.class); + final Set<Class<?>> classes = super.getClasses(); classes.add(QueryServiceUIResource.class); classes.add(SessionUIResource.class); classes.add(MetastoreUIResource.class); - classes.add(MultiPartFeature.class); - classes.add(AuthenticationFilter.class); - classes.add(LensApplicationListener.class); return classes; } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/main/resources/lensserver-default.xml ---------------------------------------------------------------------- diff --git a/lens-server/src/main/resources/lensserver-default.xml b/lens-server/src/main/resources/lensserver-default.xml index 881c159..a711d03 100644 --- a/lens-server/src/main/resources/lensserver-default.xml +++ b/lens-server/src/main/resources/lensserver-default.xml @@ -455,7 +455,7 @@ <property> <name>lens.server.ws.featurenames</name> - <value>multipart</value> + <value>multipart,moxyjson,moxyjsonconfigresovler</value> <description>These JAX-RS Feature(s) would be started in the specified order when lens-server starts up </description> </property> @@ -467,6 +467,16 @@ </property> <property> + <name>lens.server.moxyjson.ws.feature.impl</name> + <value>org.glassfish.jersey.moxy.json.MoxyJsonFeature</value> + <description>Enable Moxy json feature </description> + </property> + <property> + <name>lens.server.moxyjsonconfigresovler.ws.feature.impl</name> + <value>org.apache.lens.api.util.MoxyJsonConfigurationContextResolver</value> + <description>Moxy json configuration resolver</description> + </property> + <property> <name>lens.server.ws.filternames</name> <value>authentication,consistentState,serverMode</value> <description>These JAX-RS filters would be started in the specified order when lens-server starts up</description> http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/test/java/org/apache/lens/server/LensAllApplicationJerseyTest.java ---------------------------------------------------------------------- diff --git a/lens-server/src/test/java/org/apache/lens/server/LensAllApplicationJerseyTest.java b/lens-server/src/test/java/org/apache/lens/server/LensAllApplicationJerseyTest.java index 56a3b75..a3e0a19 100644 --- a/lens-server/src/test/java/org/apache/lens/server/LensAllApplicationJerseyTest.java +++ b/lens-server/src/test/java/org/apache/lens/server/LensAllApplicationJerseyTest.java @@ -20,8 +20,7 @@ package org.apache.lens.server; import javax.ws.rs.core.Application; -import org.glassfish.jersey.client.ClientConfig; -import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.glassfish.jersey.test.TestProperties; /** * The Class LensAllApplicationJerseyTest. @@ -35,17 +34,8 @@ public abstract class LensAllApplicationJerseyTest extends LensJerseyTest { */ @Override protected Application configure() { + enable(TestProperties.LOG_TRAFFIC); + enable(TestProperties.DUMP_ENTITY); return new LensApplication(); } - - /* - * (non-Javadoc) - * - * @see org.glassfish.jersey.test.JerseyTest#configureClient(org.glassfish.jersey.client.ClientConfig) - */ - @Override - protected void configureClient(ClientConfig config) { - config.register(MultiPartFeature.class); - } - } http://git-wip-us.apache.org/repos/asf/lens/blob/d559ef2e/lens-server/src/test/java/org/apache/lens/server/LensJerseyTest.java ---------------------------------------------------------------------- diff --git a/lens-server/src/test/java/org/apache/lens/server/LensJerseyTest.java b/lens-server/src/test/java/org/apache/lens/server/LensJerseyTest.java index 8f52ddd..a00a86b 100644 --- a/lens-server/src/test/java/org/apache/lens/server/LensJerseyTest.java +++ b/lens-server/src/test/java/org/apache/lens/server/LensJerseyTest.java @@ -30,8 +30,12 @@ import java.net.URI; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; +import org.apache.lens.api.jaxb.LensJAXBContextResolver; +import org.apache.lens.api.util.MoxyJsonConfigurationContextResolver; import org.apache.lens.driver.hive.TestRemoteHiveDriver; import org.apache.lens.server.api.LensConfConstants; import org.apache.lens.server.api.metrics.LensMetricsUtil; @@ -44,9 +48,13 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hive.service.Service; import org.apache.hive.service.Service.STATE; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.glassfish.jersey.moxy.json.MoxyJsonFeature; import org.glassfish.jersey.test.JerseyTest; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; +import org.testng.annotations.DataProvider; import com.google.common.collect.Lists; @@ -59,6 +67,7 @@ import lombok.extern.slf4j.Slf4j; public abstract class LensJerseyTest extends JerseyTest { private int port = -1; + protected MediaType defaultMT = MediaType.APPLICATION_XML_TYPE; private final LogSegregationContext logSegregationContext = new MappedDiagnosticLogSegregationContext(); @@ -79,7 +88,7 @@ public abstract class LensJerseyTest extends JerseyTest { super.tearDown(); } protected int getTestPort() { - if (!isPortAlreadyFound()) { + if (isPortAlreadyFound()) { return port; } ServerSocket socket = null; @@ -109,6 +118,14 @@ public abstract class LensJerseyTest extends JerseyTest { return UriBuilder.fromUri(getUri()).path("lens-server").build(); } + @Override + protected void configureClient(ClientConfig config) { + config.register(MultiPartFeature.class); + config.register(MoxyJsonFeature.class); + config.register(MoxyJsonConfigurationContextResolver.class); + config.register(LensJAXBContextResolver.class); + } + public HiveConf getServerConf() { return LensServerConf.getHiveConf(); } @@ -213,6 +230,7 @@ public abstract class LensJerseyTest extends JerseyTest { LensServices.get().start(); System.out.println("Lens services restarted!"); } + public static void waitForPurge(int allowUnpurgable, ConcurrentLinkedQueue<QueryExecutionServiceImpl.FinishedQuery> finishedQueries) throws InterruptedException { List<QueryExecutionServiceImpl.FinishedQuery> unPurgable = Lists.newArrayList(); @@ -228,4 +246,21 @@ public abstract class LensJerseyTest extends JerseyTest { Thread.sleep(5000); } } + + @DataProvider(name = "mediaTypeData") + public Object[][] mediaTypeData() { + return new Object[][] { + {MediaType.APPLICATION_XML_TYPE}, + {MediaType.APPLICATION_JSON_TYPE}, + }; + } + + public static Entity getEntityForString(String o, MediaType mt) { + if (mt.equals(MediaType.APPLICATION_JSON_TYPE)) { + return Entity.json(o); + } else if (mt.equals(MediaType.APPLICATION_XML_TYPE)) { + return Entity.xml(o); + } + return null; + } }