Skip to content

Commit a3b796d

Browse files
committed
Forward- and Reverse-Engineering
1 parent 6a0205a commit a3b796d

File tree

15 files changed

+664
-360
lines changed

15 files changed

+664
-360
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

forward_engineering/api.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module.exports = {
2+
generateScript(data, logger, cb) {
3+
let { jsonSchema, entityData } = data;
4+
5+
try {
6+
jsonSchema = JSON.parse(jsonSchema);
7+
} catch (err) {
8+
return cb(err)
9+
}
10+
11+
let columnFailies = this.getColumnFamilies(jsonSchema.properties);
12+
let script = `create '${entityData.collectionName.toLowerCase()}'`;
13+
14+
columnFailies.forEach(item => {
15+
script = `${script}, '${item}'`;
16+
});
17+
18+
return cb(null, script);
19+
},
20+
21+
getColumnFamilies(props = {}){
22+
let columnFamilies = [];
23+
for(let prop in props){
24+
if(props[prop] && props[prop].type === 'colFam'){
25+
columnFamilies.push(prop);
26+
}
27+
}
28+
29+
if(!columnFamilies.length){
30+
columnFamilies.push('<columnFaimily>');
31+
}
32+
33+
return columnFamilies;
34+
}
35+
};

forward_engineering/config.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extension": "txt",
3+
"filterName": "Plain text",
4+
"namePrefix": "HBase script",
5+
"hasUpdateScript": false
6+
}

forward_engineering/package.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "hbase",
3+
"version": "1.0.0",
4+
"description": "",
5+
"author": "Hackolade",
6+
"dependencies": {
7+
}
8+
}

localization/en.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"MAIN_MENU___ADD_ATTRIBUTE": "Add Column",
88
"MAIN_MENU___INSERT_FIELD": "Insert Column",
99
"MAIN_MENU___APPEND_FIELD": "Append Column",
10+
"MAIN_MENU___FORWARD_DB_COLLECTIONS": "HBase Script",
1011
"MAIN_MENU___REVERSE_DB_COLLECTIONS": "HBase tables...",
1112
"TOOLBAR___ADD_BUCKET": "Add namespace",
1213
"TOOLBAR___ADD_COLLECTION": "Add table",
@@ -70,11 +71,12 @@
7071
"MODAL_WINDOW___CANNOT_CONNECT_TO_DB": "Cannot connect to HBase",
7172
"MODAL_WINDOW___SUCCESSFULLY_CONNECT_TO_DB": "Successfully connected to HBase",
7273
"MODAL_WINDOW___UNABLE_CONNECT_TO_DB": "Unable to connect to HBase",
74+
"MODAL_WINDOW___DB_CONNECTIONS_LIST_TITLE": "HBase Connections",
7375
"MODAL_WINDOW___DB_ENTITIES_SELECTION_TITLE": "Type selection",
7476
"MODAL_WINDOW___RECORDS_MAX": "Documents max",
7577
"MODAL_WINDOW___SUBDOCUMENT_IN_CHILD": "Sub-document in child",
7678
"MODAL_WINDOW___ARRAY_IN_PARENT": "Array in parent",
77-
"MODAL_WINDOW___INCLUDE_EMPTY_COLLECTION": "Include empty namespace",
79+
"MODAL_WINDOW___INCLUDE_EMPTY_COLLECTION": "Include empty tables",
7880
"MODAL_WINDOW___CREATE_COLLECTION": "Create table",
7981
"MODAL_WINDOW___CREATE_BUCKET": "Create namespace",
8082
"MODAL_WINDOW___ALL_COLLECTIONS": "and all nested table",
@@ -132,10 +134,11 @@
132134
"COLLECTION_SCHEMA_DEFINITION_TYPE": "document",
133135
"MONGODB_SCRIPT_WARNING_MESSAGE": "This view is not associated to a type (viewOn property).",
134136
"TYPE": {},
135-
"CENTRAL_PANE___TAB_MODEL_DEFINITIONS": "User-Defined Types",
136-
"CONTEXT_MENU___ADD_MODEL_REFERENCE": "User-Defined Type",
137-
"CONTEXT_MENU___GO_TO_DEFINITION": "Go to User-Defined Type",
138-
"DOCUMENTATION___DB_DEFINITIONS": "User-Defined Types",
137+
"CENTRAL_PANE___TAB_MODEL_DEFINITIONS": "Model Definitions",
138+
"CONTEXT_MENU___ADD_MODEL_REFERENCE": "Model Definition",
139+
"CONTEXT_MENU___GO_TO_DEFINITION": "Go to Model Definition",
140+
"DOCUMENTATION___DB_DEFINITIONS": "Model Definitions",
139141
"CONTEXT_MENU___CONVERT_TO_PATTERN_FIELD": "Convert to Pattern Column",
140-
"CONTEXT_MENU___CONVERT_PATTERN_TO_REGULAR_FIELD": "Convert to Regular Column"
142+
"CONTEXT_MENU___CONVERT_PATTERN_TO_REGULAR_FIELD": "Convert to Regular Column",
143+
"CENTRAL_PANE___FE_SCRIPT": "HBase Script"
141144
}

package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "HBase",
3-
"version": "0.1.2",
4-
"versionDate": "2018-02-25",
3+
"version": "0.1.3",
4+
"versionDate": "2018-03-29",
55
"author": "hackolade",
66
"engines": {
7-
"hackolade": "1.10.x",
7+
"hackolade": "1.12.7",
88
"hackoladePlugin": "1.0.0"
99
},
1010
"contributes": {
@@ -20,7 +20,9 @@
2020
},
2121
"features": {
2222
"nestedCollections": false,
23-
"jaySchemaHasRequiredPatternField": true
23+
"jaySchemaHasRequiredPatternField": true,
24+
"enableReverseEngineering": true,
25+
"enableForwardEngineering": true
2426
}
2527
},
2628
"description": "Hackolade plugin for Apache HBase"

properties_pane/container_level/containerLevelConfig.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,17 @@ making sure that you maintain a proper JSON format.
8686
"containerLevelKeys": [{
8787
"labelName": "Row Key",
8888
"propertyName": "Row Key",
89-
"propertyKeyword": "rowKey",
90-
"defaultName": "^[a-zA-Z0-9_.-]*$",
89+
"propertyKeyword": "Row Key",
90+
"defaultName": "Row Key",
9191
"propertyPrimaryKey": true,
9292
"propertyType": "text",
9393
"typeName": "Data type",
9494
"typeOptions": [
95-
"object"
95+
"string"
9696
],
97-
"defaultType": "object",
98-
"valueType": "object",
99-
"disabledFieldOption": true,
100-
"entityType": "patternField"
97+
"defaultType": "string",
98+
"valueType": "string",
99+
"disabledFieldOption": true
101100
}],
102101
"structure": [
103102
{

properties_pane/defaultData.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"model": {
33
"modelName": "New model",
44
"dbVersion": "",
5-
"dbVendor": "Apache HBase",
5+
"dbVendor": "HBase",
66
"port": 9200
77
},
88
"container": {

properties_pane/field_level/fieldLevelConfig.json

+87-7
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ making sure that you maintain a proper JSON format.
1414
"propertyName": "Simple text",
1515
"propertyKeyword": "simpletextProp",
1616
"shouldValidate": false,
17-
"propertyType": "text",
18-
"sampleGen": "&containerName|&entityName|&random|<value>"
17+
"propertyType": "text"
1918
},
2019
{
2120
"propertyName": "Text area",
@@ -44,8 +43,7 @@ making sure that you maintain a proper JSON format.
4443
"propertyValidate": true,
4544
"propertyType": "numeric",
4645
"valueType": "number",
47-
"allowNegative": false,
48-
"sampleGen": "&containerName|&entityName|&random|<value>"
46+
"allowNegative": false
4947
},
5048
{
5149
"propertyName": "Checkbox",
@@ -90,18 +88,100 @@ making sure that you maintain a proper JSON format.
9088
"description",
9189
"dependencies",
9290
"required",
91+
{
92+
"propertyName": "Data block encoding",
93+
"propertyKeyword": "dataBlockEncoding",
94+
"propertyType": "select",
95+
"options": [
96+
"NONE",
97+
"PREFIX",
98+
"DIFF",
99+
"FAST_DIFF",
100+
"PREFIX_TREE"
101+
]
102+
},
103+
{
104+
"propertyName": "Bloomfilter",
105+
"propertyKeyword": "bloomfilter",
106+
"propertyType": "select",
107+
"options": [
108+
"NONE",
109+
"ROW",
110+
"ROWCOL"
111+
]
112+
},
113+
{
114+
"propertyName": "Replication scope",
115+
"propertyKeyword": "replicationScope",
116+
"propertyType": "select",
117+
"options": [
118+
"0",
119+
"1"
120+
]
121+
},
122+
{
123+
"propertyName": "Versions",
124+
"propertyKeyword": "versions",
125+
"propertyValidate": true,
126+
"propertyType": "numeric",
127+
"valueType": "number",
128+
"allowNegative": false
129+
},
130+
{
131+
"propertyName": "Compression",
132+
"propertyKeyword": "compression",
133+
"propertyType": "select",
134+
"options": [
135+
"NONE",
136+
"SNAPPY",
137+
"LZO",
138+
"LZ4",
139+
"GZ"
140+
]
141+
},
93142
{
94143
"propertyName": "Time-to-Live",
95144
"propertyKeyword": "ttl",
96145
"propertyValidate": true,
97146
"propertyType": "numeric",
98147
"valueType": "number",
99-
"allowNegative": false,
100-
"sampleGen": "&containerName|&entityName|&random|<value>"
148+
"allowNegative": false
149+
},
150+
{
151+
"propertyName": "Min versions",
152+
"propertyKeyword": "minVersions",
153+
"propertyValidate": true,
154+
"propertyType": "numeric",
155+
"valueType": "number",
156+
"allowNegative": false
157+
},
158+
{
159+
"propertyName": "Kepp deleted cells",
160+
"propertyKeyword": "keepDeletedCells",
161+
"propertyType": "checkbox"
101162
},
163+
{
164+
"propertyName": "Blocksize",
165+
"propertyKeyword": "blocksize",
166+
"propertyValidate": true,
167+
"propertyType": "numeric",
168+
"valueType": "number",
169+
"allowNegative": false
170+
},
171+
{
172+
"propertyName": "In memory",
173+
"propertyKeyword": "inMemory",
174+
"propertyType": "checkbox"
175+
},
176+
{
177+
"propertyName": "Blockcache",
178+
"propertyKeyword": "blockcache",
179+
"propertyType": "checkbox"
180+
},
181+
102182
"comments"
103183
],
104-
"colQual": "document",
184+
"colQual": "array",
105185
"byte": "string",
106186
"string": [
107187
"name",

0 commit comments

Comments
 (0)