Browse Source

refactor: 调整JNDI连接

qufenxi
alan 6 years ago
parent
commit
8329155fe4
  1. 351
      private/constants.ts
  2. 3
      src/app/app.component.scss
  3. 3
      src/app/app.component.ts
  4. 1
      src/app/app.constant.ts
  5. 7
      src/app/link_set/link-set.model.ts
  6. 4
      src/app/link_set/more/more.link.component.ts
  7. 0
      src/app/link_set/right/right.typing.d.ts
  8. 36
      src/app/link_set/right/right_detail/right.detail.component.ts
  9. 43
      src/app/link_set/right/right_detail/right.detail.service.ts
  10. 4
      src/app/link_set/right/right_edit/right.edit.component.ts
  11. 38
      src/app/link_set/right/right_edit/right.edit.constant.ts
  12. 35
      src/app/link_set/right/right_edit/right.edit.jndi.component.ts
  13. 4
      src/app/link_set/right/right_edit/right.edit.mysql.component.ts
  14. 33
      src/app/link_set/right/right_show/right.show.jndi.component.ts
  15. 5
      src/app/link_set/select/select.component.ts
  16. 261
      src/app/link_set/select/select.service.ts
  17. 3
      src/plugins/jndi/jdni.scss
  18. 54
      src/plugins/jndi/jndi.pool.ts
  19. 87
      src/plugins/jndi/jndi.service.ts

351
private/constants.ts

@ -1,4 +1,6 @@
export const OTHER_CONNECT = 'other'; export const OTHER_CONNECT = 'other';
export const JNDI_CONNECT = 'JNDI';
export const MYSQL_CONNECT = 'mysql';
export const DEFAULT_INFO = 'DESIGNER'; export const DEFAULT_INFO = 'DESIGNER';
export const ACTION_DELETE = 'ACTION_DELETE'; export const ACTION_DELETE = 'ACTION_DELETE';
export const ACTION_COPY = 'ACTION_COPY'; export const ACTION_COPY = 'ACTION_COPY';
@ -6,3 +8,352 @@ export const ACTION_TEST = 'ACTION_TEST';
export const TAB_LINK_SET = 'TAB_LINK_SET'; export const TAB_LINK_SET = 'TAB_LINK_SET';
export const TAB_LINK_POOL = 'TAB_LINK_POOL'; export const TAB_LINK_POOL = 'TAB_LINK_POOL';
export const DATA_LINKS = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200', 'JNDI'];
export const DATA_BASE_TYPE = [
{
text: 'APACHE KYLIN',
databaseType: 'apache-kylin',
driver: 'org.apache.kylin.jdbc.Driver',
url: 'jdbc:kylin://<hostname>:<port>/<kylin_project_name>',
},
{
text: 'DERBY',
databaseType: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
url: 'jdbc:derby://localhost:1527/',
},
{
text: 'HP Vertica',
databaseType: 'hp-vertica',
driver: 'com.vertica.jdbc.Driver',
url: 'jdbc:vertica://ip:port/databaseName',
},
{
text: 'IBM DB2',
databaseType: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
url: 'jdbc:db2://hostname:port/dbname',
},
{
text: 'INFORMIX',
databaseType: 'informix',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
},
{
text: 'Microsoft SQL Server',
databaseType: 'sql-server',
driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url: 'jdbc:sqlserver://localhost:1433;databaseName=',
},
{
text: 'Oracle',
databaseType: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
url: 'jdbc:oracle:thin:@localhost:1521:databaseName',
},
{
text: 'Privotal Greenplum Database',
databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'Postgresql',
databaseType: 'postgresql',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'GaussDB 200',
databaseType: 'hw-libr-a',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text: OTHER_CONNECT,
databaseType: 'other',
driver: 'org.h2.Driver',
drivers: ['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'],
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
{
text: 'ADS',
databaseType: 'ads',
driver: 'com.mysql.jdbc.Driver',
url: 'jdbc:mysql://hostname:port/my_ads_db',
},
{
text: 'Amazon Redshift',
databaseType: 'amazon-redshift',
driver: 'com.amazon.redshift.jdbc4.Driver',
drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'],
url: 'jdbc:redshift://endpoint:port/database',
},
{
text: 'APACHE IMPALA',
databaseType: 'apache-impala',
driver: 'com.cloudera.impala.jdbc41.Driver',
url: 'jdbc:impala://hostname:port/_impala_builtins',
},
{
text: 'APACHE KYLIN',
databaseType: 'apache-kylin',
driver: 'org.apache.kylin.jdbc.Driver',
url: 'jdbc:kylin://<hostname>:<port>/<kylin_project_name>',
},
{
text: 'APACHE Phoenix',
databaseType: 'apache-phoenix',
driver: 'org.apache.phoenix.jdbc.PhoenixDriver',
url: 'jdbc:phoenix:hostname:port/dbname',
},
{
text: 'DERBY',
databaseType: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
url: 'jdbc:derby://localhost:1527/',
},
{
text: 'Gbase 8A',
databaseType: 'gbase-8a',
driver: 'com.gbase.jdbc.Driver',
url: 'jdbc:gbase://hostname:port/dbname',
},
{
text: 'Gbase 8S',
databaseType: 'gbase-8s',
driver: 'com.gbasedbt.jdbc.IfxDriver',
url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}',
},
{
text: 'Gbase 8T',
databaseType: 'gbase-8t',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
},
{
text: 'H2',
databaseType: 'h2',
driver: 'org.h2.Driver',
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
{
text: '华为云DWS',
databaseType: 'hw-dws',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'FusionInsight elk',
databaseType: 'hw-elk',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text: 'FusionInsight HD',
databaseType: 'hw-fusioninsight-hd',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;',
},
{
text: 'GaussDB 200',
databaseType: 'hw-libr-a',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text: 'Hadoop Hive',
databaseType: 'hadoop-hive',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text: 'Hbase',
databaseType: 'hbase',
driver: 'org.apache.phoenix.jdbc.PhoenixDriver',
url: 'jdbc:phoenix:hostname:port/dbname',
}, {
text: 'HP Vertica',
databaseType: 'hp-vertica',
driver: 'com.vertica.jdbc.Driver',
url: 'jdbc:vertica://ip:port/databaseName',
}, {
text: 'Hsql',
databaseType: 'hsql',
driver: 'com.fr.third.org.hsqldb.jdbcDriver',
url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]',
}, {
text: 'IBM DB2',
databaseType: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
url: 'jdbc:db2://hostname:port/dbname',
}, {
text: 'INFORMIX',
databaseType: 'informix',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
}, {
text: 'KINGBASE',
databaseType: 'kingbase',
driver: 'com.kingbase.Driver',
url: 'jdbc:kingbase://hostname:port',
}, {
text: 'Microsoft SQL Server',
databaseType: 'sql-server',
driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url: 'jdbc:sqlserver://localhost:1433;databaseName=',
}, {
text: 'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers: ['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text: 'Oracle',
databaseType: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
url: 'jdbc:oracle:thin:@localhost:1521:databaseName',
},
{
text: 'Pivotal Greenplum Database',
databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text: 'Postgresql',
databaseType: 'postgresql',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text: 'Presto',
databaseType: 'presto',
driver: 'com.facebook.presto.jdbc.PrestoDriver',
url: 'jdbc:presto://host:port/catalog',
}, {
text: 'SAP HANA',
databaseType: 'sap-hana',
driver: 'com.sap.db.jdbc.Driver',
url: 'jdbc:sap://hostname:port?reconnect=true',
}, {
text: 'SAP Sybase',
databaseType: 'sap-sybase',
driver: 'com.sybase.jdbc4.jdbc.SybDriver',
url: 'jdbc:sybase:Tds:hostname:2638/databasename',
}, {
text: 'SPARK',
databaseType: 'spark',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text: 'Sqlite',
databaseType: 'sqlite',
driver: 'org.sqlite.JDBC',
url: 'jdbc:sqlite:[PATH_TO_DB_FILES]',
}, {
text: 'TeraData',
databaseType: 'teradata',
driver: 'com.ncr.teradata.TeraDriver',
url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT',
}, {
text: 'TRANSWARP INCEPTOR',
databaseType: 'transwarp-inceptor',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text: JNDI_CONNECT,
},
];
export const JNDI_FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory'];
export const OTHER_ATTRIBUTES = [
{
text: 'OBJECT_FACTORIES',
name: 'objectFactories',
},
{
text: 'STATE_FACTORIES',
name: 'stateFactories',
},
{
text: 'URL_PKG_PREFIXES',
name: 'urlPkgPrefixes',
},
{
text: 'DNS_URL',
name: 'dnsUrl',
},
{
text: 'AUTHORITATIVE',
name: 'authoritative',
},
{
text: 'BATCHSIZE',
name: 'batchSize',
},
{
text: 'REFERRAL',
name: 'referral',
},
{
text: 'SECURITY_PROTOCOL',
name: 'securityProtocol',
},
{
text: 'SECURITY_AUTHENTICATION',
name: 'securityAuthentication',
},
{
text: 'LANGUAGE',
name: 'language',
},
{
text: 'APPLET',
name: 'applet',
},
];
export const CONNECT_CHARSET = [
{
text: 'GBK',
value: 'GBK',
},
{
text: 'BIG5',
value: 'BIG5',
},
{
text: 'ISO-8859-1',
value: 'ISO-8859-1',
},
{
text: 'UTF-8',
value: 'UTF-8',
},
{
text: 'UTF-16',
value: 'UTF-16',
},
{
text: 'EUC_JP',
value: 'EUC_JP',
},
{
text: 'EUC_KR',
value: 'EUC_KR',
},
{
text: 'CP850',
value: 'CP850',
},
];

3
src/app/app.component.scss

@ -327,3 +327,6 @@
content: "\e6c4"; content: "\e6c4";
color: inherit; color: inherit;
} }
.jndi-notice{
color: red;
}

3
src/app/app.component.ts

@ -4,9 +4,6 @@ import appModel from './app.model';
import title from './title/title.component'; import title from './title/title.component';
import linkSet from './link_set/link-set.component'; import linkSet from './link_set/link-set.component';
import linkStatus from './link_status/link_status.component'; import linkStatus from './link_status/link_status.component';
import '../plugins/jndi/jndi.edit';
import '../plugins/jndi/jndi.pool';
import '../plugins/jndi/jndi.preview';
import {fetchLinkList} from '../shared/crud/crud.request'; import {fetchLinkList} from '../shared/crud/crud.request';
import './app.component.scss'; import './app.component.scss';

1
src/app/app.constant.ts

@ -1,5 +1,4 @@
export const ConstantName = 'dec.constant.database.conf.connect.list'; export const ConstantName = 'dec.constant.database.conf.connect.list';
export const links = ['APACHE KYLIN', 'DERBY', 'HP Vertica', 'IBM DB2', 'INFORMIX', 'Microsoft SQL Server', 'MySQL', 'Oracle', 'Privotal Greenplum Database', 'Postgresql', 'GaussDB 200'];
BI.constant(ConstantName, [ BI.constant(ConstantName, [
]); ]);
export default ConstantName; export default ConstantName;

7
src/app/link_set/link-set.model.ts

@ -1,7 +1,8 @@
import {ModelType} from '@ui/index'; import {ModelType} from '@ui/index';
import {LinkType} from '@ui/type'; import {LinkType} from '@ui/type';
import {deleteConnection, testConnection} from '@shared/crud/crud.request'; import {deleteConnection, testConnection} from '@shared/crud/crud.request';
import {databaseTyle, getCnnectionName} from './select/select.service'; import {getCnnectionName} from './select/select.service';
import {DATA_BASE_TYPE} from '@private/constants';
import dialog from '@shared/service/dialog.service'; import dialog from '@shared/service/dialog.service';
import {saveConnection} from './link-set.service'; import {saveConnection} from './link-set.service';
@ -124,7 +125,7 @@ const Model: ModelType = {
} }
}, },
setNewLink(value: string) { setNewLink(value: string) {
if (!databaseTyle.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) { if (!DATA_BASE_TYPE.some(item => item.text === value) && !BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${value.toLowerCase()}.edit`)) {
dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find')); dialog.error(BI.i18nText('Dec-Dcm_Connection_Option_Cannot_Find'));
return; return;
@ -136,7 +137,7 @@ const Model: ModelType = {
_setNewLink(value: string) { _setNewLink(value: string) {
const name = getCnnectionName(this.model.linkList, value); const name = getCnnectionName(this.model.linkList, value);
let data = {}; let data = {};
databaseTyle.forEach(item => { DATA_BASE_TYPE.forEach(item => {
if (item.text === value) { if (item.text === value) {
data = item; data = item;
} }

4
src/app/link_set/more/more.link.component.ts

@ -1,5 +1,5 @@
import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index'; import {WidgetType, Vertical, SearchEditor, Left, Vtape} from '@ui/index';
import {databaseTyle} from '../select/select.service'; import {DATA_BASE_TYPE} from '@private/constants';
import MoreLinkItem from './more.link.item.component'; import MoreLinkItem from './more.link.item.component';
const className = 'fr.component.linkSet.morelink'; const className = 'fr.component.linkSet.morelink';
let morkLinkItem: any = null; let morkLinkItem: any = null;
@ -34,7 +34,7 @@ const Widget: WidgetType = {
this._renderItems(); this._renderItems();
}, },
_renderItems(text = '') { _renderItems(text = '') {
const databaseLink = databaseTyle.slice(12, 12 + 33); const databaseLink = DATA_BASE_TYPE.slice(12, 12 + 33);
const items: any[] = []; const items: any[] = [];
const that = this; const that = this;
databaseLink.forEach(item => { databaseLink.forEach(item => {

0
src/plugins/jndi/jdni.typing.d.ts → src/app/link_set/right/right.typing.d.ts vendored

36
src/app/link_set/right/right_detail/right.detail.component.ts

@ -1,53 +1,31 @@
import {WidgetType, Vertical} from '@ui/index'; import {WidgetType, Vertical} from '@ui/index';
import Model from '../../link-set.model'; import Model from '../../link-set.model';
import Title from '../right_title/right.title.component'; import {renderEdit} from './right.detail.service';
import RightShow from '../right_show/right.show.component';
import RightEdit from '../right_edit/right.edit.component';
import RightEditMysql from '../right_edit/right.edit.mysql.component';
import {LinkType} from '@ui/type'; import {LinkType} from '@ui/type';
import pluginListConstant from '../../../app.constant';
const className = 'fr.component.right.detail'; const className = 'fr.component.right.detail';
let rightDetail: any = null;
const renderEdit = (linkSelected: LinkType): void => {
const plugins: string[] = BI.Constants.getConstant(pluginListConstant);
const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text);
let typeEdit = linkSelected.databaseType === 'mysql' ? RightEditMysql : RightEdit;
if (isPlugin) {
typeEdit = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`);
}
const showPage = !isPlugin ? RightShow : BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`);
rightDetail.populate(BI.createItems([
{
type: Title,
isEdit: linkSelected.isSelected,
linkSelected,
}, {
type: linkSelected.isSelected ? typeEdit : showPage,
linkSelected,
},
]));
};
const Widget: WidgetType = { const Widget: WidgetType = {
_store() { _store() {
return BI.Models.getModel(Model); return BI.Models.getModel(Model);
}, },
watch: { watch: {
linkSelected(linkSelected: LinkType) { linkSelected(linkSelected: LinkType) {
renderEdit(linkSelected); renderEdit(this.rightDetail, linkSelected);
}, },
}, },
render() { render() {
return { return {
type: Vertical, type: Vertical,
cls: 'right-content', cls: 'right-content',
ref(_ref: any) { ref: _ref => {
rightDetail = _ref; this.rightDetail = _ref;
}, },
}; };
}, },
mounted() { mounted() {
const linkSelected: LinkType = this.model.linkSelected; const linkSelected: LinkType = this.model.linkSelected;
renderEdit(linkSelected); renderEdit(this.rightDetail, linkSelected);
}, },
}; };
BI.shortcut(className, BI.inherit(BI.Widget, Widget)); BI.shortcut(className, BI.inherit(BI.Widget, Widget));

43
src/app/link_set/right/right_detail/right.detail.service.ts

@ -0,0 +1,43 @@
import Title from '../right_title/right.title.component';
import RightShow from '../right_show/right.show.component';
import RightShowJndi from '../right_show/right.show.jndi.component';
import RightEdit from '../right_edit/right.edit.component';
import RightEditMysql from '../right_edit/right.edit.mysql.component';
import RightEditJndi from '../right_edit/right.edit.jndi.component';
import {LinkType} from '@ui/type';
import pluginListConstant from '../../../app.constant';
import {MYSQL_CONNECT, JNDI_CONNECT} from '@private/constants';
export const renderEdit = (rightDetail, linkSelected: LinkType): void => {
const plugins: string[] = BI.Constants.getConstant(pluginListConstant);
const isPlugin = BI.some(plugins, (index: number, item: string) => item === linkSelected.text);
let editPage = null;
let showPage = null;
switch (linkSelected.text) {
case (MYSQL_CONNECT):
editPage = RightEditMysql;
showPage = RightShow;
break;
case (JNDI_CONNECT):
editPage = RightEditJndi;
showPage = RightShowJndi;
break;
default:
editPage = RightEdit;
showPage = RightShow;
}
if (isPlugin) {
editPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.edit`);
showPage = BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${linkSelected.text.toLowerCase()}.preview`);
}
rightDetail.populate(BI.createItems([
{
type: Title,
isEdit: linkSelected.isSelected,
linkSelected,
}, {
type: linkSelected.isSelected ? editPage : showPage,
linkSelected,
},
]));
};

4
src/app/link_set/right/right_edit/right.edit.component.ts

@ -1,6 +1,6 @@
import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index';
import {LinkType} from '@ui/type'; import {LinkType} from '@ui/type';
import charset from './right.edit.constant'; import {CONNECT_CHARSET} from '@private/constants';
import Model from '../../link-set.model'; import Model from '../../link-set.model';
import FormItem from '@shared/components/form.item.component'; import FormItem from '@shared/components/form.item.component';
import Title from '@shared/components/title.component'; import Title from '@shared/components/title.component';
@ -119,7 +119,7 @@ const Widget: WidgetType = {
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: '', value: '',
}, },
...BI.Constants.getConstant(charset), ...CONNECT_CHARSET,
], ],
listeners: [{ listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: BI.TextValueCombo.EVENT_CHANGE,

38
src/app/link_set/right/right_edit/right.edit.constant.ts

@ -1,38 +0,0 @@
export const ConstantName = 'bi.constant.database.conf.charset.list';
export const Constant = BI.constant(ConstantName, [
{
text: 'GBK',
value: 'GBK',
},
{
text: 'BIG5',
value: 'BIG5',
},
{
text: 'ISO-8859-1',
value: 'ISO-8859-1',
},
{
text: 'UTF-8',
value: 'UTF-8',
},
{
text: 'UTF-16',
value: 'UTF-16',
},
{
text: 'EUC_JP',
value: 'EUC_JP',
},
{
text: 'EUC_KR',
value: 'EUC_KR',
},
{
text: 'CP850',
value: 'CP850',
},
]);
export default ConstantName;

35
src/plugins/jndi/jndi.edit.ts → src/app/link_set/right/right_edit/right.edit.jndi.component.ts

@ -1,16 +1,13 @@
import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui'; import {Vertical, Editor, TextValueCombo, TextButton, Label} from '@ui';
import {FACTORYS, OTHER_ATTRIBUTES, ORIGINAL_CHARSET_NAMES} from './jndi.service';
import FormItem from '@shared/components/form.item.component'; import FormItem from '@shared/components/form.item.component';
import {AttributeType, FormType} from './jdni.typing'; import {JNDI_FACTORYS, OTHER_ATTRIBUTES, CONNECT_CHARSET} from '@private/constants';
import './jdni.scss'; import {AttributeType} from '../right.typing';
const RedisConstantName = 'dec.constant.database.conf.connect.form.jndi.value';
const form: FormType = {
url: '192.168.1.22',
};
const classNameEdit = 'dec.plugin.jndi.edit'; const classNameEdit = 'fr.component.right.edit.jndi';
const Widget = BI.inherit(BI.Widget, { const Widget = BI.inherit(BI.Widget, {
render() { render() {
const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options;
return { return {
type: Vertical, type: Vertical,
cls: 'right-show', cls: 'right-show',
@ -23,7 +20,7 @@ const Widget = BI.inherit(BI.Widget, {
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: form.connectionName, value: connectionName,
}, },
}, },
{ {
@ -45,8 +42,8 @@ const Widget = BI.inherit(BI.Widget, {
type: TextValueCombo, type: TextValueCombo,
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
value: form.factory, value: factory,
items: BI.map(FACTORYS, (index: number, item: string) => { items: BI.map(JNDI_FACTORYS, (index: number, item: string) => {
return { return {
text: item, text: item,
value: item, value: item,
@ -63,7 +60,7 @@ const Widget = BI.inherit(BI.Widget, {
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: form.url, value: url,
}, },
}, },
{ {
@ -75,7 +72,7 @@ const Widget = BI.inherit(BI.Widget, {
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: form.principal, value: principal,
}, },
}, },
{ {
@ -87,7 +84,7 @@ const Widget = BI.inherit(BI.Widget, {
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: form.credentials, value: credentials,
}, },
}, },
{ {
@ -130,7 +127,7 @@ const Widget = BI.inherit(BI.Widget, {
cls: 'bi-border', cls: 'bi-border',
width: 300, width: 300,
allowBlank: true, allowBlank: true,
value: form[item.name], value: this.options[item.name],
}, },
}; };
}), }),
@ -166,9 +163,9 @@ const Widget = BI.inherit(BI.Widget, {
width: 300, width: 300,
items: [{ items: [{
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: form.originalCharsetName, value: originalCharsetName,
}, },
...ORIGINAL_CHARSET_NAMES, ...CONNECT_CHARSET,
], ],
}, },
}, },
@ -181,7 +178,3 @@ const Widget = BI.inherit(BI.Widget, {
}); });
BI.shortcut(classNameEdit, Widget); BI.shortcut(classNameEdit, Widget);
export default classNameEdit; export default classNameEdit;
export const ConstantName = 'dec.constant.database.conf.connect.list';
BI.config(ConstantName, (datas: string[]) => [...datas, 'JNDI']);
BI.constant(RedisConstantName, form);
BI.constant('dec.constant.database.conf.connect.form.jndi.edit', classNameEdit);

4
src/app/link_set/right/right_edit/right.edit.mysql.component.ts

@ -1,6 +1,6 @@
import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index'; import {WidgetType, Vertical, MultiSelectItem, TextAreaEditor, Editor, Button, TextValueCombo} from '@ui/index';
import {LinkType} from '@ui/type'; import {LinkType} from '@ui/type';
import charset from './right.edit.constant'; import {CONNECT_CHARSET} from '@private/constants';
import Model from '../../link-set.model'; import Model from '../../link-set.model';
import FormItem from '@shared/components/form.item.component'; import FormItem from '@shared/components/form.item.component';
import Title from '@shared/components/title.component'; import Title from '@shared/components/title.component';
@ -91,7 +91,7 @@ const Widget: WidgetType = {
text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
value: '', value: '',
}, },
...BI.Constants.getConstant(charset), ...CONNECT_CHARSET,
], ],
listeners: [{ listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: BI.TextValueCombo.EVENT_CHANGE,

33
src/plugins/jndi/jndi.preview.ts → src/app/link_set/right/right_show/right.show.jndi.component.ts

@ -1,14 +1,13 @@
import {Vertical, Label, TextButton} from '@ui'; import {Vertical, TextButton, Label} from '@ui';
import FormItem from '@shared/components/form.item.component'; import FormItem from '@shared/components/form.item.component';
import {FormType, AttributeType} from './jdni.typing'; import {OTHER_ATTRIBUTES} from '@private/constants';
import {OTHER_ATTRIBUTES} from './jndi.service'; import {AttributeType} from '../right.typing';
const JndiPreview = 'fr.plugin.jndi.preview'; const className = 'fr.component.right.show.jndi';
const JndiConstantName = 'dec.constant.database.conf.connect.form.jndi.value'; const Widget = BI.inherit(BI.Widget, {
const jndiForm: FormType = BI.Constants.getConstant(JndiConstantName);
const jndiWidget = BI.inherit(BI.Widget, {
render() { render() {
const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options;
return { return {
type: Vertical, type: Vertical,
cls: 'right-show', cls: 'right-show',
@ -18,7 +17,7 @@ const jndiWidget = BI.inherit(BI.Widget, {
text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'), text: BI.i18nText('Dec-Dcm_Connection_JNDI_Form_ConnectionName'),
form: { form: {
type: Label, type: Label,
text: jndiForm.connectionName, text: connectionName,
}, },
}, },
{ {
@ -38,7 +37,7 @@ const jndiWidget = BI.inherit(BI.Widget, {
width: 180, width: 180,
form: { form: {
type: Label, type: Label,
text: jndiForm.factory, text: factory,
}, },
}, },
{ {
@ -47,7 +46,7 @@ const jndiWidget = BI.inherit(BI.Widget, {
width: 180, width: 180,
form: { form: {
type: Label, type: Label,
text: jndiForm.url, text: url,
}, },
}, },
{ {
@ -56,7 +55,7 @@ const jndiWidget = BI.inherit(BI.Widget, {
width: 180, width: 180,
form: { form: {
type: Label, type: Label,
text: jndiForm.principal, text: principal,
}, },
}, },
{ {
@ -65,7 +64,7 @@ const jndiWidget = BI.inherit(BI.Widget, {
width: 180, width: 180,
form: { form: {
type: Label, type: Label,
text: jndiForm.credentials, text: credentials,
}, },
}, },
{ {
@ -105,7 +104,7 @@ const jndiWidget = BI.inherit(BI.Widget, {
width: 180, width: 180,
form: { form: {
type: Label, type: Label,
text: jndiForm[item.name], text: this.options[item.name],
}, },
}; };
}), }),
@ -128,12 +127,12 @@ const jndiWidget = BI.inherit(BI.Widget, {
text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'),
form: { form: {
type: Label, type: Label,
text: jndiForm.originalCharsetName ? jndiForm.originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'), text: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Auto'),
}, },
}, },
], ],
}; };
}, },
}); });
BI.shortcut(JndiPreview, jndiWidget); BI.shortcut(className, Widget);
BI.constant('dec.constant.database.conf.connect.form.jndi.preview', JndiPreview); export default className;

5
src/app/link_set/select/select.component.ts

@ -1,7 +1,8 @@
import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui'; import {WidgetType, Combo, ButtonGroup, TextItem, Vertical} from '@ui';
import selectModel from '../link-set.model'; import selectModel from '../link-set.model';
import {moreLink} from '../more/more.link.service'; import {moreLink} from '../more/more.link.service';
import connectList, {links} from '../../app.constant'; import connectList from '../../app.constant';
import {DATA_LINKS} from '@private/constants';
const className = 'fr.linkset.select'; const className = 'fr.linkset.select';
const Widget: WidgetType = { const Widget: WidgetType = {
_store() { _store() {
@ -24,7 +25,7 @@ const Widget: WidgetType = {
el: { el: {
type: ButtonGroup, type: ButtonGroup,
cls: 'database-link-items', cls: 'database-link-items',
items: [...BI.map([...links, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => { items: [...BI.map([...DATA_LINKS, ...BI.Constants.getConstant(connectList)], (index: number, item: string) => {
return { return {
type: TextItem, type: TextItem,
height: 24, height: 24,

261
src/app/link_set/select/select.service.ts

@ -1,266 +1,5 @@
import {LinkType} from '@ui/type'; import {LinkType} from '@ui/type';
import pluginListConstant from '../../app.constant'; import pluginListConstant from '../../app.constant';
import {OTHER_CONNECT} from '@private/constants';
export const databaseTyle = [
{
text:'APACHE KYLIN',
databaseType: 'apache-kylin',
driver: 'org.apache.kylin.jdbc.Driver',
url: 'jdbc:kylin://<hostname>:<port>/<kylin_project_name>',
},
{
text:'DERBY',
databaseType: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
url: 'jdbc:derby://localhost:1527/',
},
{
text:'HP Vertica',
databaseType: 'hp-vertica',
driver: 'com.vertica.jdbc.Driver',
url: 'jdbc:vertica://ip:port/databaseName',
},
{
text:'IBM DB2',
databaseType: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
url: 'jdbc:db2://hostname:port/dbname',
},
{
text:'INFORMIX',
databaseType: 'informix',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
},
{
text:'Microsoft SQL Server',
databaseType: 'sql-server',
driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url: 'jdbc:sqlserver://localhost:1433;databaseName=',
},
{
text:'Oracle',
databaseType: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
url: 'jdbc:oracle:thin:@localhost:1521:databaseName',
},
{
text:'Privotal Greenplum Database',
databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text:'Postgresql',
databaseType: 'postgresql',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text:'GaussDB 200',
databaseType: 'hw-libr-a',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text:'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text: OTHER_CONNECT,
databaseType: 'other',
driver: 'org.h2.Driver',
drivers:['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'],
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
{
text:'ADS',
databaseType:'ads',
driver:'com.mysql.jdbc.Driver',
url:'jdbc:mysql://hostname:port/my_ads_db',
},
{
text:'Amazon Redshift',
databaseType:'amazon-redshift',
driver: 'com.amazon.redshift.jdbc4.Driver',
drivers:['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'],
url:'jdbc:redshift://endpoint:port/database',
},
{
text:'APACHE IMPALA',
databaseType:'apache-impala',
driver:'com.cloudera.impala.jdbc41.Driver',
url:'jdbc:impala://hostname:port/_impala_builtins',
},
{
text:'APACHE KYLIN',
databaseType:'apache-kylin',
driver:'org.apache.kylin.jdbc.Driver',
url:'jdbc:kylin://<hostname>:<port>/<kylin_project_name>',
},
{
text:'APACHE Phoenix',
databaseType: 'apache-phoenix',
driver: 'org.apache.phoenix.jdbc.PhoenixDriver',
url: 'jdbc:phoenix:hostname:port/dbname',
},
{
text:'DERBY',
databaseType: 'derby',
driver: 'org.apache.derby.jdbc.ClientDriver',
url: 'jdbc:derby://localhost:1527/',
},
{
text:'Gbase 8A',
databaseType: 'gbase-8a',
driver: 'com.gbase.jdbc.Driver',
url: 'jdbc:gbase://hostname:port/dbname',
},
{
text:'Gbase 8S',
databaseType: 'gbase-8s',
driver: 'com.gbasedbt.jdbc.IfxDriver',
url: 'jdbc:gbasedbt-sqli://{host}:{port}/{database}',
},
{
text:'Gbase 8T',
databaseType: 'gbase-8t',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
},
{
text:'H2',
databaseType: 'h2',
driver: 'org.h2.Driver',
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
{
text:'华为云DWS',
databaseType: 'hw-dws',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text:'FusionInsight elk',
databaseType: 'hw-elk',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
},
{
text:'FusionInsight HD',
databaseType: 'hw-fusioninsight-hd',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;',
},
{
text:'GaussDB 200',
databaseType: 'hw-libr-a',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text:'Hadoop Hive',
databaseType: 'hadoop-hive',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text:'Hbase',
databaseType: 'hbase',
driver: 'org.apache.phoenix.jdbc.PhoenixDriver',
url: 'jdbc:phoenix:hostname:port/dbname',
}, {
text:'HP Vertica',
databaseType: 'hp-vertica',
driver: 'com.vertica.jdbc.Driver',
url: 'jdbc:vertica://ip:port/databaseName',
}, {
text:'Hsql',
databaseType: 'hsql',
driver: 'com.fr.third.org.hsqldb.jdbcDriver',
url: 'jdbc:hsqldb:file:[PATH_TO_DB_FILES]',
}, {
text:'IBM DB2',
databaseType: 'ibm-db2',
driver: 'com.ibm.db2.jcc.DB2Driver',
url: 'jdbc:db2://hostname:port/dbname',
}, {
text:'INFORMIX',
databaseType: 'informix',
driver: 'com.informix.jdbc.IfxDriver',
url: 'jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}',
}, {
text:'KINGBASE',
databaseType: 'kingbase',
driver: 'com.kingbase.Driver',
url: 'jdbc:kingbase://hostname:port',
}, {
text:'Microsoft SQL Server',
databaseType: 'sql-server',
driver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
url: 'jdbc:sqlserver://localhost:1433;databaseName=',
}, {
text:'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text:'Oracle',
databaseType: 'oracle',
driver: 'oracle.jdbc.driver.OracleDriver',
url: 'jdbc:oracle:thin:@localhost:1521:databaseName',
},
{
text:'Pivotal Greenplum Database',
databaseType: 'pivotal-greenplum-database',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text:'Postgresql',
databaseType: 'postgresql',
driver: 'org.postgresql.Driver',
url: 'jdbc:postgresql://hostname:port/dbname',
}, {
text:'Presto',
databaseType: 'presto',
driver: 'com.facebook.presto.jdbc.PrestoDriver',
url: 'jdbc:presto://host:port/catalog',
}, {
text:'SAP HANA',
databaseType: 'sap-hana',
driver: 'com.sap.db.jdbc.Driver',
url: 'jdbc:sap://hostname:port?reconnect=true',
}, {
text:'SAP Sybase',
databaseType: 'sap-sybase',
driver: 'com.sybase.jdbc4.jdbc.SybDriver',
url: 'jdbc:sybase:Tds:hostname:2638/databasename',
}, {
text:'SPARK',
databaseType: 'spark',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
}, {
text:'Sqlite',
databaseType: 'sqlite',
driver: 'org.sqlite.JDBC',
url: 'jdbc:sqlite:[PATH_TO_DB_FILES]',
}, {
text:'TeraData',
databaseType: 'teradata',
driver: 'com.ncr.teradata.TeraDriver',
url: 'jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT',
}, {
text:'TRANSWARP INCEPTOR',
databaseType: 'transwarp-inceptor',
driver: 'org.apache.hive.jdbc.HiveDriver',
url: 'jdbc:hive2://hostname:port/databasename',
},
];
export const getCnnectionName = (links: LinkType[], name: string): string => { export const getCnnectionName = (links: LinkType[], name: string): string => {
const plugins: string[] = BI.Constants.getConstant(pluginListConstant); const plugins: string[] = BI.Constants.getConstant(pluginListConstant);

3
src/plugins/jndi/jdni.scss

@ -1,3 +0,0 @@
.jndi-notice{
color: red;
}

54
src/plugins/jndi/jndi.pool.ts

@ -1,54 +0,0 @@
const JndiPool = 'fr.plugin.jndi.pool';
const JndiWidget = BI.inherit(BI.Widget, {
render() {
const {maxActive, numActive} = this.options;
return {
type: 'bi.left',
items: [
{
type: 'bi.left',
cls: 'right-status-item',
items: [
{
type: 'bi.vertical',
cls: 'right-status-board',
items: [
{
type: 'bi.vertical',
cls: 'right-status-board-item',
items: [
{
type: 'bi.label',
cls: 'right-status-text',
extraCls: 'card-font1',
text: numActive,
},
{
type: 'bi.label',
cls: 'right-status-text',
text: '/',
},
{
type: 'bi.label',
cls: 'right-status-text',
text: maxActive,
},
],
},
{
type: 'bi.label',
height: 20,
text: BI.i18nText('Dec-Dcm_Active_Connections_Number'),
},
],
},
],
},
],
};
},
});
BI.shortcut(JndiPool, JndiWidget);
BI.constant('dec.constant.database.conf.connect.form.jndi.pool', JndiPool);

87
src/plugins/jndi/jndi.service.ts

@ -1,87 +0,0 @@
import {AttributeType} from './jdni.typing';
export const FACTORYS = ['', 'weblogic.jndi.WLInitialContextFactory', 'com.ibm.websphere.naming.WsnInitialContextFactory', 'org.jboss.naming.HttpNamingContextFactory', 'org.jnp.interfaces.NamingContextFactory', 'com.caucho.burlap.BurlapContextFactory'];
export const OTHER_ATTRIBUTES: AttributeType[] = [
{
text: 'OBJECT_FACTORIES',
name: 'objectFactories',
},
{
text: 'STATE_FACTORIES',
name: 'stateFactories',
},
{
text: 'URL_PKG_PREFIXES',
name: 'urlPkgPrefixes',
},
{
text: 'DNS_URL',
name: 'dnsUrl',
},
{
text: 'AUTHORITATIVE',
name: 'authoritative',
},
{
text: 'BATCHSIZE',
name: 'batchSize',
},
{
text: 'REFERRAL',
name: 'referral',
},
{
text: 'SECURITY_PROTOCOL',
name: 'securityProtocol',
},
{
text: 'SECURITY_AUTHENTICATION',
name: 'securityAuthentication',
},
{
text: 'LANGUAGE',
name: 'language',
},
{
text: 'APPLET',
name: 'applet',
},
];
export const ORIGINAL_CHARSET_NAMES = [
{
text: 'GBK',
value: 'GBK',
},
{
text: 'BIG5',
value: 'BIG5',
},
{
text: 'ISO-8859-1',
value: 'ISO-8859-1',
},
{
text: 'UTF-8',
value: 'UTF-8',
},
{
text: 'UTF-16',
value: 'UTF-16',
},
{
text: 'EUC_JP',
value: 'EUC_JP',
},
{
text: 'EUC_KR',
value: 'EUC_KR',
},
{
text: 'CP850',
value: 'CP850',
},
]
;
Loading…
Cancel
Save