Compare commits

...

250 Commits

Author SHA1 Message Date
Sébastien Gandon
f2b585bf41 Merge release/5.0.2/tis_shared and release/5.0.2/tos for release/5.0.2. 2014-06-22 14:15:26 +02:00
fgzhang
43fc4bf9b8 selenium:grid:
TestNumberFormatExceptionAboutTriggerRepetitions---testNumberFormatExceptionSmaller()
 --removed codes of check task'status(Ready to deploy)


git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@78310 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-16 02:01:37 +00:00
ycbai
db7bf18e62 bug TDI-18244 modified: Cannot retrieve synonym Schema in 4.1.3
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@78301 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-15 10:12:13 +00:00
fgzhang
73b133a4b0 selenium:modified cases:
TestAddTaskBaseBranchProject---testRemoveTaskWithComplicatedItems()
  --changed time interval, add a judge of task'status

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@78263 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-15 01:30:11 +00:00
fgzhang
88b93282d5 selenium:menu:
TestMenuDisplayBeforeAuthorizeAllRolesToAdmin---testMenuConfiguration()
 --change xpath of "Audit (6 Parameters)"

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@78262 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-15 01:25:41 +00:00
wchen
5b6377f760 bug TDI-19655 fixed:after create amc connection,click amc,there is error
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@78208 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-13 10:39:22 +00:00
fgzhang
6a747e1c3b selenium:modified cases:
menu	:
TestMenuDisplayBeforeAuthorizeAllRolesToAdmin---testMenuProjectAuthorization()
 --change xpath of DI/DQ/MDM in "ProjectAuthorization" page
testMenuConfiguration()
 --change xpath of "Audit (5 Parameters)"

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@78202 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-13 10:03:44 +00:00
fgzhang
1e341cbbed selenium:removed some test nodes
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77969 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-07 09:48:10 +00:00
wchen
59e76475bf bug TDI-19553 fixed:Unhandled event loop exception when trying to create an MDM connection in DI repo with SVN
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77943 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-07 04:05:19 +00:00
zcui
90cc490ffb selenium:update testAddNewReferenceProjectAndCheckItAppearInProjectAuthorizationAndReferences
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77936 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-07 02:42:00 +00:00
nrousseau
c77a177d16 merge r77917 from trunk to branch 5.0
bug TDI-19552 fixed: fix a problem of refresh and a problem to open the SQL Builder. Limit at the same time the number of tables who can be retrieved in the sql builder (will need to add a preference in the future)


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77920 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-06 11:08:30 +00:00
jwang
11ae54e631 bug TDI-19432 fixed : No Warning/Error when creating an XML file metadata with the same name than an already existing one!
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77886 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-06 08:57:35 +00:00
xqliu
e208c1477f TDQ-4571 delete the commented method to keep the code clean
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77846 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-06 03:09:19 +00:00
fwang
cbe84fe2c0 bug TDI-19382 fixed Oracle:Retrieve Synonym, NPE error
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77821 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 11:45:11 +00:00
qiongli
1b4c0f2e1c TDQ-4498 TDQ-4507 improve code quality (avoid null).
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77819 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 11:14:02 +00:00
plv
9d4d94b0f4 bug TDI-19496 fixed:create a jdbc connection ,create a job,click to stats&logs,choose the db,the url is null
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77801 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 10:02:50 +00:00
fzhong
00692717d0 SWTBot: modify the shell titile of confirm dialog when changing database properties
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77784 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 08:56:06 +00:00
fgzhang
8a7f91095a selenium:add case for test stop conductor
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77779 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 08:41:55 +00:00
fgzhang
793f755443 selenium:add nodes for excute stop conductor of class/parameter/method/include
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77778 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 08:41:19 +00:00
dfcao
bd081276ce SWTBot:update TalendBusinessModelItem the getEditor method
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77776 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 08:32:41 +00:00
ycbai
25c98ef652 bug TDI-18289 fixed: Can't retrive table schema with specific ODBC driver
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77765 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 07:22:27 +00:00
plv
13c64230a3 bug TDI-19496 fixed:create a jdbc connection ,create a job,click to stats&logs,choose the db,the url is null
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77750 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 06:28:08 +00:00
xqliu
f59ce673b8 TDQ-4474 TDQ-4571 1) modify the logic of don't reload connection; 2) remove the class ConfirmReloadConnectionUtils, 3) avoid a potential NPE of the method of DatabaseWizard.performFinish()'s tdqRepService
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77746 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 06:20:07 +00:00
jwang
66e2429404 bug TDI-19519 fixed : [XML Repository]Each time one attribute is drag&drop from the input repository, it will add one _ in front of the name of the attribute.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77745 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 06:19:56 +00:00
fgzhang
09725e4f5f selenium:add common method(undeployStopConductor) to class(ESBConductorUtils)
change case(testUndeployESBConductor), use method(undeployStopConductor), add some related variables
change case(testDeployESBConductor/testStartESBConductor), use method(deployStartConductor), add some related variables

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77729 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 03:45:29 +00:00
fgzhang
034614ee88 selenium:add case for test start conductor
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77721 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 03:13:57 +00:00
zcui
b8c6b269f9 selenium:update testChangeUserRoleAndCheckRoleDisplay
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77711 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 02:50:58 +00:00
qiongli
cfd9fa3f6e TDQ-4498 TDQ-4507 avoid that catalog name is null.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77707 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 02:42:19 +00:00
fzhong
d406c66719 SWTBot: modify VariablesTabTest about could not find button in context setting tab
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77700 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 02:07:51 +00:00
fgzhang
6a94875627 selenium:add include node of undeployed
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77697 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 02:01:35 +00:00
fgzhang
982cb5dd5b selenium:add case for test undeployed
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77696 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 01:59:08 +00:00
fgzhang
1fecb2652e selenium:change xpath of service'status
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77694 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 01:57:55 +00:00
fgzhang
f969f886d7 selenium:change xpath of service'status
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77693 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 01:57:15 +00:00
nrousseau
2d49e6dc43 merge r77687 from trunk to branch 5.0
bug TDI-19434 fixed: fix a problem of performance in the xml wizard


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77688 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-03 01:32:50 +00:00
scorreia
bd8f6aed46 TDQ-4377 missing i18n files added to build.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77684 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 17:05:51 +00:00
qiongli
c5ffded55e TDQ-4498 TDQ-4507 create a new method to get Catalog by connection and catalog name.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77673 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 10:44:29 +00:00
qiongli
e9cd1a8c56 TDQ-4498 TDQ-4588 only Mysql just have catalog.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77652 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 10:02:17 +00:00
cli
30f8eea20f TDI-19230: refactor and enhance performance.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77651 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 10:01:09 +00:00
wchen
24d47835ed bug TDI-19509 fixed: there are a lot of tujs down
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77646 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 09:35:23 +00:00
fzhong
d52a48890f SWTBot: modify joblet editor shell name to 'Edit properties'
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77636 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 09:18:02 +00:00
zcui
2db88b9d14 selenium:upate TestUserSettings for reset svn account
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77628 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 08:52:33 +00:00
ycbai
213a802916 bug TDI-19471 modified: Impossible to retrieve any schema from copybook
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77622 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 08:20:46 +00:00
zcui
4318d2da96 selenium:add cases of esbconductor for delete
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77620 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 08:15:27 +00:00
nrousseau
bcea0ced8d merge r77610 from trunk to branch 5.0
bug TDI-6463 fixed: improve / review code done before


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77617 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 08:11:49 +00:00
nrousseau
07e3c18eef merge r77609 from trunk to branch 5.0
bug TDI-6463 fixed: improve / review code done before


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77615 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 08:07:16 +00:00
zcui
7775e93a71 selenium:testDuplicateESBConductor
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77607 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 07:11:40 +00:00
zcui
128bddb99f selenium:add cases of esbconductor named testDuplicateESBConductor
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77606 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 07:09:20 +00:00
fgzhang
f8ef3883df selenium:add case for test add a esbconductor with already exist label
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77605 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 06:58:33 +00:00
fgzhang
ccb8e0f31b selenium:add node of method and include
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77604 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 06:57:27 +00:00
zcui
7023a96755 selenium:update testChangeSVNaCCOUNT
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77585 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 04:01:21 +00:00
zcui
32743cfc99 selenium:remove test testForgetPassword
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77573 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 03:33:03 +00:00
zcui
f973b10c61 selenium:update testMenuConfiguration for remove extended parameters
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77566 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 02:42:29 +00:00
fgzhang
3e9fc57319 selenium:add file for esbconductor of esbconductor.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77565 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 02:36:04 +00:00
fgzhang
a134942366 selenium:add methods
ESBConductorUtils---addESBConductor()
  --add method for add esbconductor
ESBConductorUtils---selectDropDownListForESBConductor()
  --add method for select drop-down list
ESBConductorUtils---intoESBConductorPage()
  --go to ESBConductor page

add cases
TestAddESBConductor---testAddESBConductorOfService()
  --add esbconductor of service

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77564 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-02 02:34:54 +00:00
scorreia
9b5a4cd88c i18n: synchronize Babili strings exported on 2012-02-01-16-07-48
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77559 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 16:31:19 +00:00
ycbai
9c77033398 bug TDI-19471 fixed: Impossible to retrieve any schema from copybook
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77533 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 09:31:24 +00:00
xqliu
e16a56255d TDQ-4474 TDQ-4571 enhance the confirm dialog, add a radio group: reload or don't reload the connection
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77531 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 09:25:28 +00:00
zcui
9ff86cf428 selenium:modify parameters for commondline
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77526 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 09:05:48 +00:00
zcui
a750abfcd4 selenium:modify some parameters
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77518 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 08:28:58 +00:00
nrousseau
3435745cf2 merge r77506 from trunk to branch 5.0
bug TDI-19399 fixed: enhance and fix a problem when close the studio later. Avoid to keep too many things in history. Note that we don't really use actually the editor's history, so we can keep really minimum in memory.


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77516 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 08:26:23 +00:00
zcui
222160fd8e selenium:update cases about configurations
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77515 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 08:24:58 +00:00
nrousseau
381b99cc13 merge r77503 from trunk to branch 5.0
bug TDI-19399 fixed: enhance and fix a problem when close the studio later. Avoid to keep too many things in history. Note that we don't really use actually the editor's history, so we can keep really minimum in memory.


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77514 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 08:23:47 +00:00
zcui
19c3873e64 selenium:update TestForgetPassword.testForgetPassword
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77513 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 08:23:34 +00:00
zcui
ea148f4816 selenium:update xpath of jobconductor in configurations
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77512 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 08:22:23 +00:00
wchen
036679f052 bug TDI-18780 fixed: After migration from 3.2.3, Retrieve schema problems in 4.2.3
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77498 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 07:32:22 +00:00
zcui
3d2306636b selenium:update xpath of esb zookeeper server and monitor server edit button
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77482 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 05:11:37 +00:00
nrousseau
639584ab31 merge r77448 from trunk to branch 5.0
bug TDI-19399 fixed: avoid some exceptions found in the logs provided


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77463 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 02:32:32 +00:00
nrousseau
4a63c9c103 merge r77447 from trunk to branch 5.0
bug TDI-19399 fixed: avoid some exceptions found in the logs provided


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77452 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-02-01 02:08:51 +00:00
jwang
0bcc946d9c bug TDI-19315 fixed : Joblet_there are some garbage strings on 'Edit Properties' module of joblet.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77403 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 07:55:12 +00:00
dfcao
bac25aa1d4 SWTBot:add test ValuesAsTableTabOfContextTest
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77397 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 07:11:41 +00:00
wchen
112f7f24b2 bug TDI-19229 fixed: Can't list connection (Metadata) from reference project
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77394 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 06:28:31 +00:00
zcui
b9dabbf0b3 selenium:add new cases testAuditTrunkStopRelaunchAudit to audit.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77391 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 06:09:08 +00:00
zcui
9f8b2e6bac selenium:add new cases testAuditTrunkStopRelaunchAudit
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77390 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 06:08:19 +00:00
fzhong
0d58d9d9ee SWTBot: add test for context UpdateDependentJobsTest and modified before method name of VariablesTabTest
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77386 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 05:48:31 +00:00
dfcao
96143d4687 SWTBot:update ValuesAsTreeTabOfContextTest add test if order by context and if edit the value of built-in type
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77373 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-31 02:49:25 +00:00
zcui
2479dff46a selenium:add parameters for case rolesright
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77348 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 09:53:11 +00:00
zcui
7c8f927a26 selenium:update TestUserSettings.testChangePasswdOfCurrentUser
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77346 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 09:51:56 +00:00
zcui
31f7742d23 selenium:add testDesignerReadForConfigurations
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77345 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 09:49:35 +00:00
zcui
11ac2e0a80 selenium:update login.login()
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77344 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 09:48:44 +00:00
wchen
66998b8825 bug TDI-19149 fixed: tXMLMap: import from MDM metadata, root element and looping issues
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77342 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 08:38:48 +00:00
jwang
ab052f5191 bug TDI-18270 fixed : Tweaks for retrieve schema wizard.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77341 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 08:38:35 +00:00
zcui
3386f760ab selenium:add cases about designer and viewer's read right to server and virtual server
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77318 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 03:24:05 +00:00
zcui
d9af410ab8 selenium:new cases added:
testConnectionCheckWithLogsTableNotExist
testConnectionCheckWithMetersTableNotExist
testConnectionCheckWithStatTableNotExist

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77317 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 03:18:00 +00:00
zcui
803fe0830d selenium:add parameters for connection
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77316 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 03:15:45 +00:00
fzhong
9ee4bfe6c1 SWTBot: add test for context VariableTabTest
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77315 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 03:12:06 +00:00
dfcao
2908b32699 SWTBot:update ValuesAsTreeTabOfContextTest add the message of assertEquals
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77314 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-30 02:58:49 +00:00
dfcao
ebf591c4ff git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77311 f6f1c999-d317-4740-80b0-e6d1abc6f99e 2012-01-30 02:48:03 +00:00
wwang
e04e9c0dfc fix Bug TDI-19179 : a better solution for ignore the namespace prefix in xpath
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77298 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-29 09:02:37 +00:00
wwang
895a444658 fix Bug TDI-19179 : merge to branch5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77290 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-29 05:56:22 +00:00
rdubois
bc882f0c90 merge r77285 from trunk to branch 5.0
TDI-19445: add the defaultLength property for the LONG type in the oracle mapping file


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77286 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-27 13:12:42 +00:00
rdubois
900042be5a merge r77271 from trunk to branch 5.0
TDI-19419: add code format


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77272 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-27 08:36:06 +00:00
rdubois
13ddaa893f merge r77268 from trunk to branch 5.0
TDI-19419: add annotations to fix the warnings issue


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77269 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-26 17:11:18 +00:00
hwang
a42d757a73 TDI-19379:Studio/Metadata/MDM: drag different node to "Fileds-to-extract" column name is truncated
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77152 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-20 05:38:28 +00:00
zcui
3821991c04 selenium:add new class TestNumberFormatExceptionAboutTriggerRepetitions to grid.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77084 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-19 07:31:42 +00:00
zcui
14dbc5d8d3 selenium:
update for :testFutureTriggerExecutionsCountsSameWithPageSize
new cases added :
testNumberFormatExceptionBigger
testNumberFormatExceptionSmaller

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@77083 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-19 07:28:34 +00:00
zwzhao
432f1a47fd bug TDI-6463 fixed : Export Job Script - include Required Talend Modules for tCreateTable
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77065 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-19 06:29:44 +00:00
ldong
96a3df709b This commit fixes TDI-18625:NPE when trying to view the installation details in the studio.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@77024 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-19 02:32:00 +00:00
zcui
1a5deb83d5 selenium:new cases:
testAddNewCommonProjectAndCheckItAppearInProjectAuthorizationAndReferences
testAddNewReferenceProjectAndCheckItAppearInProjectAuthorizationAndReferences
added to TestAddprojects

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76996 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 09:52:03 +00:00
zcui
e43dd55e6f selenium: add cases to project :add branch named "trunk" to trunk and branches
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76982 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 08:34:55 +00:00
zwzhao
b15dfb4c9b bug TDI-18987 fixed : Create a new service, the status drop donw list is empty
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76954 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 07:07:15 +00:00
fgzhang
1df88ca750 selenium:removed code of press tab key before save
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76938 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 03:54:00 +00:00
zcui
aa3d550338 selenium:remove soa.xml from launch.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76934 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 03:30:54 +00:00
zcui
8281fbd406 selenium:remove soa.xml from launch.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76933 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 03:30:20 +00:00
zcui
38b3b6ce5b selenium:remove features about soa and add cases about amc ,softwareupdate,repositorybrowser
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76932 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 03:27:49 +00:00
fgzhang
159de5aabb selenium:modified case(testAuditProjectContainsSpace) of project'name and pdf'path
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76931 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 02:51:35 +00:00
fwang
f4d56a69e3 bug TDI-17155 fixed:Use a query in a job, update this query can not detect the update
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76929 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 02:48:23 +00:00
fgzhang
3cce629265 selenium:removed code of check pdf whether contain job(tRunJobCheckPoint)
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76921 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-18 01:46:04 +00:00
fgzhang
710d3947a4 selenium:update method(isExistedInfoInPdf) for audit
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76900 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 09:57:16 +00:00
zcui
f60ceb2f2d selenium:update plan.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76891 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 09:10:57 +00:00
zcui
22938a2876 selenium:update for plan and filetrigger
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76889 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 09:08:17 +00:00
zshen
961213ac57 TDQ-4462 TDQ-4466 lost mdmWizard case
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76871 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 06:18:15 +00:00
zcui
bfdeac16c4 selenium:add parameters to plan.xml
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76870 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 05:56:14 +00:00
zcui
f9501dce53 selenium: update cases of plan
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76868 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 05:54:42 +00:00
zcui
17a96c1c92 selenium: add method to selectDropDownlistByClickArrow
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76867 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 05:53:01 +00:00
fgzhang
e1c0efe891 selenium:update some xpath of "services endpoint"...
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76851 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 02:12:05 +00:00
zcui
9edb7acf20 selenium:update cases about talendruntime
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76850 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 02:04:49 +00:00
fgzhang
78144e5c28 selenium:add a include node of 'changeSamServerURL'
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76849 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-17 02:00:35 +00:00
zshen
12669a93ee TDQ-4462 TDQ-4466 when click Cancel button revert change
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76848 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 17:27:55 +00:00
fgzhang
205833c60a selenium:monitor:
TestEsbServicePayloadContentsDisplay---testEnvelopeOpenClose()
                                    ---testPopUpPayLoadContens()
   --change xpath of request out  and Response IN
TestEsbServiceActivityGenerateEvents---testGenerateEventsForPageDisplay()
   --change parameter'value of add monitor info times

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76835 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 10:03:28 +00:00
zwzhao
4be9d7870d bug TDI-6463 fixed : Export Job Script - include Required Talend Modules for tCreateTable
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76830 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 09:15:21 +00:00
ycbai
0907738fcc bug TDI-19253 fixed: Metedata:XMLInput: add one attribute, schema can not updated automaticly
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76806 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 07:25:51 +00:00
fgzhang
d3acf6db86 selenium:notification:
notification.xml
   --change parameter'value of task notification'description

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76784 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 06:11:18 +00:00
fgzhang
a3bf52112b selenium:login:
TestCheckRoleDesignerPrivilege---testCheckRoleDesignerPrivilege()
TestCheckRoleOperationManagerPrivilege---testCheckRolePrivilege()
TestCheckRoleViewerPrivilege---testCheckRoleViewerPrivilege()
   --removed some codes of soa

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76780 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 05:50:58 +00:00
fgzhang
c51ead9960 selenium:task:
modified cases:
TestAddTriggerAddSimpleTrigger---testAddTriggerAddSimpleTriggerAddWrongFormFileds()
   --change xpath of "Number of triggerings:" to "Number of repetitions:"
TestGenerateDeployRunStopPauseTaskResumeTask---testPauseTaskResumeTask()
TestAddTriggerAddCronTrigger---testAddCronByHandInputDateTrigger()
                            ---testAddExistTriggerAddCronTrigger()
   --modified date of cron trigger'year

git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76779 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-16 05:47:15 +00:00
fzhong
91bec426da SWTBot: modify OpenAnotherVersionOfJobTest for pb 'job has been saved when open another version of job, no need to save again.'
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76761 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-14 09:59:52 +00:00
fzhong
9bdc599fb9 SWTBot: modify UseSalesforceTest for pb 'shell not found when retrieve modules'
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76760 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-14 09:58:57 +00:00
fzhong
95dd14e459 SWTBot: modify ChangeDatabaseAndRetrieveSchemaTest for pb 'add a new shell when modify the element of a connection'
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76759 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-14 09:57:19 +00:00
qiongli
5774f697e6 TDQ-4279 TDQ-4269 backport to branch5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76726 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 10:43:08 +00:00
fgzhang
d72f2577f7 selenium:change suite name of cloud license
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76710 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 09:04:54 +00:00
fgzhang
c971d23821 selenium:update licenses to latest license
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76700 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 07:56:29 +00:00
fgzhang
ba68f6c5b1 selenium:update licenses to latest license
git-svn-id: http://talendforge.org/svn/tis_shared/branches/branch-5_0@76699 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 07:56:17 +00:00
wwang
ace274674f fix Bug TDI-18475 : merge to branch5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76698 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 07:49:36 +00:00
wwang
9c474903f6 fix Bug TDI-19179 : merge to branch5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76686 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 06:13:35 +00:00
hywang
d15334a88b Bug TDI-18244 fixed:Cannot retrieve synonym Schema in 4.1.3
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76677 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 03:58:41 +00:00
zwzhao
fd2ad1e165 bug TDI-19305 fixed : Oracle RAC URL parameter has double quote when use in repository mode
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76661 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-13 03:00:28 +00:00
amaumont
44b4f3f0ad merge r76621 from trunk to branch 5.0
TDI-19172 add 2 plan with a same task, the second plan doesn't work well
=> compilation error fixed on getRequestId()


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76623 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-12 08:27:46 +00:00
gliu
33a4004ea4 [TESB-3837] added: Data Service name is not validated during service creation in Studio
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76604 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-12 03:57:42 +00:00
fwang
ccfc2e5864 bug TDI-13127 fixed:when we create a project with the last charactor of the project name is Space,then it will throw error
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76603 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-12 03:32:01 +00:00
jwang
3954760800 bug TDI-19285 fixed : Retrieved tables are not checked in ACCESS DB Retrieve Schema Wizard.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76599 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-12 03:15:17 +00:00
fwang
0e1b3cc589 bug TDI-17155 fixed:Use a query in a job, update this query can not detect the update
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76537 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-11 06:29:10 +00:00
plv
e94857eb48 bug TDI-17097 fixed: postgresql after refresh sqlbuilder,on the repository all the table list.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76535 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-11 06:16:17 +00:00
jwang
08d9c061e9 bug TDI-13267 fixed : Fix try-catch exception disposal block.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76510 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-11 03:22:58 +00:00
ldong
bf84071872 This commit fixes USV-3:Extension point to restrict the Remote Servers & CommandLine Servers in the Studio Remote Run.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76461 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-10 08:58:31 +00:00
zshen
7c89be63b9 TDQ-4384 TDQ-4395 backport on the branch 5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76400 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-10 04:12:05 +00:00
msjian
63ad0cb572 TDI-19092 (TDI-19063) fixed :modified the sql and parameter
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76344 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-09 10:18:04 +00:00
jwang
6b2a046109 bug TDI-13267 fixed : A locked job can be moved.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76328 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-09 09:36:44 +00:00
hcyi
bac5efb974 bug TDI-19173 modified : Multiple occurrence not usable in the xpath value of the fields of Input XML wizards .
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76289 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-09 04:58:57 +00:00
cli
6fbcc8f6ce bug TDI-19214 fixed: when switch project, will login a test project auto.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76253 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-07 07:57:26 +00:00
bzhou
2324dfb7cf bug TDQ-4398 TDQ-4383 fixed: backport to branch5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76226 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 14:27:50 +00:00
hwang
85e6639e6d TDI-17645:Salesforce schema retrieval is incomplete when selecting all schemas
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76219 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 13:48:29 +00:00
nrousseau
db8a1340b3 merge r76212 from trunk to branch 5.0
bug TDI-18361 and TDI-17624 fixed: fix problem of update / reload schema, even if the original db is different


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76216 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 11:31:42 +00:00
ycbai
913dcee426 bug TDI-19176 fixed: Edition of the xml mapping (from xsd file) does not update correctly the input component
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76204 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 10:28:05 +00:00
amaumont
684272eddc merge r76194 from trunk to branch 5.0
JobConductor (branch 5.0): Items cache could not work correctly due to buggy hashcode/equals in keys for cache


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76201 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 10:25:59 +00:00
gdbu
b438d55e23 TDQ-4282 : When covering the original connection, adding that the dangers of operating instructions.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76182 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 09:50:29 +00:00
xqliu
c81353a556 TDQ-4108 TDQ-4428 backport TDQ-4162 on branch 5.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76162 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 08:07:43 +00:00
hywang
69fa051522 Bug TDI-19174 fixed:Out Of Bound Exception-61
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76152 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-06 07:03:19 +00:00
amaumont
d3eace1ec0 merge r76035 from trunk to branch 5.0
TDI-19226 Bad locking in ExecutionTaskRefresher?, this may imply undesired concurrency 
=> Fixed by using the new class BoundedExecutor?, which blocks the main thread waiting for a new free thread in the pool


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76049 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-05 11:19:10 +00:00
ldong
a7190cdd7c This commit fixes TDI-18737:Migration problem from 3.1.3 to 4.2.3.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76010 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-05 09:50:14 +00:00
hcyi
71d0b35baf bug TDI-19180 fixed : Wizard Input xml, possible to have duplicate columns .
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@76002 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-05 08:48:37 +00:00
wchen
943101ea13 bug TDI-17768 fixed:Generated documentation for the tDB2Input component
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75986 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-05 08:23:27 +00:00
ldong
dd2fb56d90 This commit fixes TDI-19114:Get Error Message and Unable to retrieve schema from ACCESS DB Wizards Once "Schema Table" is checked.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75932 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-05 03:45:46 +00:00
hwang
45360e5220 TDI-17294:auto-generated documentation is not update correctly
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75889 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-04 10:32:24 +00:00
hcyi
33ddbdf69c bug TDI-19173 fixed : Multiple occurrence not usable in the xpath value of the fields of Input XML wizards .
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75881 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-04 09:58:03 +00:00
zwzhao
e1f4c4379a bug TDI-17967 fixed : EBCDICInput to Database - wrong column names
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75818 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-04 03:26:07 +00:00
klliu
99d7dcc8ca TDQ-4365
Fix on branch 5.0

git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75811 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-01-04 02:05:18 +00:00
wchen
ba1d2f34b6 bug TDI-19169 fixed: Could not delete schema
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75692 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-30 08:53:53 +00:00
ldong
46ab20f049 This commit fixes TDI-12846:Cannot modify schema of positional file.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75684 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-30 07:45:43 +00:00
ycbai
33fada0c0b bug TDI-18959 fixed: Output xml schema, need to be able to drag&drop from the tree to the metadata.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75622 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-29 10:16:54 +00:00
msjian
a706bd9a1d TDI-19092 (TDI-19063) fixed :modify some miner issues
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75581 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-29 08:02:57 +00:00
wchen
7037a4ddd4 comment: fix an error AMC_RAP build
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75532 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-29 03:06:04 +00:00
amaumont
6fff3d5575 merge r75520 from trunk to branch 5.0
TDI-19150 Jobserver : Deployment folder is always ./TalendJobserverFiles
=> resolved by fixing properties name, adding warning if property not found


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75522 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-28 11:44:33 +00:00
wchen
ce6c02c0fd bug TDI-18718 fixed:Unable to define the 'date' values for the default context variables, when the language is 'french'
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75507 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-28 08:53:45 +00:00
bzhou
f84716996b TDQ-4295 add the new asm file.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75502 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-28 08:15:18 +00:00
bzhou
70adbe07a6 TDQ-4295 delete old asm file.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75496 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-28 07:58:27 +00:00
hwang
848ae6d2f7 TDI-18303:Undo of tMap changes doesn't work
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75466 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-28 05:18:17 +00:00
qiongli
d2d32e4295 TDQ-4279 TDQ-4269:backport to branch 5.0.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75333 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-27 02:41:13 +00:00
nrousseau
0df1223827 merge r75298 from trunk to branch 5.0
bug TMDM-3162 fixed: move additionalInfoMap from services to standard properties ecore, and add a getAdditionalProperties with it.


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75327 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-27 00:27:26 +00:00
msjian
133339484c TDI-19092 (TDI-19063) fixed :Add the possibility to retrieve DQ Rules from a component
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75226 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-26 04:14:18 +00:00
ldong
5645ece041 This commit fixes USV-3:Extension point to restrict the Remote Servers & CommandLine Servers in the Studio Remote Run.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75190 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-23 06:11:19 +00:00
ycbai
c75e863a0a bug TDI-19032 fixed: rename folder problem
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75171 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-23 05:01:35 +00:00
zshen
ac7b1944f5 TDQ-4145 TDQ-4151 switch page number in column analysis result page will cause "No more handles issue" for large data
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@75039 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-21 12:42:46 +00:00
qiongli
8b88388607 TDQ-3797 backport to branch5.0(update related analyses for TOP).
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@74995 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-21 07:23:02 +00:00
mzhao
3620c10880 merge r74990 from trunk to branch 5.0
TDQ-4227 Don't set the uiSchema parameter from 4.2 (included). 


git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@74993 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-21 06:58:55 +00:00
ldong
2677c23cd5 This commit fixes TDI-18872:updating a context groups, corrupts any locked jobs when it tries to update the jobs which are using the context group.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@74988 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-21 06:33:42 +00:00
hwang
fcdf7f09c6 USV-5:IDragAndDropServiceHandler.filterNeededComponents(...) never called?
git-svn-id: http://talendforge.org/svn/tos/branches/branch-5_0@74979 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-21 04:06:17 +00:00
mhirt
142c7c29e3 Fix bad message in welcome page in French
git-svn-id: http://talendforge.org/svn/tos/trunk@74638 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-15 23:30:46 +00:00
nrousseau
6378cf5b96 bug TDI-19031 fixed: add system property to store if the user is read only or not, then use this property as enablement for the extension points
git-svn-id: http://talendforge.org/svn/tos/trunk@74612 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-15 11:27:06 +00:00
mzhao
43bf534b20 TDQ-4079 revert a wrong change of addChildren.
git-svn-id: http://talendforge.org/svn/tos/trunk@74601 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-15 10:02:55 +00:00
mzhao
ff23660582 TDQ-4079 Don't add CLASSIFIER_FEATURE to children feature to avoid twice show of column when comparing two tables.
git-svn-id: http://talendforge.org/svn/tos/trunk@74599 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-15 09:56:08 +00:00
nrousseau
33da98d5f1 bug TDI-19027 : force to load all the process model when load the job and when do migration tasks. This should avoid to have some parts of the model not loaded and lose the reference link to the original object.
git-svn-id: http://talendforge.org/svn/tos/trunk@74583 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-15 06:06:49 +00:00
nrousseau
056a721298 bug TDI-19028 fixed: avoid to save 2 times the screenshot, actually screenshot could be saved in both .item and .screenshot file
git-svn-id: http://talendforge.org/svn/tos/trunk@74576 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-15 01:56:51 +00:00
nrousseau
7c9bd674d8 bug TDI-18995 fixed: fix a problem of import, screenshot was initialized, then lost after
git-svn-id: http://talendforge.org/svn/tos/trunk@74472 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-14 01:50:47 +00:00
zwzhao
adebf901f8 bug TDI-18843 fixed : Blanks in Service name are not prevented when duplicating a Service
git-svn-id: http://talendforge.org/svn/tos/trunk@74430 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-13 08:57:41 +00:00
nrousseau
5f39b985f5 bug TDQ-4149 fixed: fix a problem of icon for survivorship
git-svn-id: http://talendforge.org/svn/tos/trunk@74379 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-12 11:20:58 +00:00
sgandon
b83d54a24a JUnit for the Studio : fix the swtbotbuild
git-svn-id: http://talendforge.org/svn/tos/trunk@74344 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-12 08:56:14 +00:00
scorreia
f6bf990d82 i18n: synchronize Babili strings exported on 5.0.0RC3-2011-12-09-16-54-14
git-svn-id: http://talendforge.org/svn/tos/trunk@74281 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-09 16:30:52 +00:00
rzubairov
515c0baeb4 changed ESB demo project packaging
git-svn-id: http://talendforge.org/svn/tos/trunk@74269 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-09 15:07:56 +00:00
jzhao
d0429bac55 Fix Bug TDI-17958 : the field value always error contains a quotation mark.Empty value insert wrong
http://jira.talendforge.org/browse/TDI-17958


git-svn-id: http://talendforge.org/svn/tos/trunk@74210 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-09 09:04:27 +00:00
dlin
c03981c7d3 bug TDI-18844 resolved:Eclipse NullPointerException When Adding Documentation
git-svn-id: http://talendforge.org/svn/tos/trunk@74203 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-09 06:58:10 +00:00
nrousseau
6cd3575f25 bug TDI-17850 modified: enhance the fix done before. Avoid to have the prefix in the generated column names, fix a problem for output xml generated column names, and avoid duplicate columns when drag&drop in input xml repository
git-svn-id: http://talendforge.org/svn/tos/trunk@74199 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-09 05:24:36 +00:00
hywang
e834e95a95 Bug TDI-18774 fixed: Studio - Autoupdate : relaunch after patch install should not automatically open the project
git-svn-id: http://talendforge.org/svn/tos/trunk@74192 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-09 04:02:55 +00:00
sgandon
1510aa6bb2 Fix task : Studio Unit Test, make it automatic from hudson
update the junit script for the studio to cope with linux display number


git-svn-id: http://talendforge.org/svn/tos/trunk@74152 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 16:52:06 +00:00
rzubairov
f15a45f013 Updated port number for CRM service and Reservation service from ESB Demo Project.
git-svn-id: http://talendforge.org/svn/tos/trunk@74128 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 12:15:40 +00:00
rzubairov
5ccebc7e0e Added consumer job to ESB Demo Project
git-svn-id: http://talendforge.org/svn/tos/trunk@74123 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 11:45:43 +00:00
rzubairov
fa7df02592 Added route demonstrating content-based routing
git-svn-id: http://talendforge.org/svn/tos/trunk@74117 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 11:23:46 +00:00
wwang
aec99f5c0e fix Bug TDI-18747: With "tAvancedFileOutputXML" and generation mode "slow with no memory consumed" xml file generated is KO.
git-svn-id: http://talendforge.org/svn/tos/trunk@74110 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 10:11:28 +00:00
sgandon
ef686a25b1 Fix task : Studio Unit Test, make it automatic from hudson
add the scripts folder into the binaries of org.talend.development

git-svn-id: http://talendforge.org/svn/tos/trunk@74109 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 10:10:12 +00:00
sizhaoliu
88a100162d TDQ-4080 fixed : added a plugin check condition to show "Rules Management" node for TDQTE license when the bundle "org.talend.survivorship.designer" exists.
git-svn-id: http://talendforge.org/svn/tos/trunk@74106 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 09:52:25 +00:00
amaumont
ce30a5322f TDI-18792 ExecutionPlan needs to be cleaned and simplified to be reliable
=> status "Interrupted" set when the user has stopped the plan

git-svn-id: http://talendforge.org/svn/tos/trunk@74093 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 08:19:29 +00:00
wchen
9bddcb3416 bug TDI-18802 fixed:Add the possibility to set the root element as loop in the output xml wizard
git-svn-id: http://talendforge.org/svn/tos/trunk@74069 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-08 03:39:07 +00:00
sgandon
06f97ca85b Fix task : Studio Unit Test, make it automatic from hudson
make org.talend.development a real plugin and add it to the swtbot feature


git-svn-id: http://talendforge.org/svn/tos/trunk@74039 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 17:39:28 +00:00
rzubairov
84f1ed11b4 Added missing WSDL to ESBDEMOS project
git-svn-id: http://talendforge.org/svn/tos/trunk@74031 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 14:00:09 +00:00
ycbai
3588b8717b bug TDI-18804 fixed: Service publish metadata must create an output wizard xml connection with root as loop element if needed
git-svn-id: http://talendforge.org/svn/tos/trunk@73989 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 09:59:31 +00:00
msjian
7076f586e2 TDQ-4105 (TDQ-4091) fixed : fix some other minir issues
git-svn-id: http://talendforge.org/svn/tos/trunk@73974 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 08:55:37 +00:00
wchen
511cf95d30 bug TDI-18802 fixed:Add the possibility to set the root element as loop in the output xml wizard
git-svn-id: http://talendforge.org/svn/tos/trunk@73948 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 07:25:06 +00:00
wchen
73a1f40f5e bug TDI-18802 fixed:Add the possibility to set the root element as loop in the output xml wizard
git-svn-id: http://talendforge.org/svn/tos/trunk@73946 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 07:19:38 +00:00
nrousseau
4c3c11a8d5 bug TMDM-2766 fixed: when save a file name with the character #, rename it with a $ for the filename.
git-svn-id: http://talendforge.org/svn/tos/trunk@73941 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 06:40:34 +00:00
nrousseau
b62325be1b bug TMDM-2766 fixed: when save a file name with the character #, rename it with a $ for the filename.
git-svn-id: http://talendforge.org/svn/tos/trunk@73940 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 06:40:17 +00:00
hcyi
49a5fdf142 bug TDI-18445 fixed : when create new job version -> SVN commit dialog shouldn't appear .
git-svn-id: http://talendforge.org/svn/tos/trunk@73912 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-07 02:13:06 +00:00
rzubairov
7cada9987c Added/removed routes and new demo service for ESBDEMOS project.
git-svn-id: http://talendforge.org/svn/tos/trunk@73908 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-06 17:01:16 +00:00
hywang
f1f761b66d bug TDI-18771 fixed: StackOverflowError while trying to retrieve schema of HBase table
git-svn-id: http://talendforge.org/svn/tos/trunk@73859 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-06 08:40:50 +00:00
wwang
f3879fe22f fix Bug TDI-18474: set default pattern for date.
git-svn-id: http://talendforge.org/svn/tos/trunk@73834 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-06 05:07:18 +00:00
rzubairov
b55cbaf8b4 Updated to the last version of the metadata in sample project for ESB
git-svn-id: http://talendforge.org/svn/tos/trunk@73814 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-05 14:22:58 +00:00
zwzhao
2ab7b01322 bug TDI-18555 fixed : job can be assigned to more than one service operation
git-svn-id: http://talendforge.org/svn/tos/trunk@73779 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-05 09:39:15 +00:00
wchen
5b209ab22b bug TDI-18802 fixed:Add the possibility to set the root element as loop in the output xml wizard
git-svn-id: http://talendforge.org/svn/tos/trunk@73742 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-05 03:46:49 +00:00
wwang
05702963a4 fix Bug TDI-18474: change for the "java.util.Date"
git-svn-id: http://talendforge.org/svn/tos/trunk@73738 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-05 01:34:16 +00:00
sizhaoliu
f5233e4549 TDQ-4092 exported job with tRuleSurvivorship does not run
- export custom parameters under component node

git-svn-id: http://talendforge.org/svn/tos/trunk@73736 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-03 10:45:45 +00:00
sizhaoliu
2c72869bed TDQ-4092 & TDQ-3724 fixed : exported job with tRuleSurvivorship does not run
git-svn-id: http://talendforge.org/svn/tos/trunk@73734 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-03 08:45:41 +00:00
nrousseau
11cebf1672 bug TDI-18720 fixed: fix a problem of prefix
git-svn-id: http://talendforge.org/svn/tos/trunk@73715 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 10:33:58 +00:00
hywang
dfeae20d1e Bug TDI-18640 modified: 1.Improve the recording of patch.
2.Fix a logical problem to avoid make patches and updates in the installing list at the same time.
                        

git-svn-id: http://talendforge.org/svn/tos/trunk@73712 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 10:30:22 +00:00
nrousseau
b0a673dcd7 Modification: display ESB demo only in a product who contains services, and display it before the TOS demo project
git-svn-id: http://talendforge.org/svn/tos/trunk@73683 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 06:17:12 +00:00
wwang
6ffab4f37b fix Bug TDI-18474: add Object type support for lookup
git-svn-id: http://talendforge.org/svn/tos/trunk@73682 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 06:12:29 +00:00
wwang
81a295fb6d fix Bug TDI-18474: add Type support for lookup
git-svn-id: http://talendforge.org/svn/tos/trunk@73680 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 06:02:17 +00:00
hwang
302fb0823c USV-5:IDragAndDropServiceHandler.filterNeededComponents(...) never called?
git-svn-id: http://talendforge.org/svn/tos/trunk@73668 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 03:33:45 +00:00
nrousseau
9aaa5f5381 bug TDI-18720 fixed: fix a problem when have multi xsd generated from WSDL, and set correctly the prefix
git-svn-id: http://talendforge.org/svn/tos/trunk@73666 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 03:11:26 +00:00
wchen
6ef07e1bb8 bug TDI-13674 fixed: error into generated code when modifiy and finish without next step
git-svn-id: http://talendforge.org/svn/tos/trunk@73663 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-02 02:40:55 +00:00
ldong
734412b6b2 This commit fixes TDQ-3901:Update the contextName property in the connection item file.
git-svn-id: http://talendforge.org/svn/tos/trunk@73582 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-01 08:10:09 +00:00
qiongli
60a8069f73 TDQ-3930:1.only pop the warning when removes some tables.2.fill the 'id' attribute when retrives schema in DQ.
git-svn-id: http://talendforge.org/svn/tos/trunk@73549 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-12-01 02:36:28 +00:00
amarkevich
5fd7104889 update version to 5.0.1
git-svn-id: http://talendforge.org/svn/tos/trunk@73522 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 13:28:15 +00:00
amarkevich
0d0fab2988 update version to 5.0.1
git-svn-id: http://talendforge.org/svn/tos/trunk@73521 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 13:27:52 +00:00
amaumont
268016a86e Locker: changing boolean verbose to TRACE log4j level to trace informations about locked data
git-svn-id: http://talendforge.org/svn/tos/trunk@73484 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 08:33:41 +00:00
wwang
b3a95f0d24 fix Bug TDI-18474: tXMLMap only can transformation the string type variable
git-svn-id: http://talendforge.org/svn/tos/trunk@73482 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 08:20:10 +00:00
wchen
1d02f0adfa bug TDI-17725 fixed: ldif file generated by tfileOutputLDIF dataview failed
git-svn-id: http://talendforge.org/svn/tos/trunk@73457 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 05:43:44 +00:00
hwang
effce4163f TDI-17850:Studio/Metadata/XML File: if an xml tag contains an « -« the Fileds-to-extract column name is truncated
git-svn-id: http://talendforge.org/svn/tos/trunk@73445 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 03:40:15 +00:00
nrousseau
61d029a1d8 bug TDI-18754 fixed: fix a problem when try to retrieve columns from SAS / teradata with SQL mode.
git-svn-id: http://talendforge.org/svn/tos/trunk@73425 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-30 02:40:58 +00:00
ldong
d17d67fea7 This commit fixes TDI-16898:folder's name upper lower case can't exchange to each other.
git-svn-id: http://talendforge.org/svn/tos/trunk@73267 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-28 10:04:36 +00:00
hywang
34489e229b bug TDI-18640 fixed: 1.fix potential NPEs and failures
2.improve the logical of updatesite

git-svn-id: http://talendforge.org/svn/tos/trunk@73265 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-28 10:03:23 +00:00
nrousseau
3476bd9ebe bug TDI-17150 modified: do not unload from the create in repository directly when import, the unload is done directly in ImportItemUtil
git-svn-id: http://talendforge.org/svn/tos/trunk@73243 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-28 07:50:39 +00:00
achen
5514ea9bde TMDM-3037:Repository goes crazy at times
git-svn-id: http://talendforge.org/svn/tos/trunk@73241 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-28 07:09:33 +00:00
sgandon
e68df216c8 inverted 2 included features to fix ESB SE build pb
git-svn-id: http://talendforge.org/svn/tos/trunk@73207 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2011-11-25 15:56:59 +00:00
9398 changed files with 2205600 additions and 223 deletions

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.datatools-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1 @@
bin.includes = feature.xml

View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.datatools_feature"
label="Datatools_feature Feature"
version="2.2.0.qualifier"
provider-name="Eclipse.org">
<description url="http://www.example.com/description">
Eclipse project for data access
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<url>
<update label="CORE Talend update site for milestones" url="http://talendforge.org/core/updatesite/testing/"/>
</url>
<requires>
<import plugin="org.eclipse.core.runtime" version="3.2.0" match="greaterOrEqual"/>
<import plugin="com.ibm.icu" version="3.4.4" match="greaterOrEqual"/>
<import plugin="org.eclipse.datatools.connectivity.oda" version="3.0.1" match="greaterOrEqual"/>
<import plugin="org.eclipse.swt" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.commands" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.osgi" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.jobs" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.equinox.registry" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.equinox.preferences" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.core.contenttype" version="3.3.0" match="compatible"/>
<import plugin="org.eclipse.equinox.app" version="1.0.0" match="compatible"/>
<import plugin="org.eclipse.equinox.registry" version="3.2.0" match="compatible"/>
</requires>
<plugin
id="org.eclipse.datatools.connectivity.oda"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.datatools.enablement.oda.xml"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.swt"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jface"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.apache.xerces"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.icu"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.commands"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.common"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.osgi"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.apache.xml.resolver"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.jobs"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.registry"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.preferences"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.contenttype"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.app"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.osgi.services"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="javax.servlet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,6 @@
bin
doc
*.jar
download
v*.scc
.settings

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.datatools.connectivity.oda</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DTP Open Data Access
Bundle-SymbolicName: org.eclipse.datatools.connectivity.oda; singleton:=true
Bundle-Version: 3.0.3.200610171
Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.datatools.connectivity.oda,
org.eclipse.datatools.connectivity.oda.impl,
org.eclipse.datatools.connectivity.oda.util,
org.eclipse.datatools.connectivity.oda.util.logging,
org.eclipse.datatools.connectivity.oda.util.manifest
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.2.0",
com.ibm.icu;bundle-version="3.4.4";visibility:=reexport
Eclipse-LazyStart: true
Bundle-Activator: org.eclipse.datatools.connectivity.oda.util.OdaPlugin

View File

@@ -0,0 +1,28 @@
<html>
<head>
<title>About This Content</title>
</head>
<body>
<div>
<h3>About This Content</h3>
<p>May 2, 2006</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in
(&quot;Content&quot;). Unless otherwise indicated below, the Content is
provided to you under the terms and conditions of the Eclipse Public License
Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a
href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation,
the Content is being redistributed by another party (&quot;Redistributor&quot;)
and different terms and conditions may apply to your use of any object code in
the Content. Check the Redistributors license that was provided with the
Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source
code in the Content and such source code may be obtained at <a
href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
<p>&nbsp;</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,34 @@
#
#************************************************************************
# Copyright (c) 2004, 2006 Actuate Corporation.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Actuate Corporation - initial API and implementation
#
#************************************************************************
#
source.. = src/
output.. = bin/
package.oda.jar = ./org/eclipse/datatools/connectivity/oda/
oda.src.dir = ./src/org/eclipse/datatools/connectivity/oda/
bin.includes = about.html,\
plugin.xml,\
.,\
schema/datasource.exsd,\
META-INF/
jar.includes = **/*.txt,\
**/*.xml,\
**/*.def,\
**/*.properties
javac.debug = on
javac.source = 1.4
javac.target = 1.4
build.result.dir = ./
temp.dir = ./tempdir/
plugin.destination = ./
javadoc.dir = doc/api/
download.dir = ./download/

View File

@@ -0,0 +1 @@
vss*.scc

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
/**
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*
* $Id: plugin.xml,v 1.13 2006/03/10 00:43:15 lchan Exp $
*/
-->
<plugin>
<extension-point id="dataSource" name="Open Data Access Design and Run-time Extension" schema="schema/datasource.exsd"/>
</plugin>

View File

@@ -0,0 +1,335 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Open Data Access</title>
<style>@import url("file:/D:/Lang/eclipse_32/plugins/org.eclipse.sdk_3.2.0.v20060605/book.css");</style>
<style>@import url("file:/D:/Lang/eclipse_32/configuration/org.eclipse.osgi/bundles/129/1/.cp/schema.css");</style>
</HEAD>
<BODY>
<H1><CENTER>Open Data Access</CENTER></H1>
<p></p>
<h6 class=CaptionFigColumn id=header>Identifier: </h6>org.eclipse.datatools.connectivity.oda.dataSource<p></p>
<h6 class=CaptionFigColumn id=header>Since: </h6>3.0
<p></p>
<p>
<h6 class=CaptionFigColumn id=header>Description: </h6>This extension point is used to support the extension of design-time and run-time data source access by a data application. Each extension must implement the Open Data Access (ODA) Java runtime interfaces defined in the <i>org.eclipse.datatools.connectivity.oda</i> package.</p>
<p><h6 class=CaptionFigColumn id=header>Configuration Markup:</h6></p>
<p class=code id=dtd>&lt;!ELEMENT <a name="e.extension">extension</a> (<a href="#e.dataSource">dataSource</a> , <a href="#e.dataSet">dataSet</a>+)&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST extension</p>
<p class=code id=dtdAttlist>point&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>id&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>name&nbsp;&nbsp;CDATA #IMPLIED&gt;</p>
<p></p>
<ul class=ConfigMarkup id=attlistDesc>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.dataSource">dataSource</a> (<a href="#e.traceLogging">traceLogging</a>? , <a href="#e.properties">properties</a>? , <a href="#e.relationship">relationship</a>?)&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST dataSource</p>
<p class=code id=dtdAttlist>id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>odaVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA "3.0"<p class=code id=dtdAttlist>defaultDisplayName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>driverClass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>setThreadContextClassLoader&nbsp;(true | false) "false"&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
The definition of a type of ODA data source extension for use at design-time and run-time.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>id</b> - A fully qualified ID that uniquely identifies this ODA data source extension within an ODA consumer application's environment. If a data source designer extension (that implements <i>org.eclipse.datatools.connectivity.oda.design.ui.dataSource</i> extension point) is available for this ODA driver, the value of this attribute must match that of the designer extension's <i>id</i> attribute in its data source element.</li>
<li><b>odaVersion</b> - Version of the ODA interfaces for which this driver is developed. This element is required and should take the format of Major.Minor or Major.Minor.Service (e.g. 3.0 or 2.0.1).</li>
<li><b>defaultDisplayName</b> - The display name of the ODA data source extension. Its value can be localized by using the plugin.properties mechanism. Default to the extension id if no display name is specified.
It can be used by an ODA consumer application's designer tool in displaying a list of ODA data source extensions, when they do not have a corresponding data source editor (data source UI extension point).</li>
<li><b>driverClass</b> - Concrete class that implements the <i>org.eclipse.datatools.connectivity.oda.IDriver</i> interface. This is the entry point of the ODA runtime driver. The same driver may support multiple data source extensions.</li>
<li><b>setThreadContextClassLoader</b> - If true, the consumer of the ODA runtime extension plug-in should set the thread context class loader to the one used to load this driver before calling any ODA interface method.
Any data source plug-in extension with this flag set to true would take precedence, and is applied to all data source extensions implemented by this plug-in.
<br>
If the thread context class loader being set is the OSGi class loader that was used to load this ODA runtime plugin, it is not designed to be used by a plugin to in turn load additional classes. If further class loading is needed, it is up to individual ODA runtime plugin implementation to provide its own URLClassLoader, and switch thread context class loader as appropriate.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.dataSet">dataSet</a> (<a href="#e.dataTypeMapping">dataTypeMapping</a>+ , <a href="#e.properties">properties</a>? , <a href="#e.relationship">relationship</a>?)&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST dataSet</p>
<p class=code id=dtdAttlist>id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>defaultDisplayName&nbsp;CDATA #IMPLIED&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
The definition of a type of data set supported by the dataSource extension.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>id</b> - A fully qualified ID that uniquely identifies this ODA data set definition within an ODA consumer application's environment.</li>
<li><b>defaultDisplayName</b> - The display name of the ODA data set definition. Its value can be localized by using the plugin.properties mechanism. Default to its id if no display name is specified.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.dataTypeMapping">dataTypeMapping</a> (<a href="#e.alternativeOdaDataType">alternativeOdaDataType</a>*)&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST dataTypeMapping</p>
<p class=code id=dtdAttlist>nativeDataType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>nativeDataTypeCode&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>odaScalarDataType&nbsp;&nbsp;(Date|Double|Integer|String|Time|Timestamp|Decimal|Blob|Clob) "String"&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
A data types mapping from a data provider's native data type to one or more ODA data types.
Each native data type must be mapped to a primary ODA scalar data type. The driver can optionally provide a list of alternate ODA data types to which it is capable of converting a native data type.
This data type mapping facilitates all ODA consumers to map from the same set of ODA data types to its own application-specific data types.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>nativeDataType</b> - Native data type name (a string). Used for information only.</li>
<li><b>nativeDataTypeCode</b> - Native data type code (an integer). Its value must match one of the data type codes returned in the driver's ODA interface implementation.</li>
<li><b>odaScalarDataType</b> - The primary ODA scalar data type which the native type maps to. Supported ODA data types are: Date, Double, Integer, String, Time, Timestamp, Decimal, Blob and Clob.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.alternativeOdaDataType">alternativeOdaDataType</a> EMPTY&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST alternativeOdaDataType</p>
<p class=code id=dtdAttlist>odaScalarDataType&nbsp;(Date|Double|Integer|String|Time|Timestamp|Decimal|Blob|Clob) &gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
Provide an alternative mapping to an ODA scalar data type.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>odaScalarDataType</b> - The ODA scalar data type to which the native type may be converted by the driver.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.traceLogging">traceLogging</a> EMPTY&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST traceLogging</p>
<p class=code id=dtdAttlist>logLevel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA "WARNING"<p class=code id=dtdAttlist>logFileNamePrefix&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>logDirectory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>logFormatterClass&nbsp;CDATA #IMPLIED&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
Configures the ODA run-time driver's trace logging settings for the data source extension.
The configured values are passed through to the driver's implementation of the <code>IDriver.setLogConfiguration</code> method.
<br>It is up to individual ODA driver on how to honor any of these trace logging attributes as appropriate.
<br><br>Note: The trace logging configuration specified in the plug-in PDE .options file would take precedence over those configured in this element, if the debug tracing flag is set to "true".
<br>The ODA plug-in's PDE tracing options, listed below for cross reference, match the attributes of this element.
<br>&nbsp;&nbsp;&nbsp;
&lt;plug-in Id&gt;/debug = true/false
<br>&nbsp;&nbsp;&nbsp;
&lt;plug-in Id&gt;/traceLogging/logLevel
<br>&nbsp;&nbsp;&nbsp;
&lt;plug-in Id&gt;/traceLogging/logFileNamePrefix
<br>&nbsp;&nbsp;&nbsp;
&lt;plug-in Id&gt;/traceLogging/logDirectory
<br>&nbsp;&nbsp;&nbsp;
&lt;plug-in Id&gt;/traceLogging/logFormatterClass</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>logLevel</b> - The name or numeric value for the driver's log level.
<br>The log levels' names and corresponding numeric values are:
<br>
"SEVERE" = 1000;
"WARNING" = 900;
"INFO" = 800;
"CONFIG" = 700;
"FINE" = 500;
"FINER" = 400;
"FINEST" = 300;
"ALL" = 0;
"OFF" = 1001 or higher .</li>
<li><b>logFileNamePrefix</b> - A string prefix for driver's log file name.</li>
<li><b>logDirectory</b> - Directory for log file.</li>
<li><b>logFormatterClass</b> - The class name of a concrete log formatter, suitable for use by the driver-specific logging utility.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.property">property</a> (<a href="#e.choice">choice</a>*)&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST property</p>
<p class=code id=dtdAttlist>name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>defaultDisplayName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(string|choice) "string"<p class=code id=dtdAttlist>canInherit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(true | false) "true"<p class=code id=dtdAttlist>defaultValue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>isEncryptable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(true | false) "false"<p class=code id=dtdAttlist>allowsEmptyValueAsNull&nbsp;(true | false) "true"&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
A property whose value can be edited at design-time using an ODA consumer application's designer tool. Its value is then passed to the ODA runtime driver during run-time.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>name</b> - Unique name of the property.</li>
<li><b>defaultDisplayName</b> - The default display name. Its value can be localized by using the plugin.properties mechanism.</li>
<li><b>type</b> - Type of the property. The property type could be one of the values listed in the Restriction enumerations.</li>
<li><b>canInherit</b> - Reserved.</li>
<li><b>defaultValue</b> - Default value of the property, if no property value is set.</li>
<li><b>isEncryptable</b> - A flag indicating whether this property value is encryptable. Setting it to "true" indicates to an ODA consumer application that this property's value should be encrypted.</li>
<li><b>allowsEmptyValueAsNull</b> - A flag that indicates whether an empty value of this property can be treated as a null value. Default value is true. This attribute setting applies when an ODA consumer passes the property's value to this ODA runtime driver. This optional attribute may be used to accommodate the case where a property value's input control does not provide the means to specify a null value.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.propertyGroup">propertyGroup</a> (<a href="#e.property">property</a>+)&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST propertyGroup</p>
<p class=code id=dtdAttlist>name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>defaultDisplayName&nbsp;CDATA #IMPLIED&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
A grouping of one or more properties in an ODA consumer application's designer tool. The group attributes are for display only. All properties listed under a propertyGroup are handled as scalar properties at run-time.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>name</b> - </li>
<li><b>defaultDisplayName</b> - The default display name. Its value can be localized by using the plugin.properties mechanism.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.propertyVisibility">propertyVisibility</a> EMPTY&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST propertyVisibility</p>
<p class=code id=dtdAttlist>name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>visibility&nbsp;(change|lock|hide) &gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
Used to set the visibility level of the named property when it is shown in the property sheet of an ODA consumer application's designer tool.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>name</b> - The name of a property that is defined either by this data source extension or is a system-defined property.</li>
<li><b>visibility</b> - The valid options are: change, hide, lock.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.choice">choice</a> EMPTY&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST choice</p>
<p class=code id=dtdAttlist>name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED<p class=code id=dtdAttlist>defaultDisplayName&nbsp;CDATA #IMPLIED&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
Choice of property values.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>name</b> - Name of the choice</li>
<li><b>value</b> - Value to be used, if the given choice is selected.</li>
<li><b>defaultDisplayName</b> - The default display name. Its value can be localized by using the plugin.properties mechanism.</li>
</ul>
<br><p class=code id=dtd>&lt;!ELEMENT <a name="e.properties">properties</a> (<a href="#e.property">property</a>* , <a href="#e.propertyGroup">propertyGroup</a>* , <a href="#e.propertyVisibility">propertyVisibility</a>*)&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
A collection of property definitions in a data source extension or its supported data set definitions.</p>
<br><br>
<p class=code id=dtd>&lt;!ELEMENT <a name="e.relationship">relationship</a> EMPTY&gt;</p>
<p class=code id=dtd>&lt;!ATTLIST relationship</p>
<p class=code id=dtdAttlist>type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(replacedBy) <p class=code id=dtdAttlist>relatedId&nbsp;CDATA #REQUIRED&gt;</p>
<p></p>
<p class=ConfigMarkup id=elementDesc>
An optional element to specify the relationship of this element.</p>
<br>
<ul class=ConfigMarkup id=attlistDesc>
<li><b>type</b> - The type of relationship that this extension's dataSource or dataSet element has with the <i>relatedId</i> element.
Valid value(s) are:
<br>* "replacedBy" - this dataSource/dataSet is deprecated and replaced by that of <i>relatedId</i>. This setting is for consumption by an ODA host, and does not automatically affect the behavior of the ODA framework. It is up to an ODA host to apply as appropriate, e.g. to migrate its reference of a deprecated extension, and to control which ODA extension to use at runtime.
<br>* (Additional types are TBD.)</li>
<li><b>relatedId</b> - The fully qualified ID of the related ODA data source or data set element.
Its value must match that of the corresponding <i>dataSource.id</i> or <i>dataSet.id</i> attribute defined in another ODA driver's <i>org.eclipse.datatools.connectivity.oda.dataSource</i> extension.</li>
</ul>
<br><h6 class=CaptionFigColumn id=header>Examples: </h6><p>
<pre>
<p class=code id=tag>&lt;extension
point=<p class=code id=cstring>&quot;org.eclipse.datatools.connectivity.oda.dataSource&quot;</p><p class=code id=tag>&gt;</p>
<p class=code id=tag>&lt;dataSource
odaVersion=<p class=code id=cstring>&quot;3.0&quot;</p><p class=code id=tag>
driverClass=<p class=code id=cstring>&quot;org.eclipse.datatools.connectivity.oda.flatfile.FlatFileDriver&quot;</p><p class=code id=tag>
defaultDisplayName=<p class=code id=cstring>&quot;Flat File Data Source&quot;</p><p class=code id=tag>
id=<p class=code id=cstring>&quot;org.eclipse.datatools.connectivity.oda.flatfile&quot;</p><p class=code id=tag>
setThreadContextClassLoader=<p class=code id=cstring>&quot;false&quot;</p><p class=code id=tag>&gt;</p>
<p class=code id=tag>&lt;properties&gt;</p>
<p class=code id=tag>&lt;propertyGroup
defaultDisplayName=<p class=code id=cstring>&quot;Connection Properties&quot;</p><p class=code id=tag>
name=<p class=code id=cstring>&quot;connectionProperties&quot;</p><p class=code id=tag>&gt;</p>
<p class=code id=tag>&lt;property
type=<p class=code id=cstring>&quot;string&quot;</p><p class=code id=tag>
defaultDisplayName=<p class=code id=cstring>&quot;Home Folder&quot;</p><p class=code id=tag>
canInherit=<p class=code id=cstring>&quot;true&quot;</p><p class=code id=tag>
name=<p class=code id=cstring>&quot;HOME&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;property
type=<p class=code id=cstring>&quot;string&quot;</p><p class=code id=tag>
defaultDisplayName=<p class=code id=cstring>&quot;Character Set&quot;</p><p class=code id=tag>
canInherit=<p class=code id=cstring>&quot;true&quot;</p><p class=code id=tag>
name=<p class=code id=cstring>&quot;CHARSET&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;property
type=<p class=code id=cstring>&quot;string&quot;</p><p class=code id=tag>
canInherit=<p class=code id=cstring>&quot;true&quot;</p><p class=code id=tag>
defaultDisplayName=<p class=code id=cstring>&quot;Includes Data Type (Yes/No)&quot;</p><p class=code id=tag>
name=<p class=code id=cstring>&quot;INCLTYPELINE&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;/propertyGroup&gt;</p>
<p class=code id=tag>&lt;/properties&gt;</p>
<p class=code id=tag>&lt;/dataSource&gt;</p>
<p class=code id=tag>&lt;dataSet
defaultDisplayName=<p class=code id=cstring>&quot;Flat File Data Set&quot;</p><p class=code id=tag>
id=<p class=code id=cstring>&quot;org.eclipse.datatools.connectivity.oda.flatfile.dataSet&quot;</p><p class=code id=tag>&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;BIT&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-7&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Integer&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;TINYINT&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-6&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Integer&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;SMALLINT&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;5&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Integer&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;INTEGER&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;4&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Integer&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;BIGINT&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-5&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Decimal&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;FLOAT&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;6&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Double&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;REAL&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;7&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Double&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;DOUBLE&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;8&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Double&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;NUMERIC&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;2&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Decimal&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;DECIMAL&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;3&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Decimal&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;CHAR&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;1&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;VARCHAR&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;12&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;LONGVARCHAR&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-1&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;DATE&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;91&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Date&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;TIME&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;92&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Time&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;TIMESTAMP&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;93&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Timestamp&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;BINARY&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-2&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;VARBINARY&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-3&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;LONGVARBINARY&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;-4&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;BOOLEAN&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;16&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;Integer&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;BLOB&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;2004&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;dataTypeMapping
nativeDataType=<p class=code id=cstring>&quot;CLOB&quot;</p><p class=code id=tag>
nativeDataTypeCode=<p class=code id=cstring>&quot;2005&quot;</p><p class=code id=tag>
odaScalarDataType=<p class=code id=cstring>&quot;String&quot;</p><p class=code id=tag>/&gt;</p>
<p class=code id=tag>&lt;/dataSet&gt;</p>
<p class=code id=tag>&lt;/extension&gt;</p>
</pre>
</p>
<p></p>
<h6 class=CaptionFigColumn id=header>API Information: </h6>The data source extension's driver must implement the interfaces defined in the <i>org.eclipse.datatools.connectivity.oda</i> package. See the package's JavaDoc documentation and API interfaces for more information.
<p></p>
<h6 class=CaptionFigColumn id=header>Supplied Implementation: </h6>The plug-in <i>org.eclipse.datatools.connectivity.oda.flatfile</i>, supplied with the Eclipse DTP Connectivity source, provides an example for implementing a simple ODA run-time extension.
<br>
In addition, a set of default implementation of the main ODA runtime interfaces are provided in the
<i>org.eclipse.datatools.connectivity.oda.impl</i> package.
These classes assume the behavior of a simple ODA driver,
and have labeled TODO tasks for a driver developer to implement data source specific behavior.
These concrete classes are provided for use as templates or base classes to aid in the development of an ODA custom driver. Their use is purely optional.
<p></p>
<br>
<p class=note id=copyright>
Copyright (c) 2004-2006 Actuate Corporation.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
<p></p>
</p>
</BODY>
</HTML>

View File

@@ -0,0 +1,682 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.datatools.connectivity.oda">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.datatools.connectivity.oda" id="dataSource" name="Open Data Access"/>
</appInfo>
<documentation>
This extension point is used to support the extension of design-time and run-time data source access by a data application. Each extension must implement the Open Data Access (ODA) Java runtime interfaces defined in the &lt;i&gt;org.eclipse.datatools.connectivity.oda&lt;/i&gt; package.
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="dataSource"/>
<element ref="dataSet" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="dataSource">
<annotation>
<documentation>
The definition of a type of ODA data source extension for use at design-time and run-time.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="traceLogging" minOccurs="0" maxOccurs="1"/>
<element ref="properties" minOccurs="0" maxOccurs="1"/>
<element ref="relationship" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A fully qualified ID that uniquely identifies this ODA data source extension within an ODA consumer application&apos;s environment. If a data source designer extension (that implements &lt;i&gt;org.eclipse.datatools.connectivity.oda.design.ui.dataSource&lt;/i&gt; extension point) is available for this ODA driver, the value of this attribute must match that of the designer extension&apos;s &lt;i&gt;id&lt;/i&gt; attribute in its data source element.
</documentation>
</annotation>
</attribute>
<attribute name="odaVersion" type="string" use="default" value="3.0">
<annotation>
<documentation>
Version of the ODA interfaces for which this driver is developed. This element is required and should take the format of Major.Minor or Major.Minor.Service (e.g. 3.0 or 2.0.1).
</documentation>
</annotation>
</attribute>
<attribute name="defaultDisplayName" type="string">
<annotation>
<documentation>
The display name of the ODA data source extension. Its value can be localized by using the plugin.properties mechanism. Default to the extension id if no display name is specified.
It can be used by an ODA consumer application&apos;s designer tool in displaying a list of ODA data source extensions, when they do not have a corresponding data source editor (data source UI extension point).
</documentation>
</annotation>
</attribute>
<attribute name="driverClass" type="string" use="required">
<annotation>
<documentation>
Concrete class that implements the &lt;i&gt;org.eclipse.datatools.connectivity.oda.IDriver&lt;/i&gt; interface. This is the entry point of the ODA runtime driver. The same driver may support multiple data source extensions.
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.datatools.connectivity.oda.IDriver"/>
</appInfo>
</annotation>
</attribute>
<attribute name="setThreadContextClassLoader" type="boolean" use="default" value="false">
<annotation>
<documentation>
If true, the consumer of the ODA runtime extension plug-in should set the thread context class loader to the one used to load this driver before calling any ODA interface method.
Any data source plug-in extension with this flag set to true would take precedence, and is applied to all data source extensions implemented by this plug-in.
&lt;br&gt;
If the thread context class loader being set is the OSGi class loader that was used to load this ODA runtime plugin, it is not designed to be used by a plugin to in turn load additional classes. If further class loading is needed, it is up to individual ODA runtime plugin implementation to provide its own URLClassLoader, and switch thread context class loader as appropriate.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="dataSet">
<annotation>
<documentation>
The definition of a type of data set supported by the dataSource extension.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="dataTypeMapping" minOccurs="1" maxOccurs="unbounded"/>
<element ref="properties" minOccurs="0" maxOccurs="1"/>
<element ref="relationship" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
A fully qualified ID that uniquely identifies this ODA data set definition within an ODA consumer application&apos;s environment.
</documentation>
</annotation>
</attribute>
<attribute name="defaultDisplayName" type="string">
<annotation>
<documentation>
The display name of the ODA data set definition. Its value can be localized by using the plugin.properties mechanism. Default to its id if no display name is specified.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="dataTypeMapping">
<annotation>
<documentation>
A data types mapping from a data provider&apos;s native data type to one or more ODA data types.
Each native data type must be mapped to a primary ODA scalar data type. The driver can optionally provide a list of alternate ODA data types to which it is capable of converting a native data type.
This data type mapping facilitates all ODA consumers to map from the same set of ODA data types to its own application-specific data types.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="alternativeOdaDataType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="nativeDataType" type="string">
<annotation>
<documentation>
Native data type name (a string). Used for information only.
</documentation>
</annotation>
</attribute>
<attribute name="nativeDataTypeCode" type="string" use="required">
<annotation>
<documentation>
Native data type code (an integer). Its value must match one of the data type codes returned in the driver&apos;s ODA interface implementation.
</documentation>
</annotation>
</attribute>
<attribute name="odaScalarDataType" use="default" value="String">
<annotation>
<documentation>
The primary ODA scalar data type which the native type maps to. Supported ODA data types are: Date, Double, Integer, String, Time, Timestamp, Decimal, Blob and Clob.
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="Date">
</enumeration>
<enumeration value="Double">
</enumeration>
<enumeration value="Integer">
</enumeration>
<enumeration value="String">
</enumeration>
<enumeration value="Time">
</enumeration>
<enumeration value="Timestamp">
</enumeration>
<enumeration value="Decimal">
</enumeration>
<enumeration value="Blob">
</enumeration>
<enumeration value="Clob">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="alternativeOdaDataType">
<annotation>
<documentation>
Provide an alternative mapping to an ODA scalar data type.
</documentation>
</annotation>
<complexType>
<attribute name="odaScalarDataType" use="required">
<annotation>
<documentation>
The ODA scalar data type to which the native type may be converted by the driver.
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="Date">
</enumeration>
<enumeration value="Double">
</enumeration>
<enumeration value="Integer">
</enumeration>
<enumeration value="String">
</enumeration>
<enumeration value="Time">
</enumeration>
<enumeration value="Timestamp">
</enumeration>
<enumeration value="Decimal">
</enumeration>
<enumeration value="Blob">
</enumeration>
<enumeration value="Clob">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="traceLogging">
<annotation>
<documentation>
Configures the ODA run-time driver&apos;s trace logging settings for the data source extension.
The configured values are passed through to the driver&apos;s implementation of the &lt;code&gt;IDriver.setLogConfiguration&lt;/code&gt; method.
&lt;br&gt;It is up to individual ODA driver on how to honor any of these trace logging attributes as appropriate.
&lt;br&gt;&lt;br&gt;Note: The trace logging configuration specified in the plug-in PDE .options file would take precedence over those configured in this element, if the debug tracing flag is set to &quot;true&quot;.
&lt;br&gt;The ODA plug-in&apos;s PDE tracing options, listed below for cross reference, match the attributes of this element.
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;plug-in Id&amp;gt;/debug = true/false
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;plug-in Id&amp;gt;/traceLogging/logLevel
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;plug-in Id&amp;gt;/traceLogging/logFileNamePrefix
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;plug-in Id&amp;gt;/traceLogging/logDirectory
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;plug-in Id&amp;gt;/traceLogging/logFormatterClass
</documentation>
</annotation>
<complexType>
<attribute name="logLevel" type="string" use="default" value="WARNING">
<annotation>
<documentation>
The name or numeric value for the driver&apos;s log level.
&lt;br&gt;The log levels&apos; names and corresponding numeric values are:
&lt;br&gt;
&quot;SEVERE&quot; = 1000;
&quot;WARNING&quot; = 900;
&quot;INFO&quot; = 800;
&quot;CONFIG&quot; = 700;
&quot;FINE&quot; = 500;
&quot;FINER&quot; = 400;
&quot;FINEST&quot; = 300;
&quot;ALL&quot; = 0;
&quot;OFF&quot; = 1001 or higher .
</documentation>
</annotation>
</attribute>
<attribute name="logFileNamePrefix" type="string">
<annotation>
<documentation>
A string prefix for driver&apos;s log file name.
</documentation>
</annotation>
</attribute>
<attribute name="logDirectory" type="string">
<annotation>
<documentation>
Directory for log file.
</documentation>
</annotation>
</attribute>
<attribute name="logFormatterClass" type="string">
<annotation>
<documentation>
The class name of a concrete log formatter, suitable for use by the driver-specific logging utility.
</documentation>
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="property">
<annotation>
<documentation>
A property whose value can be edited at design-time using an ODA consumer application&apos;s designer tool. Its value is then passed to the ODA runtime driver during run-time.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="choice" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
Unique name of the property.
</documentation>
</annotation>
</attribute>
<attribute name="defaultDisplayName" type="string">
<annotation>
<documentation>
The default display name. Its value can be localized by using the plugin.properties mechanism.
</documentation>
</annotation>
</attribute>
<attribute name="type" use="default" value="string">
<annotation>
<documentation>
Type of the property. The property type could be one of the values listed in the Restriction enumerations.
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="string">
</enumeration>
<enumeration value="choice">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="canInherit" type="boolean" use="default" value="true">
<annotation>
<documentation>
Reserved.
</documentation>
</annotation>
</attribute>
<attribute name="defaultValue" type="string">
<annotation>
<documentation>
Default value of the property, if no property value is set.
</documentation>
</annotation>
</attribute>
<attribute name="isEncryptable" type="boolean" use="default" value="false">
<annotation>
<documentation>
A flag indicating whether this property value is encryptable. Setting it to &quot;true&quot; indicates to an ODA consumer application that this property&apos;s value should be encrypted.
</documentation>
</annotation>
</attribute>
<attribute name="allowsEmptyValueAsNull" type="boolean" use="default" value="true">
<annotation>
<documentation>
A flag that indicates whether an empty value of this property can be treated as a null value. Default value is true. This attribute setting applies when an ODA consumer passes the property&apos;s value to this ODA runtime driver. This optional attribute may be used to accommodate the case where a property value&apos;s input control does not provide the means to specify a null value.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="propertyGroup">
<annotation>
<documentation>
A grouping of one or more properties in an ODA consumer application&apos;s designer tool. The group attributes are for display only. All properties listed under a propertyGroup are handled as scalar properties at run-time.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="property" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="defaultDisplayName" type="string">
<annotation>
<documentation>
The default display name. Its value can be localized by using the plugin.properties mechanism.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="propertyVisibility">
<annotation>
<documentation>
Used to set the visibility level of the named property when it is shown in the property sheet of an ODA consumer application&apos;s designer tool.
</documentation>
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
The name of a property that is defined either by this data source extension or is a system-defined property.
</documentation>
</annotation>
</attribute>
<attribute name="visibility">
<annotation>
<documentation>
The valid options are: change, hide, lock.
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="change">
</enumeration>
<enumeration value="lock">
</enumeration>
<enumeration value="hide">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="choice">
<annotation>
<documentation>
Choice of property values.
</documentation>
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
Name of the choice
</documentation>
</annotation>
</attribute>
<attribute name="value" type="string">
<annotation>
<documentation>
Value to be used, if the given choice is selected.
</documentation>
</annotation>
</attribute>
<attribute name="defaultDisplayName" type="string">
<annotation>
<documentation>
The default display name. Its value can be localized by using the plugin.properties mechanism.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="properties">
<annotation>
<documentation>
A collection of property definitions in a data source extension or its supported data set definitions.
</documentation>
</annotation>
<complexType>
<sequence>
<element ref="property" minOccurs="0" maxOccurs="unbounded"/>
<element ref="propertyGroup" minOccurs="0" maxOccurs="unbounded"/>
<element ref="propertyVisibility" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="relationship">
<annotation>
<documentation>
An optional element to specify the relationship of this element.
</documentation>
</annotation>
<complexType>
<attribute name="type" use="required">
<annotation>
<documentation>
The type of relationship that this extension&apos;s dataSource or dataSet element has with the &lt;i&gt;relatedId&lt;/i&gt; element.
Valid value(s) are:
&lt;br&gt;* &quot;replacedBy&quot; - this dataSource/dataSet is deprecated and replaced by that of &lt;i&gt;relatedId&lt;/i&gt;. This setting is for consumption by an ODA host, and does not automatically affect the behavior of the ODA framework. It is up to an ODA host to apply as appropriate, e.g. to migrate its reference of a deprecated extension, and to control which ODA extension to use at runtime.
&lt;br&gt;* (Additional types are TBD.)
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="replacedBy">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="relatedId" type="string" use="required">
<annotation>
<documentation>
The fully qualified ID of the related ODA data source or data set element.
Its value must match that of the corresponding &lt;i&gt;dataSource.id&lt;/i&gt; or &lt;i&gt;dataSet.id&lt;/i&gt; attribute defined in another ODA driver&apos;s &lt;i&gt;org.eclipse.datatools.connectivity.oda.dataSource&lt;/i&gt; extension.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
3.0
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
&lt;p&gt;
&lt;pre&gt;
&lt;extension
point=&quot;org.eclipse.datatools.connectivity.oda.dataSource&quot;&gt;
&lt;dataSource
odaVersion=&quot;3.0&quot;
driverClass=&quot;org.eclipse.datatools.connectivity.oda.flatfile.FlatFileDriver&quot;
defaultDisplayName=&quot;Flat File Data Source&quot;
id=&quot;org.eclipse.datatools.connectivity.oda.flatfile&quot;
setThreadContextClassLoader=&quot;false&quot;&gt;
&lt;properties&gt;
&lt;propertyGroup
defaultDisplayName=&quot;Connection Properties&quot;
name=&quot;connectionProperties&quot;&gt;
&lt;property
type=&quot;string&quot;
defaultDisplayName=&quot;Home Folder&quot;
canInherit=&quot;true&quot;
name=&quot;HOME&quot;/&gt;
&lt;property
type=&quot;string&quot;
defaultDisplayName=&quot;Character Set&quot;
canInherit=&quot;true&quot;
name=&quot;CHARSET&quot;/&gt;
&lt;property
type=&quot;string&quot;
canInherit=&quot;true&quot;
defaultDisplayName=&quot;Includes Data Type (Yes/No)&quot;
name=&quot;INCLTYPELINE&quot;/&gt;
&lt;/propertyGroup&gt;
&lt;/properties&gt;
&lt;/dataSource&gt;
&lt;dataSet
defaultDisplayName=&quot;Flat File Data Set&quot;
id=&quot;org.eclipse.datatools.connectivity.oda.flatfile.dataSet&quot;&gt;
&lt;dataTypeMapping
nativeDataType=&quot;BIT&quot;
nativeDataTypeCode=&quot;-7&quot;
odaScalarDataType=&quot;Integer&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;TINYINT&quot;
nativeDataTypeCode=&quot;-6&quot;
odaScalarDataType=&quot;Integer&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;SMALLINT&quot;
nativeDataTypeCode=&quot;5&quot;
odaScalarDataType=&quot;Integer&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;INTEGER&quot;
nativeDataTypeCode=&quot;4&quot;
odaScalarDataType=&quot;Integer&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;BIGINT&quot;
nativeDataTypeCode=&quot;-5&quot;
odaScalarDataType=&quot;Decimal&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;FLOAT&quot;
nativeDataTypeCode=&quot;6&quot;
odaScalarDataType=&quot;Double&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;REAL&quot;
nativeDataTypeCode=&quot;7&quot;
odaScalarDataType=&quot;Double&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;DOUBLE&quot;
nativeDataTypeCode=&quot;8&quot;
odaScalarDataType=&quot;Double&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;NUMERIC&quot;
nativeDataTypeCode=&quot;2&quot;
odaScalarDataType=&quot;Decimal&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;DECIMAL&quot;
nativeDataTypeCode=&quot;3&quot;
odaScalarDataType=&quot;Decimal&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;CHAR&quot;
nativeDataTypeCode=&quot;1&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;VARCHAR&quot;
nativeDataTypeCode=&quot;12&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;LONGVARCHAR&quot;
nativeDataTypeCode=&quot;-1&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;DATE&quot;
nativeDataTypeCode=&quot;91&quot;
odaScalarDataType=&quot;Date&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;TIME&quot;
nativeDataTypeCode=&quot;92&quot;
odaScalarDataType=&quot;Time&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;TIMESTAMP&quot;
nativeDataTypeCode=&quot;93&quot;
odaScalarDataType=&quot;Timestamp&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;BINARY&quot;
nativeDataTypeCode=&quot;-2&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;VARBINARY&quot;
nativeDataTypeCode=&quot;-3&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;LONGVARBINARY&quot;
nativeDataTypeCode=&quot;-4&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;BOOLEAN&quot;
nativeDataTypeCode=&quot;16&quot;
odaScalarDataType=&quot;Integer&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;BLOB&quot;
nativeDataTypeCode=&quot;2004&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;dataTypeMapping
nativeDataType=&quot;CLOB&quot;
nativeDataTypeCode=&quot;2005&quot;
odaScalarDataType=&quot;String&quot;/&gt;
&lt;/dataSet&gt;
&lt;/extension&gt;
&lt;/pre&gt;
&lt;/p&gt;
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
The data source extension&apos;s driver must implement the interfaces defined in the &lt;i&gt;org.eclipse.datatools.connectivity.oda&lt;/i&gt; package. See the package&apos;s JavaDoc documentation and API interfaces for more information.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
The plug-in &lt;i&gt;org.eclipse.datatools.connectivity.oda.flatfile&lt;/i&gt;, supplied with the Eclipse DTP Connectivity source, provides an example for implementing a simple ODA run-time extension.
&lt;br&gt;
In addition, a set of default implementation of the main ODA runtime interfaces are provided in the
&lt;i&gt;org.eclipse.datatools.connectivity.oda.impl&lt;/i&gt; package.
These classes assume the behavior of a simple ODA driver,
and have labeled TODO tasks for a driver developer to implement data source specific behavior.
These concrete classes are provided for use as templates or base classes to aid in the development of an ODA custom driver. Their use is purely optional.
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
Copyright (c) 2004-2006 Actuate Corporation.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
</documentation>
</annotation>
</schema>

View File

@@ -0,0 +1,2 @@
*.css
*.html

View File

@@ -0,0 +1,402 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
/**
* An optional, extended query interface for more advanced query capabilities.
* It may have complex input parameters, scalar or complex output parameters,
* and/or return a single or multiple result sets.
* <p>A result set may be extended to be referenced by name.
* An input parameter may be extended to support the structure or table data type.
* An output parameter may be of scalar or structure data type.
* <br>
* All advanced query implementations (e.g. stored procedures, SAP R/3 BAPI's)
* should implement this interface.
* <p>
* A parameter may be referenced by name or position.
* <br>
* The case-sensitivity of a name is implementation-dependent.
* All indices in this interface are 1-based.
* <p>
* <b>Note:</b> All IAdvancedQuery interface methods should only be
* called after IQuery.prepare() has been called.
*/
public interface IAdvancedQuery extends IQuery
{
/**
* Executes the query's prepared query that may return multiple result sets.
* <b>Note:</b> This should only be called after prepare().
* @return true if the next result is an IResultSet object;
* false if there are no result sets.
* @throws OdaException if data source error occurs.
*/
public boolean execute() throws OdaException;
/**
* Returns the current result as an IResultSet object.
* <b>Note:</b> This method should be called only once per result.
* @return an IResultSet object.
* @throws OdaException if data source error occurs.
*/
public IResultSet getResultSet() throws OdaException;
/**
* Moves to the query's next result set. This method also implicitly
* closes the current IResultSet object obtained from the previous call to
* getResultSet().
* @return true, if there are more results in this query object.
* @throws OdaException if data source error occurs.
*/
public boolean getMoreResults() throws OdaException;
/**
* Returns the names of result sets that can be returned by
* this IAdvancedQuery.
* <br>An optional method; only applicable to a query that
* can retrieve multiple named result sets.
* @return an array of result set names.
* @throws OdaException if data source error occurs.
*/
public String[] getResultSetNames() throws OdaException;
/**
* Returns the metadata of the expected named result.
* @param resultSetName the name of the result.
* @return an IResultSetMetaData object.
* @throws OdaException if data source error occurs.
*/
public IResultSetMetaData getMetaDataOf( String resultSetName ) throws OdaException;
/**
* Returns the named result as an IResultSet object, or null if none is
* available. <b>Note:</b> This method should be called only once per result.
* @param resultSetName the name of the target result set.
* @return an IResultSet object.
* @throws OdaException if data source error occurs.
*/
public IResultSet getResultSet( String resultSetName ) throws OdaException;
/**
* Returns an IParameterRowSet object that contains a single row
* representing the named structure input parameter.
* Client will then use the IParameterRowSet
* setter methods to populate the input parameter values.
* For example:
* <br>
* <code><br>
* IParameterRowSet myStruct = myQuery.setNewRow( "MyStructureName" );<br>
* myStruct.next();<br>
* myStruct.setString( 1, "myValue" );<br>
* <br></code>
* <br>An optional method; applicable only if named structure input
* parameters are supported.
* @param parameterName name of the parameter.
* @return an IParameterRowSet object.
* @throws OdaException if data source error occurs.
*/
public IParameterRowSet setNewRow( String parameterName ) throws OdaException;
/**
* Returns an IParameterRowSet object that contains a single row
* representing the specified structure input parameter.
* Client will then use the IParameterRowSet
* setter methods to populate the input parameter values.
* <br>An optional method; applicable only if structure input
* parameters are supported.
* @param parameterId id of the parameter (1-based).
* @return an IParameterRowSet object.
* @throws OdaException if data source error occurs.
*/
public IParameterRowSet setNewRow( int parameterId ) throws OdaException;
/**
* Returns an empty IParameterRowSet object that represents the named
* table input parameter. Client will then use the IParameterRowSet setter
* methods to populate each row of the input parameter values.
* For example:
* <br>
* <code><br>
* IParameterRowSet myTable = myQuery.setNewRowSet( "MyTableName" );<br>
* myTable.add();<br>
* myTable.setString( 1, "myValue1" );<br>
* myTable.add();<br>
* myTable.setString( 1, "myValue2" );<br>
* <br></code>
* <br>An optional method; applicable only if named table input
* parameters are supported.
* @param parameterName name of the parameter.
* @return an IParameterRowSet object.
* @throws OdaException if data source error occurs.
*/
public IParameterRowSet setNewRowSet( String parameterName ) throws OdaException;
/**
* Returns an empty IParameterRowSet object that represents the specified
* table input parameter. Client will then use the IParameterRowSet setter
* methods to populate each row of the input parameter values.
* <br>An optional method; applicable only if table input
* parameters are supported.
* @param parameterId id of the parameter (1-based).
* @return an IParameterRowSet object.
* @throws OdaException if data source error occurs.
*/
public IParameterRowSet setNewRowSet( int parameterId ) throws OdaException;
/**
* Returns the integer value from the designated output parameter.
* @param parameterName name of the parameter.
* @return the integer value.
* @throws OdaException if data source error occurs.
*/
public int getInt( String parameterName ) throws OdaException;
/**
* Returns the integer value from the designated output parameter.
* @param parameterId id of the parameter (1-based).
* @return the integer value.
* @throws OdaException if data source error occurs.
*/
public int getInt( int parameterId ) throws OdaException;
/**
* Returns the double value from the designated output parameter.
* @param parameterName name of the parameter.
* @return the double value.
* @throws OdaException if data source error occurs.
*/
public double getDouble( String parameterName ) throws OdaException;
/**
* Returns the double value from the designated output parameter.
* @param parameterId id of the parameter (1-based).
* @return the double value.
* @throws OdaException if data source error occurs.
*/
public double getDouble( int parameterId ) throws OdaException;
/**
* Returns the decimal value from the designated output parameter.
* @param parameterName name of the parameter.
* @return the decimal value.
* @throws OdaException if data source error occurs.
*/
public BigDecimal getBigDecimal( String parameterName ) throws OdaException;
/**
* Returns the decimal value from the designated output parameter.
* @param parameterId id of the parameter (1-based).
* @return the decimal value.
* @throws OdaException if data source error occurs.
*/
public BigDecimal getBigDecimal( int parameterId ) throws OdaException;
/**
* Returns the String value from the designated output parameter.
* An ODA runtime driver may or may not support getString() on a non-String
* type parameter. The format of the returned string is implementation-
* dependent.
* @param parameterName name of the parameter.
* @return the String value.
* @throws OdaException if data source error occurs.
*/
public String getString( String parameterName ) throws OdaException;
/**
* Returns the String value from the designated output parameter.
* An ODA runtime driver may or may not support getString() on a non-String
* type parameter. The format of the returned string is implementation-
* dependent.
* @param parameterId id of the parameter (1-based).
* @return the String value.
* @throws OdaException if data source error occurs.
*/
public String getString( int parameterId ) throws OdaException;
/**
* Returns the java.sql.Date value from the designated output parameter.
* @param parameterName name of the parameter.
* @return the java.sql.Date value.
* @throws OdaException if data source error occurs.
*/
public Date getDate( String parameterName ) throws OdaException;
/**
* Returns the java.sql.Date value from the designated output parameter.
* @param parameterId id of the parameter (1-based).
* @return the java.sql.Date value.
* @throws OdaException if data source error occurs.
*/
public Date getDate( int parameterId ) throws OdaException;
/**
* Returns the java.sql.Time value from the designated output parameter.
* @param parameterName name of the parameter.
* @return the java.sql.Time value.
* @throws OdaException if data source error occurs.
*/
public Time getTime( String parameterName ) throws OdaException;
/**
* Returns the java.sql.Time value from the designated output parameter.
* @param parameterId id of the parameter (1-based).
* @return the java.sql.Time value.
* @throws OdaException if data source error occurs.
*/
public Time getTime( int parameterId ) throws OdaException;
/**
* Returns the java.sql.Timestamp value from the designated output parameter.
* @param parameterName name of the parameter.
* @return the java.sql.Timestamp value.
* @throws OdaException if data source error occurs.
*/
public Timestamp getTimestamp( String parameterName ) throws OdaException;
/**
* Returns the java.sql.Timestamp value from the designated output parameter.
* @param parameterId id of the parameter (1-based).
* @return the java.sql.Timestamp value.
* @throws OdaException if data source error occurs.
*/
public Timestamp getTimestamp( int parameterId ) throws OdaException;
/**
* Returns the IBlob value from the designated output parameter.
* <p><b>Note:</b> The driver must guarantee that
* the returned IBlob object and its BLOB data would remain valid
* and accessible until this query instance is closed.
* @param parameterName name of the parameter.
* @return an IBlob object that represents the BLOB value;
* or <code>null</code> if the specific parameter
* has null value.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IBlob getBlob( String parameterName ) throws OdaException;
/**
* Returns the IBlob value from the designated output parameter.
* <p><b>Note:</b> The driver must guarantee that
* the returned IBlob object and its BLOB data would remain valid
* and accessible until this query instance is closed.
* @param parameterId id of the parameter (1-based).
* @return an IBlob object that represents the BLOB value;
* or <code>null</code> if the specific parameter
* has null value.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IBlob getBlob( int parameterId ) throws OdaException;
/**
* Returns the IClob value from the designated output parameter.
* <p><b>Note:</b> The driver must guarantee that
* the returned IClob object and its CLOB data would remain valid
* and accessible until this query instance is closed.
* @param parameterName name of the parameter.
* @return an IClob object that represents the CLOB value;
* or <code>null</code> if the specific parameter
* has null value.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IClob getClob( String parameterName ) throws OdaException;
/**
* Returns the IClob value from the designated output parameter.
* <p><b>Note:</b> The driver must guarantee that
* the returned IClob object and its CLOB data would remain valid
* and accessible until this query instance is closed.
* @param parameterId id of the parameter (1-based).
* @return an IClob object that represents the CLOB value;
* or <code>null</code> if the specific parameter
* has null value.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IClob getClob( int parameterId ) throws OdaException;
/**
* Returns the structure value from the designated output parameter.
* This is not intended to return table structures.
* <br>An optional method; applicable only if named structure output
* parameters are supported.
* @param parameterName name of the parameter.
* @return an IParameterRowSet object with a single row.
* @throws OdaException if data source error occurs.
*/
public IParameterRowSet getRow( String parameterName ) throws OdaException;
/**
* Returns the structure value from the designated output parameter.
* <br>An optional method; applicable only if structure output
* parameters are supported.
* @param parameterId id of the parameter (1-based).
* @return an IParameterRowSet object with a single row.
* @throws OdaException if data source error occurs.
*/
public IParameterRowSet getRow( int parameterId ) throws OdaException;
/**
* Returns the 1-based index of the specified scalar or structure
* output parameter.
* @param parameterName name of the output parameter.
* @return index of the output parameter.
* @throws OdaException if data source error occurs.
*/
public int findOutParameter( String parameterName ) throws OdaException;
/**
* Returns whether the value read from the previous get&lt;type&gt; method was null.
* @return true, if the last get&lt;type&gt; call was null.
* @throws OdaException if data source error occurs.
*/
public boolean wasNull() throws OdaException;
/**
* Specifies the sort specification for the named result set of
* this <code>IAdvancedQuery</code>. This setter must be called before this is
* executed. More sort keys can be added to the SortSpec after
* it is associated with the query. The final
* sort specification is applied to the result set(s) at execution.
* <p>
* It is up to individual ODA runtime drivers to validate the type of sort specification
* that are acceptable to the provider, based on its level of dynamic sorting support.
* An <code>OdaException</code> should be thrown if the specified sort
* specification is not valid or not supported by the driver.
* @param resultSetName name of the result set.
* @param sortBy the sort specification to apply to the specified result
* set.
* @throws OdaException if data source error occurs.
*/
public void setSortSpec( String resultSetName, SortSpec sortBy ) throws OdaException;
/**
* Returns the sort specification associated with the named result set
* of this <code>IAdvancedQuery</code>.
* @param resultSetName name of the result set.
* @return the <code>SortSpec</code> associated with the specified
* result set; <code>null</code> if no <code>SortSpec</code>
* was explicitly set.
* @throws OdaException if data source error occurs.
*/
public SortSpec getSortSpec( String resultSetName ) throws OdaException;
}

View File

@@ -0,0 +1,73 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.io.InputStream;
/**
* An optional interface that represents a Binary Large Object (BLOB) value.
* <br>The interface must be implemented only if the ODA driver
* supports the BLOB data type.
* <p>The IBlob interface provides methods for retrieving a BLOB value
* as a Java input stream that can be read in smaller chunks, and
* for optionally getting the length of a BLOB value.
* <br>
* The interface method <code>IResultSet.getBlob</code> returns
* an IBlob instance.
* @since 3.0
*/
public interface IBlob
{
/**
* Retrieves the BLOB value designated by this IBlob instance
* as a binary stream of uninterpreted bytes.
* @return a Java input stream that delivers the BLOB data
* as a stream of uninterpreted bytes
* @throws OdaException if data source error occurs
*/
public InputStream getBinaryStream() throws OdaException;
/**
* Retrieves all or part of the BLOB value designated by this
* IBlob instance as an array of bytes.
* <br>An optional short-cut method to retrieve from the
* instance's binary stream.
* The ODA consumer helper framework provides default implementation,
* which is used when an ODA driver throws an UnsupportedOperationException.
* An ODA driver is however encouraged to
* provide a more efficient implementation of this method.
* @param position the 1-based ordinal position of the first byte
* in the BLOB value to be extracted
* @param length the number of consecutive bytes to be copied;
* a negative value means to copy all remaining bytes
* available in the binary stream
* @return a byte array containing up to <code>length</code>
* consecutive bytes from the BLOB value,
* starting with the byte at <code>position</code>
* @throws OdaException if data source error occurs
*/
public byte[] getBytes( long position, int length ) throws OdaException;
/**
* Returns the number of bytes in the BLOB value designated
* by this IBlob object.
* An optional method; throws UnsupportedOperationException
* if a driver does not support retrieving the length.
* @return length of the BLOB value in bytes
* @throws OdaException if data source error occurs
*/
public long length() throws OdaException;
}

View File

@@ -0,0 +1,71 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.io.Reader;
/**
* An optional interface that represents a Character Large Object (CLOB) value.
* <br>The interface must be implemented only if the ODA driver
* supports the CLOB data type.
* <p>The IClob interface provides methods for retrieving a CLOB value
* as a Java stream that can be read in smaller chunks, and
* for optionally getting the length of a CLOB value.
* <br>
* The interface method <code>IResultSet.getClob</code> returns
* an IClob instance.
* @since 3.0
*/
public interface IClob
{
/**
* Retrieves the CLOB value designated by this IClob instance
* as a java.io.Reader object for reading a stream of characters.
* @return a java.io.Reader object that contains the CLOB data
* @throws OdaException if data source error occurs
*/
public Reader getCharacterStream() throws OdaException;
/**
* Retrieves a copy of the specified substring in the CLOB value
* designated by this IClob instance.
* <br>An optional short-cut method to retrieve from the
* instance's character stream.
* The ODA consumer helper framework provides default implementation,
* which is used when an ODA driver throws an UnsupportedOperationException.
* An ODA driver is however encouraged to
* provide a more efficient implementation of this method.
* @param position the first character of the substring to be extracted.
* The first character is at position 1.
* @param length the number of consecutive characters to be copied;
* a negative value means to copy all remaining characters
* available in the stream.
* @return the specified substring that begins at <code>position</code>
* and has up to <code>length</code> consecutive characters.
* @throws OdaException if data source error occurs
*/
public String getSubString( long position, int length ) throws OdaException;
/**
* Returns the number of characters in the CLOB value
* designated by this IClob object.
* An optional method; throws UnsupportedOperationException
* if a driver does not support retrieving the length.
* @return length of the CLOB value in characters
* @throws OdaException if data source error occurs
*/
public long length() throws OdaException;
}

View File

@@ -0,0 +1,120 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.util.Properties;
/**
* A data source connection interface used to
* establish a live connection to the underlying data provider.
*/
public interface IConnection
{
/**
* Attempts to establish a connection based on the given connection
* properties.
* It is up to individual ODA driver to process the properties.
* <br>Note: An ODA driver may use the
* <code>org.eclipse.datatools.connectivity.oda.util.manifest</code>
* utility package to obtain information on itself,
* such as the content of its plug-in manifest and the driver's
* installation location.
* @param connProperties Properties necessary to establish a connection.
* @throws OdaException if data source error occurs
*/
public void open( Properties connProperties ) throws OdaException;
/**
* Sets the connection context passed through from an application.
* Its handling is specific to individual driver implementation.
* The context argument could be null. The method may be called
* by an ODA consumer application with a null argument,
* i.e. passing a null context object to this instance,
* only if a non-null context was previously passed through to
* the same instance.
* <br>
* <b>Note:</b> This method should be called before open().
* It is called regardless of whether the connection is
* already open.
* <br>An optional method.
* If any part of the context is not recognized by the driver,
* it should simply ignore, and not throw an exception.
* @param context Application context object of this instance.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public void setAppContext( Object context ) throws OdaException;
/**
* Attempts to close this connection.
* @throws OdaException if data source error occurs
*/
public void close() throws OdaException;
/**
* Checks whether this has an established connection
* @return true if connection is established.
* @throws OdaException if data source error occurs
*/
public boolean isOpen() throws OdaException;
/**
* Returns an IDataSetMetaData object of the the given
* data set type. The data set type is implementation-dependent.
* This can be called before this IConnection is opened; however some
* IDataSetMetaData methods expects and requires an opened connection
* before being called, e.g. getDataSourceObjects().
* @param dataSetType String representation of a data set type.
* @return an IDataSetMetaData object.
* @throws OdaException if data source error occurs
*/
public IDataSetMetaData getMetaData( String dataSetType ) throws OdaException;
/**
* Returns an IQuery object of the given data set type.
* The data set type is implementation-dependent.
* @param dataSetType String representation of a data set type.
* @return an IQuery object.
* @throws OdaException if data source error occurs
*/
public IQuery newQuery( String dataSetType ) throws OdaException;
/**
* Returns the maximum number of active queries for any data set types
* that the driver can support for this connection.
* @return the maximum number of any type of queries that can be prepared and executed
* concurrently, or 0 if there is no limit or the limit is unknown.
* @throws OdaException if driver error occurs
*/
public int getMaxQueries() throws OdaException;
/**
* Commits all changes made since the previous commit/rollback.
* <br>
* An optional method.
* @throws OdaException if data source error occurs
*/
public void commit() throws OdaException;
/**
* Undoes all changes made since the previous commit/rollback.
* <br>
* An optional method.
* @throws OdaException if data source error occurs
*/
public void rollback() throws OdaException;
}

View File

@@ -0,0 +1,220 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
/**
* Provides comprehensive information on the drivers capabilities
* for a type of data set query.
* <p>
* An ODA runtime driver can implement a connection
* to work with one or more types of data sets.
* Different types of data sets often support different features, and/or implement
* features in different ways. In addition, a driver may implement
* a feature on top of what the underlying data provider offers.
* <br>
* Information returned by methods in this interface applies to the capabilities
* of a particular driver and a particular type of data set working together.
* Note that as used in this documentation, the term "data set" is used
* generically to refer to both the ODA runtime driver and underlying data provider.
* <p>
* A method that gets information about a feature not supported by the driver
* will throw an OdaException. This includes methods that return an
* IResultSet object.
* <p>
* Some methods may be called before the associated connection is opened,
* while other may require the associated connection to be opened. For example:
* <p>
* <code>
* &nbsp;&nbsp;&nbsp;&nbsp;
* // connection is not opened
* <br>
* &nbsp;&nbsp;&nbsp;&nbsp;
* IDataSetMetaData metadata = connection.getMetaData( ... );
* <br>
* &nbsp;&nbsp;&nbsp;&nbsp;
* metadata.supportsInParameters();
* <br>
* &nbsp;&nbsp;&nbsp;&nbsp;
* connection.open();
* <br>
* &nbsp;&nbsp;&nbsp;&nbsp;
* metadata.getDataSourceObjects( ... ); // requires an opened connection
* <br>
* </code>
*/
public interface IDataSetMetaData
{
/**
* The constant indicating that <code>OdaException.getSQLState</code> will
* return a X/Open SQL CLI SQLSTATE value.
*/
public static final int sqlStateXOpen = 0;
/**
* The constant indicating that <code>OdaException.getSQLState</code> will
* return a SQL99 SQLSTATE value.
*/
public static final int sqlStateSQL99 = 1;
/**
* The constant indicating that dynamic sorting is not supported.
*/
public static final int sortModeNone = 0;
/**
* The constant indicating that all sorted columns must be in the same
* sort order.
*/
public static final int sortModeSingleOrder = 1;
/**
* The constant indicating that each sorted column can have a different
* sort order.
*/
public static final int sortModeColumnOrder = 2;
/**
* The constant indicating that only one single column can be sorted.
*/
public static final int sortModeSingleColumn = 3;
/**
* Returns the connection that produced this metadata object.
* @return the connection that produced this metadata object.
* @throws OdaException if data source error occurs.
*/
public IConnection getConnection() throws OdaException;
/**
* Returns the collection of objects found in a data provider's catalog.
* Valid arguments to this method are implementation-dependent.
* <br>
* An optional method.
* @param catalog data provider's catalog.
* @param schema search pattern for the data provider's schema or
* owner name; could be left empty if not applicable to
* the connected data provider.
* @param object search pattern for the data provider's object name.
* @param version data provider's objects version.
* @return an IResultSet object describing the data provider's objects.
* @throws OdaException if data source error occurs.
*/
public IResultSet getDataSourceObjects( String catalog,
String schema,
String object,
String version ) throws OdaException;
/**
* Returns the major version number of the underlying data provider.
* @return the major version number.
* @throws OdaException if data source error occurs.
*/
public int getDataSourceMajorVersion() throws OdaException;
/**
* Returns the minor version number of the underlying data provider.
* @return the minor version number.
* @throws OdaException if data source error occurs.
*/
public int getDataSourceMinorVersion() throws OdaException;
/**
* Returns the name of this data provider product.
* @return data provider product name.
* @throws OdaException if data source error occurs.
*/
public String getDataSourceProductName() throws OdaException;
/**
* Returns the version of this data provider product as a <code>String</code>.
* @return data provider product version.
* @throws OdaException if data source error occurs.
*/
public String getDataSourceProductVersion() throws OdaException;
/**
* Indicates whether the SQLSTATE returned by <code>OdaException.getSQLState()</code>
* is X/Open SQL CLI or SQL99.
* <br>An optional method.
* @return the type of SQLSTATE;<br>
* one of sqlStateXOpen,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* sqlStateSQL99.
* @throws OdaException if data source error occurs.
*/
public int getSQLStateType() throws OdaException;
/**
* Indicates whether this data set type supports getting
* multiple <code>IResultSet</code> objects (sequentially or simultaneously),
* in its <code>IAdvancedQuery</code> implementation.
* @return true if this data set supports getting multiple
* <code>IResultSet</code> objects; false otherwise.
* @throws OdaException if data source error occurs.
*/
public boolean supportsMultipleResultSets() throws OdaException;
/**
* Indicates whether this data set type supports getting
* multiple <code>IResultSet</code> objects simultaneously,
* in its <code>IAdvancedQuery</code> implementation.
* @return true if this data set supports getting multiple
* <code>IResultSet</code> objects simultaneously; false otherwise.
* @throws OdaException if data source error occurs.
*/
public boolean supportsMultipleOpenResults() throws OdaException;
/**
* Indicates whether this data set type supports getting
* one or more <code>IResultSet</code> objects by name,
* in its <code>IAdvancedQuery</code> implementation.
* @return true if this data set supports getting one or more
* <code>IResultSet</code> objects by name; false otherwise.
* @throws OdaException if data source error occurs.
*/
public boolean supportsNamedResultSets() throws OdaException;
/**
* Indicates whether this data set type supports named parameters in
* <code>IQuery</code>.
* @return true if named parameters are supported; false otherwise.
* @throws OdaException if data source error occurs.
*/
public boolean supportsNamedParameters() throws OdaException;
/**
* Indicates whether this data set type supports input parameters in
* <code>IQuery</code>.
* @return true if input parameters are supported; false otherwise.
* @throws OdaException if data source error occurs.
*/
public boolean supportsInParameters() throws OdaException;
/**
* Indicates whether this data set type supports output parameters
* in its <code>IAdvancedQuery</code> implementation.
* @return true if output parameters are supported; false otherwise.
* @throws OdaException if data source error occurs.
*/
public boolean supportsOutParameters() throws OdaException;
/**
* Returns the dynamic sorting mode supported by this data set type.
* @return the dynamic sorting mode supported by the data source; one
* of <code>sortModeNone</code>, <code>sortModeSingleOrder</code>,
* <code>sortModeColumnOrder</code>, <code>sortModeSingleColumn</code>
*/
public int getSortMode();
}

View File

@@ -0,0 +1,75 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
/**
* The entry point to a custom ODA run-time drivers implementation.
* It is also a connection factory used to produce an IConnection object.
*/
public interface IDriver
{
/**
* Returns an IConnection object that can then be
* used to establish a runtime connection to the underlying
* data source with the given unique id.
* @param dataSourceId The id of a type of data source supported by this IDriver.
* This matches the data source element id defined in
* the data source driver's configuration file.
* A null or empty String will use the default
* data source type supported by this IDriver.
* @return an IConnection object
* @see IConnection
* @throws OdaException if data source error occurs.
*/
public IConnection getConnection( String dataSourceId )
throws OdaException;
/**
* An optional method to set the trace logging configuration of the ODA runtime driver
* for the given type of data source and its runtime connection(s).
* @param logConfig The trace logging configuration.
* @throws OdaException if ODA runtime driver error occurs.
*/
public void setLogConfiguration( LogConfiguration logConfig ) throws OdaException;
/**
* Returns the maximum number of concurrent connections that the driver can support.
* @return the maximum number of any type of connections that can be open concurrently,
* or 0 if there is no limit or the limit is unknown.
* @throws OdaException if driver error occurs.
*/
public int getMaxConnections() throws OdaException;
/**
* Sets the driver context passed through from an application.
* Its handling is specific to individual driver implementation.
* The context argument could be null. The method may be called
* by an ODA consumer application with a null argument,
* i.e. passing a null context object to this instance,
* only if a non-null context was previously passed through to
* the same instance.
* <br>
* <b>Note:</b> This method should be called before getConnection( String ).
* <br>An optional method.
* If any part of the context is not recognized by the driver,
* it should simply ignore, and not throw an exception.
* @param context Application context object of this instance.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public void setAppContext( Object context ) throws OdaException;
}

View File

@@ -0,0 +1,145 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
/**
* An interface that represents the meta-data
* of input/output parameters defined in a prepared query.
* Its implementation is required only if the driver supports
* query parameters.
* <p>
* <b>Note:</b> All parameter indices in this interface are 1-based.
*/
public interface IParameterMetaData
{
/**
* The constant indicating that the input/output mode of the
* parameter is unknown.
*/
public static final int parameterModeUnknown = 0;
/**
* The constant indicating that the parameter is an input parameter.
*/
public static final int parameterModeIn = 1;
/**
* The constant indicating that the parameter is both input and output.
*/
public static final int parameterModeInOut = 2;
/**
* The constant indicating that the parameter is an output parameter.
*/
public static final int parameterModeOut = 3;
/**
* The constant indicating that the nullability of the parameter is
* unknown.
*/
public static final int parameterNullableUnknown = 0;
/**
* The constant indicating that the parameter will not allow NULL
* values.
*/
public static final int parameterNoNulls = 1;
/**
* The constant indicating that the parameter will allow NULL values.
*/
public static final int parameterNullable = 2;
/**
* Returns the number of parameters defined in the
* prepared IQuery object.
* @return the number of parameters.
* @throws OdaException if data source error occurs.
*/
public int getParameterCount() throws OdaException;
/**
* Returns the input/output mode of the specified parameter.
* @param param 1-based index of the parameter.
* @return the input/output mode of the parameter;<br>
* one of parameterModeUnknown,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* parameterModeIn,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* parameterModeInOut,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* parameterModeOut.
* @throws OdaException if data source error occurs.
*/
public int getParameterMode( int param ) throws OdaException;
/**
* Returns the data provider specific code of the parameter's data type.
* The valid values are implementation-specific.
* @param param 1-based index of the parameter.
* @return the native data type code of the parameter.
* @throws OdaException if data source error occurs.
*/
public int getParameterType( int param ) throws OdaException;
/**
* Returns the data provider specific name of the parameter's data type.
* @param param 1-based index of the parameter.
* @return the native data type name of the parameter.
* @throws OdaException if data source error occurs.
*/
public String getParameterTypeName( int param ) throws OdaException;
/**
* Returns the maximum number of decimal digits for the specified parameter.
* This method should only apply to numeric data types; however, it is up
* to an ODA data provider to determine those data types that are
* applicable. The maximum precision allowed on a data type may vary depending
* on the data provider.
* <br>An optional method.
* @param param 1-based index of the parameter.
* @return the precision of the parameter, or -1 if not applicable.
* @throws OdaException if data source error occurs.
*/
public int getPrecision( int param ) throws OdaException;
/**
* Returns the maximum number of digits to the right of the decimal point
* for the specified parameter.
* This method should only apply to numeric data types;
* however, it is up to an ODA data provider to determine
* those data types that are applicable. The maximum scale allowed on
* a data type may vary depending on the data provider.
* <br>An optional method.
* @param param 1-based index of the parameter.
* @return the scale of the parameter, or -1 if not applicable.
* @throws OdaException if data source error occurs.
*/
public int getScale( int param ) throws OdaException;
/**
* Returns whether null values are allowed for the specified parameter.
* <br>An optional method.
* @param param 1-based index of the parameter.
* @return the nullability of the parameter;<br>
* one of parameterNullableUnknown,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* parameterNoNulls,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* parameterNullable.
* @throws OdaException if data source error occurs.
*/
public int isNullable( int param ) throws OdaException;
}

View File

@@ -0,0 +1,205 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
/**
* An optional interface that represents complex data type objects
* such as structures and tables.
* <p>
* The interface applies only if the ODA driver supports
* the use of complex input and/or output parameters.
* A structure can be represented by an IParameterRowSet object with one row.
* This interface is used to represent complex parameter data values.
* A complex parameter's metadata
* can be obtained from its inherited getMetaData() method.
* <p>
* A row set column may be referenced by name or position.
* <br>
* The case-sensitivity of a name is implementation-dependent.
* All indices in this interface are 1-based.
*/
public interface IParameterRowSet extends IResultSet
{
/**
* Moves the cursor to the designated row number.
* @param rowIndex the row number (1-based).
* @return true, if cursor is moved successfully to the desired row.
* @throws OdaException if data source error occurs.
*/
public boolean absolute( int rowIndex ) throws OdaException;
/**
* Moves the cursor up one element from its current position.
* <br>An optional method.
* @return true, if the cursor is moved successfully to a valid row.
* @throws OdaException if data source error occurs.
*/
public boolean previous() throws OdaException;
/**
* Appends a new row to the end of this collection and moves the cursor
* to the new row's position.
* <br>Only required for input parameters.
* @return 0 if this failed to add a new row. Otherwise, the rowIndex
* of the new row.
* @throws OdaException if data source error occurs.
*/
public int add() throws OdaException;
/**
* Removes all of the elements from this collection.
* <br>An optional method.
* @throws OdaException if data source error occurs.
*/
public void clear() throws OdaException;
/**
* Determines whether this does not contain any elements.
* @return true, if this is empty.
* @throws OdaException if data source error occurs.
*/
public boolean isEmpty() throws OdaException;
/**
* Returns the number of elements in this collection.
* @return size of this collection.
* @throws OdaException if data source error occurs.
*/
public int size() throws OdaException;
/**
* Sets the integer value at the designated column.
* @param columnIndex index of the column.
* @param value the integer value.
* @throws OdaException if data source error occurs.
*/
public void setInt( int columnIndex, int value ) throws OdaException;
/**
* Sets the integer value at the designated column.
* @param columnName name of the column.
* @param value the integer value.
* @throws OdaException if data source error occurs.
*/
public void setInt( String columnName, int value ) throws OdaException;
/**
* Sets the double value at the designated column.
* @param columnIndex index of the column.
* @param value the double value.
* @throws OdaException if data source error occurs.
*/
public void setDouble( int columnIndex, double value ) throws OdaException;
/**
* Sets the double value at the designated column.
* @param columnName name of the column.
* @param value the double value.
* @throws OdaException if data source error occurs.
*/
public void setDouble( String columnName, double value ) throws OdaException;
/**
* Sets the decimal value at the designated column.
* @param columnIndex index of the column.
* @param value the decimal value.
* @throws OdaException if data source error occurs.
*/
public void setBigDecimal( int columnIndex, BigDecimal value ) throws OdaException;
/**
* Sets the decimal value at the designated column.
* @param columnName name of the column.
* @param value the decimal value.
* @throws OdaException if data source error occurs.
*/
public void setBigDecimal( String columnName, BigDecimal value ) throws OdaException;
/**
* Sets the string value at the designated column.
* An ODA runtime driver may or may not support setString() on a non-String
* type column.
* The format of the string parameter is implementation-dependent.
* @param columnIndex index of the column.
* @param value the string value.
* @throws OdaException if data source error occurs.
*/
public void setString( int columnIndex, String value ) throws OdaException;
/**
* Sets the string value at the designated column.
* An ODA runtime driver may or may not support setString() on a non-String
* type column.
* The format of the string parameter is implementation-dependent.
* @param columnName name of the column.
* @param value the string value.
* @throws OdaException if data source error occurs.
*/
public void setString( String columnName, String value ) throws OdaException;
/**
* Sets the date value at the designated column.
* @param columnIndex index of the column.
* @param value the java.sql.Date value.
* @throws OdaException if data source error occurs.
*/
public void setDate( int columnIndex, Date value ) throws OdaException;
/**
* Sets the date value at the designated column.
* @param columnName name of the column.
* @param value the java.sql.Date value.
* @throws OdaException if data source error occurs.
*/
public void setDate( String columnName, Date value ) throws OdaException;
/**
* Sets the time value at the designated column.
* @param columnIndex index of the column.
* @param value the java.sql.Time value.
* @throws OdaException if data source error occurs.
*/
public void setTime( int columnIndex, Time value ) throws OdaException;
/**
* Sets the time value at the designated column.
* @param columnName name of the column.
* @param value the java.sql.Time value.
* @throws OdaException if data source error occurs.
*/
public void setTime( String columnName, Time value ) throws OdaException;
/**
* Sets the time stamp value at the designated column.
* @param columnIndex index of the column.
* @param value the java.sql.Timestamp value.
* @throws OdaException if data source error occurs.
*/
public void setTimestamp( int columnIndex, Timestamp value ) throws OdaException;
/**
* Sets the time stamp value at the designated column.
* @param columnName name of the column.
* @param value the java.sql.Timestamp value.
* @throws OdaException if data source error occurs.
*/
public void setTimestamp( String columnName, Timestamp value ) throws OdaException;
}

View File

@@ -0,0 +1,318 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
/**
* The base query interface to
* prepare and execute a query text to retrieve data.
* This base interface covers most basic query capabilities,
* such as returning data rows in a single result set, and
* may support scalar input parameters.
* <p>
* Note: An IQuery object must <b>ALWAYS</b> be prepared before
* calling execute(). For example:
* <p>
* <code>
* query.prepare( "SELECT * FROM TABLE" );<br>
* // prepare succeeded, no exception was thrown <br>
* query.execute();</pre>
* </code>
* <p>
* An input parameter may be referenced by name or position.
* <br>
* The case-sensitivity of a name is implementation-dependent.
* All indices in this interface are 1-based.
*/
public interface IQuery
{
/**
* Performs necessary checks to determine whether the query text
* is of a valid format supported by this IQuery implementation.
* @param queryText a query text to prepare or pre-compile;
* it cannot be null.
* @throws OdaException if data source error occurs
*/
public void prepare( String queryText ) throws OdaException;
/**
* Sets the query context passed through from an application.
* Its handling is specific to individual driver implementation.
* The context argument could be null. The method may be called
* by an ODA consumer application with a null argument,
* i.e. passing a null context object to this instance,
* only if a non-null context was previously passed through to
* the same instance.
* <br>
* <b>Note:</b> This method should be called before prepare().
* <br>An optional method.
* If any part of the context is not recognized by the driver,
* it should simply ignore, and not throw an exception.
* @param context Application context object of this instance.
* @throws OdaException if data source error occurs
* @since 3.0
*/
public void setAppContext( Object context ) throws OdaException;
/**
* Sets the named property with the specified value.
* Multiple calls using the same property name may be allowed
* to assign multiple values to the same property.
* Its handling is specific to individual driver implementation.
* <br>Each ODA extension property defined for a data set
* triggers an ODA consumer to call this method
* with corresponding property value, which could be null.
* An ODA consumer does not distinguish whether a property value
* is not set or explicitly set to null.
* Its handling is specific to individual driver implementation.
* <br>
* <b>Note:</b> This method should be called before executeQuery() or
* other extended execution method(s).
* <br>An optional method.
* @param name name of the property.
* @param value value to assign to the named property; could be null.
* @throws OdaException if data source error occurs
*/
public void setProperty( String name, String value ) throws OdaException;
/**
* Attempts to close this IQuery.
* @throws OdaException if data source error occurs
*/
public void close() throws OdaException;
/**
* Specifies the maximum number of rows that can be fetched from
* the query's result set(s).
* <br>An optional method.
* @param max the maximum number of rows that can be fetched from each
* result set of this IQuery; zero means there is no limit.
* @throws OdaException if data source error occurs
*/
public void setMaxRows( int max ) throws OdaException;
/**
* Returns the maximum number of rows that can be fetched from
* the query's result set(s).
* <br>An optional method.
* @return the maximum number of rows that can be fetched from each
* result set of this IQuery; zero means there is no limit.
* @throws OdaException if data source error occurs
*/
public int getMaxRows() throws OdaException;
/**
* Returns the metadata of the current result set for this prepared IQuery.
* This should only be called after prepare(). If the method is called before
* the IQuery is executed, the returned metadata refers to its first result
* set.
* @return an IResultSetMetaData object.
* @throws OdaException if data source error occurs
*/
public IResultSetMetaData getMetaData() throws OdaException;
/**
* Executes the query's prepared query text and returns
* a single IResultSet object.
* <b>Note:</b> This should only be called after prepare().
* @return an IResultSet object.
* @throws OdaException if data source error occurs
*/
public IResultSet executeQuery() throws OdaException;
/**
* An optional method to clear the current input parameter values immediately.
* <p>
* In general, input parameter values remain in force for repeated use of a
* query. Setting a parameter value automatically clears its previous value.
* However, to reset all the parameters to their default values without
* explicitly setting new values, use this method.
* @throws OdaException if data source error occurs
* @throws UnsupportedOperationException
* if this operation is not supported
*/
public void clearInParameters() throws OdaException;
/**
* Sets the designated parameter to the given integer value.
* @param parameterName name of the parameter.
* @param value integer value.
* @throws OdaException if data source error occurs
*/
public void setInt( String parameterName, int value ) throws OdaException;
/**
* Sets the designated parameter to the given integer value.
* @param parameterId id of the parameter (1-based).
* @param value integer value.
* @throws OdaException if data source error occurs
*/
public void setInt( int parameterId, int value ) throws OdaException;
/**
* Sets the designated parameter to the given double value.
* @param parameterName name of the parameter.
* @param value double value.
* @throws OdaException if data source error occurs
*/
public void setDouble( String parameterName, double value ) throws OdaException;
/**
* Sets the designated parameter to the given double value.
* @param parameterId id of the parameter (1-based).
* @param value double value.
* @throws OdaException if data source error occurs
*/
public void setDouble( int parameterId, double value ) throws OdaException;
/**
* Sets the designated parameter to the given decimal value.
* @param parameterName name of the parameter.
* @param value decimal value.
* @throws OdaException if data source error occurs
*/
public void setBigDecimal( String parameterName, BigDecimal value ) throws OdaException;
/**
* Sets the designated parameter to the given decimal value.
* @param parameterId id of the parameter (1-based).
* @param value decimal value.
* @throws OdaException if data source error occurs
*/
public void setBigDecimal( int parameterId, BigDecimal value ) throws OdaException;
/**
* Sets the designated parameter to the given string value.
* An ODA runtime driver may or may not support setString() on a non-String
* type parameter.
* The format of the string parameter is implementation-dependent.
* @param parameterName name of the parameter.
* @param value string value.
* @throws OdaException if data source error occurs
*/
public void setString( String parameterName, String value ) throws OdaException;
/**
* Sets the designated parameter to the given string value.
* An ODA runtime driver may or may not support setString() on a non-String
* type parameter.
* The format of the string parameter is implementation-dependent.
* @param parameterId id of the parameter (1-based).
* @param value string value.
* @throws OdaException if data source error occurs
*/
public void setString( int parameterId, String value ) throws OdaException;
/**
* Sets the designated parameter to the given Date value.
* @param parameterName name of the parameter.
* @param value the java.sql.Date value.
* @throws OdaException if data source error occurs
*/
public void setDate( String parameterName, Date value ) throws OdaException;
/**
* Sets the designated parameter to the given Date value.
* @param parameterId id of the parameter (1-based).
* @param value the java.sql.Date value.
* @throws OdaException if data source error occurs
*/
public void setDate( int parameterId, Date value ) throws OdaException;
/**
* Sets the designated parameter to the given Time value.
* @param parameterName name of the parameter.
* @param value the java.sql.Time value.
* @throws OdaException if data source error occurs
*/
public void setTime( String parameterName, Time value ) throws OdaException;
/**
* Sets the designated parameter to the given Time value.
* @param parameterId id of the parameter (1-based).
* @param value the java.sql.Time value.
* @throws OdaException if data source error occurs
*/
public void setTime( int parameterId, Time value ) throws OdaException;
/**
* Sets the designated parameter to the given Timestamp value.
* @param parameterName name of the parameter.
* @param value the java.sql.Timestamp value.
* @throws OdaException if data source error occurs
*/
public void setTimestamp( String parameterName, Timestamp value ) throws OdaException;
/**
* Sets the designated parameter to the given Timestamp value.
* @param parameterId id of the parameter (1-based).
* @param value the java.sql.Timestamp value.
* @throws OdaException if data source error occurs
*/
public void setTimestamp( int parameterId, Timestamp value ) throws OdaException;
/**
* Returns the 1-based index of the specified input parameter.
* @param parameterName name of the parameter.
* @return index of the parameter.
* @throws OdaException if data source error occurs
*/
public int findInParameter( String parameterName ) throws OdaException;
/**
* Returns the count, data types, and other metadata attributes
* of the parameters defined in this prepared IQuery object.
* Its implementation is required for ODA runtime drivers.
* <p>
* <b>Note:</b> This should only be called after prepare() is called.
* @return an IParameterMetaData object that contains information about
* this prepared IQuery object's parameters.
* @throws OdaException if data source error occurs
*/
public IParameterMetaData getParameterMetaData() throws OdaException;
/**
* Specifies the sort specification for this <code>IQuery</code>.
* The setter must be called before this <code>IQuery</code> is executed
* or before <code>getMoreResults</code> is called.
* More sort keys can be added to the SortSpec after
* it is associated with the query.
* The final sort specification is then applied
* to subsequent result set(s) at execution.
* <p>
* It is up to individual ODA runtme drivers to validate the type of sort specification
* that are acceptable to its data provider, based on its level
* of dynamic sorting support.
* An <code>OdaException</code> should be thrown if the specified sort
* specification is not valid or not supported by the driver.
* @param sortBy the sort specification assigned to this <code>IQuery</code>.
* @throws OdaException if data source error occurs
*/
public void setSortSpec( SortSpec sortBy ) throws OdaException;
/**
* Returns the sort specification associated with this <code>IQuery</code>.
* @return the <code>SortSpec</code> assigned to this <code>IQuery</code>;
* <code>null</code> if no <code>SortSpec</code> was explicitly set.
* @throws OdaException if data source error occurs
*/
public SortSpec getSortSpec() throws OdaException;
}

View File

@@ -0,0 +1,275 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
/**
* The interface used to access a set of data rows retrieved
* by an IQuery object.
* An IResultSet object maintains a cursor pointing to its current row of data.
* Initially, the cursor is positioned before the first row. The next() method
* moves the cursor to the next row until there are no more rows, or if the
* MaxRows limit has been reached.
* <p>
* A result set column may be referenced by name or position.
* <br>
* The case-sensitivity of a name is implementation-dependent.
* All indices in this interface are 1-based.
*/
public interface IResultSet
{
/**
* Returns the metadata associated with this IResultSet.
* @return the metadata for this IResultSet
* @throws OdaException if data source error occurs
*/
public IResultSetMetaData getMetaData( ) throws OdaException;
/**
* Closes the cursor associated with this IResultSet.
* @throws OdaException if data source error occurs
*/
public void close( ) throws OdaException;
/**
* Specifies the maximum number of rows that can be fetched from this result set.
* <br>An optional method.
* @param max maximum number of rows that can be fetched from this IResultSet;
* zero means there is no limit.
* This value should not be greater than the maximum number of rows
* specified in the related IQuery.
* @throws OdaException if data source error occurs
* @since 1.1
*/
public void setMaxRows( int max ) throws OdaException;
/**
* Moves the cursor down one row from its current position.
* @return true, if next data row exists and the maxRows limit has
* not been reached.
* @throws OdaException if data source error occurs
*/
public boolean next( ) throws OdaException;
/**
* Returns the current row's 1-based index position.
* <br>An optional method.
* @return current row's 1-based index position
* @throws OdaException if data source error occurs
*/
public int getRow( ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a String.
* An ODA runtime driver may or may not support getString() on a non-String
* type column.
* The format of the returned string is implementation-dependent.
* @param index column number (1-based)
* @return the string value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public String getString( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a String.
* An ODA runtime driver may or may not support getString() on a non-String
* type column.
* The format of the returned string is implementation-dependent.
* @param columnName column name
* @return the string value in the specific column of the current row
* @throws OdaException if data source error occurs.
*/
public String getString( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row as an int.
* @param index column number (1-based)
* @return the integer value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public int getInt( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as an int.
* @param columnName column name
* @return the integer value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public int getInt( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a double.
* @param index column number (1-based)
* @return the double value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public double getDouble( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a double.
* @param columnName column name
* @return the double value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public double getDouble( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a decimal.
* @param index column number (1-based)
* @return the decimal value in the specific column of the current row
* @throws OdaException if data source error occurs
* @since 1.1
*/
public BigDecimal getBigDecimal( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a decimal.
* @param columnName column name
* @return the decimal value in the specific column of the current row
* @throws OdaException if data source error occurs
* @since 1.1
*/
public BigDecimal getBigDecimal( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a java.sql.Date.
* @param index column number (1-based)
* @return the java.sql.Date value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public Date getDate( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a java.sql.Date.
* @param columnName column name
* @return the java.sql.Date value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public Date getDate( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a java.sql.Time.
* @param index column number (1-based)
* @return the java.sql.Time value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public Time getTime( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a java.sql.Time.
* @param columnName column name
* @return the java.sql.Time value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public Time getTime( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a java.sql.Timestamp.
* @param index column number (1-based)
* @return the java.sql.Timestamp value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public Timestamp getTimestamp( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row as a java.sql.Timestamp.
* @param columnName column name
* @return the java.sql.Timestamp value in the specific column of the current row
* @throws OdaException if data source error occurs
*/
public Timestamp getTimestamp( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row
* as an IBlob object.
* <p><b>Note:</b> The driver must guarantee that
* the returned object and its BLOB data would remain valid
* and accessible until this result set is closed.
* @param index column number (1-based)
* @return an IBlob object that represents the BLOB value
* in the specific column of the current row;
* or <code>null</code> if the specific column has null value
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IBlob getBlob( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row
* as an IBlob object.
* <p><b>Note:</b> The driver must guarantee that
* the returned object and its BLOB data would remain valid
* and accessible until this result set is closed.
* @param columnName column name
* @return an IBlob object that represents the BLOB value
* in the specific column of the current row;
* or <code>null</code> if the specific column has null value
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IBlob getBlob( String columnName ) throws OdaException;
/**
* Gets the value of the designated column in the current row
* as an IClob object.
* <p><b>Note:</b> The driver must guarantee that
* the returned object and its CLOB data would remain valid
* and accessible until this result set is closed.
* @param index column number (1-based)
* @return an IClob object that represents the CLOB value
* in the specific column of the current row;
* or <code>null</code> if the specific column has null value
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IClob getClob( int index ) throws OdaException;
/**
* Gets the value of the designated column in the current row
* as an IClob object.
* <p><b>Note:</b> The driver must guarantee that
* the returned object and its CLOB data would remain valid
* and accessible until this result set is closed.
* @param columnName column name
* @return an IClob object that represents the CLOB value
* in the specific column of the current row;
* or <code>null</code> if the specific column has null value
* @throws OdaException if data source error occurs
* @since 3.0
*/
public IClob getClob( String columnName ) throws OdaException;
/**
* Returns whether the value read from the previous get&lt;type&gt; method
* was invalid or null. This needs to be called immediately after
* the call to a get&lt;type&gt; method.
* @return true, if the previous get&lt;type&gt; call was invalid or null
* @throws OdaException if data source error occurs
*/
public boolean wasNull() throws OdaException;
/**
* Returns the column index of the specified column name.
* @param columnName name of the column
* @return column index (1-based)
* @throws OdaException if data source error occurs
*/
public int findColumn( String columnName ) throws OdaException;
}

View File

@@ -0,0 +1,135 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
/**
* The interface that represents the meta-data
* of an IResultSet object.
* An IResultSetMetaData object represents a row containing meta-data
* for each column in the result set.
* <p>
* <b>Note:</b> All indices in this interface are 1-based.
*/
public interface IResultSetMetaData
{
/**
* The constant indicating that a column does not allow
* <code>NULL</code> value.
*/
public static final int columnNoNulls = 0;
/**
* The constant indicating that a column allows
* <code>NULL</code> value.
*/
public static final int columnNullable = 1;
/**
* The constant indicating that the nullability of a column's
* values is unknown.
*/
public static final int columnNullableUnknown = 2;
/**
* Returns the number of columns in the corresponding IResultSet object.
* @return number of columns.
* @throws OdaException if data source error occurs.
*/
public int getColumnCount( ) throws OdaException;
/**
* Returns the name of the specific column.
* @param index column number (1-based).
* @return the column name.
* @throws OdaException if data source error occurs.
*/
public String getColumnName( int index ) throws OdaException;
/**
* Returns the designated column's suggested title for use
* in the column heading and/or display name.
* @param index column number (1-based).
* @return the column's suggested title.
* @throws OdaException if data source error occurs.
*/
public String getColumnLabel( int index ) throws OdaException;
/**
* Returns the data provider specific code of the column's data type.
* The valid values are implementation-specific.
* @param index column number (1-based).
* @return the native data type code of the column.
* @throws OdaException if data source error occurs.
*/
public int getColumnType( int index ) throws OdaException;
/**
* Returns the data provider specific name of the column's data type.
* @param index column number (1-based).
* @return the native data type name of the column.
* @throws OdaException if data source error occurs.
*/
public String getColumnTypeName( int index ) throws OdaException;
/**
* Returns the display length of the specific column.
* @param index column number (1-based).
* @return the column display length, or -1 if unknown.
* @throws OdaException if data source error occurs.
*/
public int getColumnDisplayLength( int index ) throws OdaException;
/**
* Returns the maximum number of decimal digits of the specific column.
* This method should only apply to numeric data types; however, it is
* up to an ODA data provider to determine those data types that are
* applicable. The maximum precision allowed on a data type may vary
* depending on the data provider.
* <br>An optional method.
* @param index column number (1-based).
* @return the column precision, or -1 if not applicable.
* @throws OdaException if data source error occurs.
*/
public int getPrecision( int index ) throws OdaException;
/**
* Returns the maximum number of digits to the right of the decimal
* point of the specific column. This method should only apply
* to numeric data types, however, it is up to an ODA data provider
* to determine those data types that are applicable.
* The maximum scale allowed on a data type may vary depending on the
* data provider.
* <br>An optional method.
* @param index column number.
* @return the column scale, or -1 if not applicable.
* @throws OdaException if data source error occurs.
*/
public int getScale( int index ) throws OdaException;
/**
* Indicates the nullability of values in the designated column.
* <br>An optional method.
* @param index column number
* @return the nullability status of the specified column;<br>
* one of columnNoNulls,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* columnNullable,<br>
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* columnNullableUnknown.
* @throws OdaException if data source error occurs.
*/
public int isNullable( int index ) throws OdaException;
}

View File

@@ -0,0 +1,149 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
/**
* Encapsulates the trace logging configuration
* specified for an ODA run-time driver.
*/
public class LogConfiguration
{
private String m_dataSourceId;
private int m_logLevel;
private String m_logDirectory;
private String m_logPrefix;
private String m_formatterClassName;
/**
* Constructor to set the trace logging configuration of the ODA runtime driver
* for the given type of data source and its runtime connection(s).
* @param dataSourceId The id of a type of data source to apply
* the logging configuration.
* A null or empty String means to apply to all
* data source types supported by this IDriver.
* @param logLevel The level of information to log. The value of a
* log level is implementation dependent of the Logger
* used.
* @param logDirectory The absolute path of the log directory.
* @param logPrefix The prefix used in the log file name. For example,
* it could be used in the log file format:
* &lt;logPrefix&gt;-YYYYMMDD-hhmmss.log, but its usage
* is implementation dependent.
* @param formatterClassName The fully qualified class name of a
* <code>LogFormatter</code> implementation class.
*/
public LogConfiguration( String dataSourceId,
int logLevel,
String logDirectory,
String logPrefix,
String formatterClassName )
{
m_dataSourceId = dataSourceId;
setLogConfiguration( logLevel, logDirectory,
logPrefix, formatterClassName );
}
/**
* Constructor to set the trace logging configuration of the
* ODA runtime driver
* for all data source types supported by the IDriver.
*/
public LogConfiguration( int logLevel,
String logDirectory,
String logPrefix,
String formatterClassName )
{
setLogConfiguration( logLevel, logDirectory,
logPrefix, formatterClassName );
}
private LogConfiguration()
{
}
private void setLogConfiguration( int logLevel,
String logDirectory,
String logPrefix,
String formatterClassName )
{
m_logLevel = logLevel;
if( logDirectory != null && logDirectory.length() == 0 )
logDirectory = null;
m_logDirectory = logDirectory;
if( logPrefix != null && logPrefix.length() == 0 )
logPrefix = null;
m_logPrefix = logPrefix;
if( formatterClassName != null && formatterClassName.length() == 0 )
formatterClassName = null;
m_formatterClassName = formatterClassName;
}
/**
* Returns the id of a type of data source to apply
* the logging configuration.
* A null or empty String means to apply to all
* data source types supported by this IDriver.
* @return the dataSourceId.
*/
public String getDataSourceId()
{
return m_dataSourceId;
}
/**
* Returns the fully qualified class name of a
* <code>LogFormatter</code> implementation class,
* suitable for use by the driver-specific logging utility.
* @return the formatterClassName, or null if none is configured.
*/
public String getFormatterClassName()
{
return m_formatterClassName;
}
/**
* Returns the absolute path of the log directory.
* @return the logDirectory, or null if none is configured.
*/
public String getLogDirectory()
{
return m_logDirectory;
}
/**
* Returns the level of information to log. The value of a
* log level is implementation dependent of the Logger used.
* @return the logLevel.
*/
public int getLogLevel()
{
return m_logLevel;
}
/**
* Returns the prefix used in the log file name.
* For example, it could be used in the log file format:
* &lt;logPrefix&gt;-YYYYMMDD-hhmmss.log, but its usage
* is implementation dependent.
* @return the logPrefix, or null if none is configured.
*/
public String getLogPrefix()
{
return m_logPrefix;
}
}

View File

@@ -0,0 +1,217 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
/**
* An exception class that provides information on an ODA runtime driver
* error or other data provider errors.
* <P>Each <code>OdaException</code> provides several kinds of information:
* <UL>
* <LI> a string describing the error. This is used as the Java Exception
* message, available via the method <code>getMessage</code>.
* <LI> a SQLSTATE string, which follows either the XOPEN SQLSTATE conventions
* or the SQL 99 conventions.
* The values of the SQLSTATE string are described in the corresponding spec.
* The method <code>IDataSetMetaData.getSQLStateType()</code>
* can be used to discover whether the driver returns the XOPEN type or
* the SQL 99 type.
* <LI> an integer exception code that is specific to each vendor. Normally this will
* be the actual error code returned by the underlying data provider.
* <LI> a chain to the next OdaException. This can be used to provide additional
* error information.
* </UL>
* <P>
* <b>Note:</b> The OdaException chain is different from the "Cause" that was
* introduced in Java SDK 1.4 Throwable. The chain is meant to handle situations
* where multiple (possibly unrelated) OdaExceptions may occur.
*/
public class OdaException extends Exception
{
private String m_sqlState;
private int m_vendorCode;
private OdaException m_nextException;
private boolean m_isCauseSet = false;
private Throwable m_cause = null;
/**
* Instantiates an OdaException object whose message text defaults to null,
* SQLSTATE defaults to null, and vendorCode defaults to 0.
*/
public OdaException()
{
super();
m_sqlState = null;
m_vendorCode = 0;
m_nextException = null;
}
/**
* Instantiates an OdaException object with a message.
* The SQLSTATE defaults to null, and vendorCode defaults to 0.
* @param message description of the exception.
*/
public OdaException( String message )
{
super( message );
m_sqlState = null;
m_vendorCode = 0;
m_nextException = null;
}
/**
* Instantiates an OdaException object with a message and SQLSTATE.
* The vendorCode defaults to 0.
* @param message description of the exception.
* @param sqlState an XOPEN or SQL 99 code identifying the exception.
*/
public OdaException( String message, String sqlState )
{
super( message );
m_sqlState = sqlState;
m_vendorCode = 0;
m_nextException = null;
}
/**
* Instantiates a fully specified OdaException object.
* @param message description of the exception.
* @param sqlState an XOPEN or SQL 99 code identifying the exception.
* @param vendorCode a data provider vendor-specific exception code.
*/
public OdaException( String message, String sqlState, int vendorCode )
{
super( message );
m_sqlState = sqlState;
m_vendorCode = vendorCode;
m_nextException = null;
}
/**
* Instantiates an OdaException object whose message text
* defaults to null, and initialized with given cause.
* @param cause cause of exception
*/
public OdaException( Throwable cause )
{
super();
initCause( cause );
}
/**
* Returns the SQLSTATE of this <code>OdaException</code> object.
* @return the SQLSTATE value.
*/
public String getSQLState()
{
return m_sqlState;
}
/**
* Returns the vendor-specific exception code of this <code>OdaException</code>
* object.
* @return the vendor's exception code.
*/
public int getErrorCode()
{
return m_vendorCode;
}
/**
* Returns the next <code>OdaException</code> chained to this <code>OdaException</code>
* object.
* @return the next <code>OdaException</code> object in the chain,
* null if there are none.
*/
public OdaException getNextException()
{
return m_nextException;
}
/**
* Adds an <code>OdaException</code> object to the end of the
* <code>OdaException</code> chain.
* @param nextException the new <code>OdaException</code> object to be
* added to the <code>OdaException</code> chain.
*/
public void setNextException( OdaException nextException )
{
// iterate to the end of the exception chain, which is the
// exception with a null for its next exception.
OdaException ex = this;
while( ex.m_nextException != null )
ex = ex.m_nextException;
ex.m_nextException = nextException;
}
/**
* Initializes the <i>cause</i> of this OdaException to the specified value.
* The cause is the throwable that caused this OdaException to get thrown.
* This method can be called at most once.
* @param cause the cause of this OdaException. A <code>null</code> value
* is permitted and indicates that the cause is nonexistent or
* unknown.
* @return a reference to this <code>OdaException</code>.
* @throws IllegalArgumentException if <code>cause</code> is this OdaException.
* IllegalStateException if this method has already been called on
* this <code>OdaException</code>.
*/
public Throwable initCause( Throwable cause ) throws IllegalArgumentException,
IllegalStateException
{
// provides backward compatibility to JRE earlier than 1.4
if( m_isCauseSet )
throw new IllegalStateException( "initCause() cannot be called multiple times." );
if( this == cause )
throw new IllegalArgumentException( "This cannot be caused by itself." );
m_cause = cause;
m_isCauseSet = true;
return this;
}
/**
* Returns the cause of this <code>OdaException</code>, or <code>null</code> if the
* cause is nonexistent or unknown.
* @return the cause of this <code>OdaException</code>, or <code>null</code> if the
* cause is nonexistent or unknown.
*/
public Throwable getCause()
{
// provides backward compatibility to JRE earlier than 1.4
return m_cause;
}
/* (non-Javadoc)
* @see java.lang.Throwable#toString()
*/
public String toString()
{
String message = super.toString();
Throwable cause = getCause();
if( cause != null )
{
// append cause message
String causeString = cause.toString();
if( causeString != null && causeString.length() > 0 )
message += " ;\n " + causeString; //$NON-NLS-1$
}
return message;
}
}

View File

@@ -0,0 +1,358 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
import com.ibm.icu.util.ULocale;
/**
* A class that encapsulates one or more sort keys for
* association with an IQuery.
* The class is designed to be extendable to accommodate
* additional ways of expressing a sort mode or key.
*/
public class SortSpec
{
/**
* The constant indicating ascending sort order.
*/
public static final int sortAsc = 0;
/**
* The constant indicating descending sort order.
*/
public static final int sortDesc = 1;
private int m_sortMode;
private List m_sortKeys;
/**
* Instantiates a <code>SortSpec</code> object for the defined
* <code>sortMode</code>.
* @param sortMode the sort mode of this <code>SortSpec</code>; one of
* <code>IDataSetMetaData.sortModeNone</code>,
* <code>IDataSetMetaData.sortModeSingleOrder</code>,
* <code>IDataSetMetaData.sortModeColumnOrder</code>,
* <code>IDataSetMetaData.sortModeSingleColumn</code>.
* @throws IllegalArgumentException if the <code>sortMode</code> is not a
* valid value.
*/
public SortSpec( int sortMode )
{
if( sortMode != IDataSetMetaData.sortModeNone &&
sortMode != IDataSetMetaData.sortModeSingleOrder &&
sortMode != IDataSetMetaData.sortModeColumnOrder &&
sortMode != IDataSetMetaData.sortModeSingleColumn )
throw new IllegalArgumentException(
Messages.bind( Messages.sortSpec_INVALID_SORT_MODE_SPECIFIED,
new Integer( sortMode ) ));
m_sortMode = sortMode;
m_sortKeys = new ArrayList();
}
/**
* Specifies the dynamic sort criteria in this sort mode.
* The sort criteria are specified by an ODA consumer, using
* an ordered list of one or more sort keys.
* The adding sequence of each sortKey corresponds to the major-to-minor
* ordering. Validation is done against this <code>SortSpec</code>'s sortMode;
* i.e. the method throws an exception when adding a sort key that does not
* conform to the sortMode of this <code>SortSpec</code> object.
* @param columnName name of the result set column to apply dynamic sorting
* on. The specified column should be one of the columns
* retrieved in a result set.
* @param sortOrder value that represents the sorting order; one of
* <code>sortAsc</code>, <code>sortDesc</code>.
* @throws NullPointerException if <code>columnName</code> is null.
* @throws IllegalArgumentException if <code>columnName</code> is empty; or if
* <code>sortOrder</code> is not <code>sortAsc</code>
* or <code>sortDesc</code>.
* @throws IllegalStateException if the sortMode of this <code>SortSpec</code>
* is <code>IDataSetMetaData.sortModeNone</code>;
* or if the sortMode of this <code>SortSpec</code>
* is <code>IDataSetMetaData.sortModeSingleColumn</code>,
* and a sort key is already associated; or if the
* sortMode of this <code>SortSpec</code> is
* <code>IDataSetMetaData.sortModeSingleOrder</code>
* and the sort order does not match existing sort orders.
*/
public void addSortKey( String columnName, int sortOrder )
{
if( columnName == null )
throw new NullPointerException(
Messages.sortSpec_NULL_COLUMN_NAME_SPECIFIED );
if( columnName.length() == 0 )
throw new IllegalArgumentException(
Messages.bind( Messages.sortSpec_INVALID_COLUMN_NAME_SPECIFIED,
columnName ) );
if( sortOrder != sortAsc && sortOrder != sortDesc )
throw new IllegalArgumentException(
Messages.bind( Messages.sortSpec_INVALID_SORT_ORDER_SPECIFIED,
new Integer( sortOrder ) ));
if( m_sortMode == IDataSetMetaData.sortModeNone )
throw new IllegalStateException(
Messages.sortSpec_NO_DYNAMIC_SORT_KEY_FOR_SORTMODENONE );
if( m_sortMode == IDataSetMetaData.sortModeSingleColumn &&
doGetSortKeyCount() > 0 )
throw new IllegalStateException(
Messages.sortSpec_ONE_SORTCOLUMN_FOR_SINGLE_COLUMN_MODE );
if( m_sortMode == IDataSetMetaData.sortModeSingleOrder &&
doGetSortKeyCount() > 0 )
{
// enforce that all sortOrders are the same
SortKey sortKey = (SortKey) m_sortKeys.get( 0 );
if( sortKey.getSortOrder() != sortOrder )
throw new IllegalStateException(
Messages.sortSpec_ONE_SORTORDER_FOR_SINGLE_ORDER_MODE );
}
SortKey sortKey = new SortKey( columnName, sortOrder );
m_sortKeys.add( sortKey );
}
/**
* Returns the sort mode of this <code>SortSpec</code> object.
* @return the sort mode of this <code>SortSpec</code>; one of
* <code>IDataSetMetaData.sortModeNone</code>,
* <code>IDataSetMetaData.sortModeSingleOrder</code>,
* <code>IDataSetMetaData.sortModeColumnOrder</code>,
* <code>IDataSetMetaData.sortModeSingleColumn</code>.
*/
public int getSortMode()
{
return m_sortMode;
}
/**
* Returns the number of sort keys associated with this <code>SortSpec</code>
* object.
* @return the number of sort keys associated with this
* <code>SortSpec</code> object.
*/
public int getSortKeyCount()
{
return doGetSortKeyCount();
}
private int doGetSortKeyCount()
{
return m_sortKeys.size();
}
/**
* Returns the result set column name of the sort key at the <code>index</code>
* position.
* @param index index of the sort key (1-based).
* @return the name of the result set column for the specified sort key.
* @throws IndexOutOfBoundsException if <code>index</code> is out of range
* (index < 1 || index > getSortKeyCount()).
*/
public String getSortColumn( int index )
{
validateIndex( index );
// need to map from 1-based to 0-based collection index.
SortKey sortKey = (SortKey) m_sortKeys.get( index - 1 );
return sortKey.getColumnName();
}
/**
* Returns the sort order of the sort key at the <code>index</code> position.
* @param index index of the sort key (1-based).
* @return the sort order for the specified sort key.
* @throws IndexOutOfBoundsException if <code>index</code> is out of range
* (index < 1 || index > getSortKeyCount()).
*/
public int getSortOrder( int index )
{
validateIndex( index );
// need to map from 1-based to 0-based collection index.
SortKey sortKey = (SortKey) m_sortKeys.get( index - 1 );
return sortKey.getSortOrder();
}
private void validateIndex( int index )
{
int count = doGetSortKeyCount();
if( index < 1 || index > count )
throw new IndexOutOfBoundsException( "Index: " + index + ", Count: " + count );
}
/**
* Returns an array of all column names for the sort key of a
* <code>sortModeSingleOrder</code> <code>SortSpec</code> object.
* @return an array of all column names for the sort keys of a
* <code>sortModeSingleOrder</code> <code>SortSpec</code>
* object; an empty array if no sort keys are associated
* with this <code>SortSpec</code>.
* @throws IllegalStateException if this <code>SortSpec</code>'s sort
* mode is not <code>sortModeSingleOrder</code>.
*/
public String[] getSortColumns()
{
if( m_sortMode != IDataSetMetaData.sortModeSingleOrder )
throw new IllegalStateException(
Messages.sortSpec_ONLY_IN_SINGLE_ORDER_MODE );
int size = doGetSortKeyCount();
String[] sortColumns = new String[ size ];
for( int i = 0; i < size; i++ )
{
SortKey sortKey = (SortKey) m_sortKeys.get( i );
String columnName = sortKey.getColumnName();
sortColumns[i] = columnName;
}
return sortColumns;
}
/**
* Returns the sort order for the sort keys of a <code>sortModeSingleOrder</code>
* <code>SortSpec</code> object.
* @return the sort order for the sort keys of a <code>sortModeSingleOrder</code>
* <code>SortSpec</code> object; the default value, <code>sortAsc</code>,
* if no sort keys are associated with this <code>SortSpec</code>.
* @throws IllegalStateException if this <code>SortSpec</code>'s sort
* mode is not <code>sortModeSingleOrder</code>.
*/
public int getSortOrder()
{
if( m_sortMode != IDataSetMetaData.sortModeSingleOrder )
throw new IllegalStateException(
Messages.sortSpec_ONLY_IN_SINGLE_ORDER_MODE );
// if there are no sortKeys associated with this SortSpec, then it does not
// matter what we return here. Since the caller will get an empty string array
// from getSortColumns(), it would not know which columns to apply this value for.
if( doGetSortKeyCount() == 0 )
return sortAsc;
// since all the sort orders will be the same (enforced by addSortKey()),
// we could just return the sort order of any of our sort keys.
SortKey sortKey = (SortKey) m_sortKeys.get( 0 );
return sortKey.getSortOrder();
}
/**
* Sets the locale of this <code>SortSpec</code>. Enables this <code>SortSpec</code>
* to return localized error messages. The default locale is <code>en_US</code>.
* @param locale the locale used for localizing error messages.
* @deprecated obsolete; migrated to use NLS Messages class
*/
public void setLocale( ULocale locale )
{
// m_locale = locale;
}
/**
* Returns a string representation of this <code>SortSpec</code>.
* @return a string representation of this <code>SortSpec</code>.
*/
public String toString()
{
// override default toString() for convenient debugging and logging
return "Sort Mode: " + sortModeAsString( m_sortMode ) +
", Sort Keys: " + m_sortKeys;
}
/*
* A helper function for converting a sortOrder to its string representation.
*/
private static String sortOrderAsString( int sortOrder )
{
switch( sortOrder )
{
case sortAsc:
return "Ascending";
case sortDesc:
return "Descending";
default:
// addSortKey() validation should ensure correct value
return "";
}
}
/*
* A helper function for converting a sortMode to its string representation.
*/
private static String sortModeAsString( int sortMode )
{
switch( sortMode )
{
case IDataSetMetaData.sortModeNone:
return "sortModeNone";
case IDataSetMetaData.sortModeSingleOrder:
return "sortModeSingleOrder";
case IDataSetMetaData.sortModeColumnOrder:
return "sortModeColumnOrder";
case IDataSetMetaData.sortModeSingleColumn:
return "sortModeSingleColumn";
default:
// constructor checks ensure correct values
return "";
}
}
/*
* A simple private helper class that stores the state of
* each sort key.
*/
private static final class SortKey
{
private String m_columnName;
private int m_sortOrder;
// the arguments are to be validated by SortSpec class
private SortKey( String columnName, int sortOrder )
{
m_columnName = columnName;
m_sortOrder = sortOrder;
}
private String getColumnName()
{
return m_columnName;
}
private int getSortOrder()
{
return m_sortOrder;
}
public String toString()
{
return "{" + m_columnName + ", " +
sortOrderAsString( m_sortOrder ) + "}";
}
}
}

View File

@@ -0,0 +1,81 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.eclipse.datatools.connectivity.oda.IBlob;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IBlob for use by ODA runtime drivers.
* <code>Blob</code> handles common types of raw data that represent
* a BLOB value.
*/
public class Blob implements IBlob
{
private byte[] m_byteArray = null;
private InputStream m_stream = null;
private long m_length = Long.MIN_VALUE;
private Blob()
{
}
/**
* Create a new Blob from a byte array.
* @param byteArray byte array representing the blob.
*/
public Blob( byte[] byteArray )
{
m_byteArray = byteArray;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IBlob#getBinaryStream()
*/
public InputStream getBinaryStream() throws OdaException
{
if ( m_stream == null )
m_stream = new ByteArrayInputStream( m_byteArray );
return m_stream;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IBlob#getBytes(long, int)
*/
public byte[] getBytes( long position, int length ) throws OdaException
{
// let the oda.consumer.helper provides default implementation
throw new UnsupportedOperationException();
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IBlob#length()
*/
public long length() throws OdaException
{
if ( m_length == Long.MIN_VALUE )
m_length = m_byteArray.length;
return m_length;
}
}

View File

@@ -0,0 +1,81 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import java.io.Reader;
import java.io.StringReader;
import org.eclipse.datatools.connectivity.oda.IClob;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IClob for use by ODA runtime drivers.
* <code>Clob</code> handles common types of raw data that represent
* a CLOB value.
*/
public class Clob implements IClob
{
private String m_string = null;
private Reader m_reader = null;
private long m_length = Long.MIN_VALUE;
private Clob()
{
}
/**
* Create a new Clob from a <code>String</code>.
* @param string String representing the clob.
*/
public Clob( String string )
{
m_string = string;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IClob#getCharacterStream()
*/
public Reader getCharacterStream() throws OdaException
{
if ( m_reader == null )
m_reader = new StringReader( m_string );
return m_reader;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IClob#getSubString()
*/
public String getSubString( long position, int length )
throws OdaException
{
// let the oda.consumer.helper provides default implementation
throw new UnsupportedOperationException();
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IClob#length()
*/
public long length() throws OdaException
{
if ( m_length == Long.MIN_VALUE )
m_length = m_string.length();
return m_length;
}
}

View File

@@ -0,0 +1,110 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import java.util.Properties;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IConnection
* for a simple ODA runtime driver.
*/
public class SimpleConnection implements IConnection
{
private boolean m_isOpen = false;
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#open(java.util.Properties)
*/
public void open( Properties connProperties ) throws OdaException
{
m_isOpen = true;
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#setAppContext(java.lang.Object)
*/
public void setAppContext( Object context ) throws OdaException
{
// do nothing; assumes no support for pass-through context
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#close()
*/
public void close() throws OdaException
{
m_isOpen = false;
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#isOpen()
*/
public boolean isOpen() throws OdaException
{
return m_isOpen;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#getMetaData(java.lang.String)
*/
public IDataSetMetaData getMetaData( String dataSetType ) throws OdaException
{
// ignores the dataSetType,
// assuming the simple driver supports only one type
return new SimpleDataSetMetaData( this );
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#newQuery(java.lang.String)
*/
public IQuery newQuery( String dataSetType ) throws OdaException
{
// ignores the dataSetType,
// assuming the simple driver supports only one type
return new SimpleQuery();
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#getMaxQueries()
*/
public int getMaxQueries() throws OdaException
{
return 0; // no limit
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#commit()
*/
public void commit() throws OdaException
{
// do nothing; assumes no transaction support
}
/*
* @see org.eclipse.datatools.connectivity.oda.IConnection#rollback()
*/
public void rollback() throws OdaException
{
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,147 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IDataSetMetaData
* for a simple ODA runtime driver.
*/
public class SimpleDataSetMetaData implements IDataSetMetaData
{
private IConnection m_connection;
protected SimpleDataSetMetaData( IConnection connection )
{
m_connection = connection;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getConnection()
*/
public IConnection getConnection() throws OdaException
{
return m_connection;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceObjects(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
public IResultSet getDataSourceObjects( String catalog, String schema, String object, String version ) throws OdaException
{
throw new UnsupportedOperationException();
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceMajorVersion()
*/
public int getDataSourceMajorVersion() throws OdaException
{
return 0;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceMinorVersion()
*/
public int getDataSourceMinorVersion() throws OdaException
{
return 0;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceProductName()
*/
public String getDataSourceProductName() throws OdaException
{
return "Simple Data Source"; //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceProductVersion()
*/
public String getDataSourceProductVersion() throws OdaException
{
return Integer.toString( getDataSourceMajorVersion() ) + "." + //$NON-NLS-1$
Integer.toString( getDataSourceMinorVersion() );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getSQLStateType()
*/
public int getSQLStateType() throws OdaException
{
return IDataSetMetaData.sqlStateSQL99;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsMultipleResultSets()
*/
public boolean supportsMultipleResultSets() throws OdaException
{
return false;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsMultipleOpenResults()
*/
public boolean supportsMultipleOpenResults() throws OdaException
{
return false;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsNamedResultSets()
*/
public boolean supportsNamedResultSets() throws OdaException
{
return false;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsNamedParameters()
*/
public boolean supportsNamedParameters() throws OdaException
{
return false;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsInParameters()
*/
public boolean supportsInParameters() throws OdaException
{
return false;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsOutParameters()
*/
public boolean supportsOutParameters() throws OdaException
{
return false;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getSortMode()
*/
public int getSortMode()
{
return IDataSetMetaData.sortModeNone;
}
}

View File

@@ -0,0 +1,74 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDriver;
import org.eclipse.datatools.connectivity.oda.LogConfiguration;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IDriver
* for a simple ODA runtime driver.
*/
public class SimpleDriver implements IDriver
{
/*
* @see org.eclipse.datatools.connectivity.oda.IDriver#getConnection(java.lang.String)
*/
public IConnection getConnection( String dataSourceType ) throws OdaException
{
return newConnection( dataSourceType );
}
/**
* Override to return a specific IConnection instance based on the
* type of data source.
* @param connectionType the type of the IConnection to instantiate for the data source.
* @return an IConnection instance.
* @throws OdaException if data source error occurs.
*/
protected IConnection newConnection( String dataSourceType ) throws OdaException
{
// assumes that only one type of data source is supported by the simple driver;
// ignores given argument
return new SimpleConnection();
}
/*
* @see org.eclipse.datatools.connectivity.oda.IDriver#setLogConfiguration(org.eclipse.datatools.connectivity.oda.LogConfiguration)
*/
public void setLogConfiguration( LogConfiguration logConfig ) throws OdaException
{
// do nothing; assumes simple driver has no logging
}
/*
* @see org.eclipse.datatools.connectivity.oda.IDriver#getMaxConnections()
*/
public int getMaxConnections() throws OdaException
{
return 0; // no limit
}
/*
* @see org.eclipse.datatools.connectivity.oda.IDriver#setAppContext(java.lang.Object)
*/
public void setAppContext( Object context ) throws OdaException
{
// do nothing; assumes no support for pass-through context
}
}

View File

@@ -0,0 +1,87 @@
/*
*************************************************************************
* Copyright (c) 2005, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IParameterMetaData
* for a simple ODA runtime driver.
*/
public class SimpleParameterMetaData implements IParameterMetaData
{
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#getParameterCount()
*/
public int getParameterCount() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#getParameterMode(int)
*/
public int getParameterMode( int param ) throws OdaException
{
// TODO data source dependent
return IParameterMetaData.parameterModeUnknown;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#getParameterType(int)
*/
public int getParameterType( int param ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#getParameterTypeName(int)
*/
public String getParameterTypeName( int param ) throws OdaException
{
// TODO data source dependent
return null; // unknown
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#getPrecision(int)
*/
public int getPrecision( int param ) throws OdaException
{
return -1;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#getScale(int)
*/
public int getScale( int param ) throws OdaException
{
return -1;
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IParameterMetaData#isNullable(int)
*/
public int isNullable( int param ) throws OdaException
{
return IParameterMetaData.parameterNullableUnknown;
}
}

View File

@@ -0,0 +1,261 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
/**
* Default implementation of IQuery
* for a simple ODA runtime driver.
*/
public class SimpleQuery implements IQuery
{
private int m_maxRows;
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#prepare(java.lang.String)
*/
public void prepare( String queryText ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setAppContext(java.lang.Object)
*/
public void setAppContext( Object context ) throws OdaException
{
// do nothing; assumes no support for pass-through context
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#close()
*/
public void close() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#getMetaData()
*/
public IResultSetMetaData getMetaData() throws OdaException
{
// TODO Override to return a specific IResultSetMetaData instance.
return new SimpleResultSetMetaData();
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#executeQuery()
*/
public IResultSet executeQuery() throws OdaException
{
// TODO Override to return a specific IResultSet instance.
IResultSet resultSet = new SimpleResultSet();
resultSet.setMaxRows( getMaxRows() );
return resultSet;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setProperty(java.lang.String, java.lang.String)
*/
public void setProperty( String name, String value ) throws OdaException
{
// do nothing; assumes no query property
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setMaxRows(int)
*/
public void setMaxRows( int max ) throws OdaException
{
m_maxRows = max;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#getMaxRows()
*/
public int getMaxRows() throws OdaException
{
return m_maxRows;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#clearInParameters()
*/
public void clearInParameters() throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setInt(java.lang.String, int)
*/
public void setInt( String parameterName, int value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setInt(int, int)
*/
public void setInt( int parameterId, int value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDouble(java.lang.String, double)
*/
public void setDouble( String parameterName, double value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDouble(int, double)
*/
public void setDouble( int parameterId, double value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setBigDecimal(java.lang.String, java.math.BigDecimal)
*/
public void setBigDecimal( String parameterName, BigDecimal value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setBigDecimal(int, java.math.BigDecimal)
*/
public void setBigDecimal( int parameterId, BigDecimal value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setString(java.lang.String, java.lang.String)
*/
public void setString( String parameterName, String value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setString(int, java.lang.String)
*/
public void setString( int parameterId, String value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDate(java.lang.String, java.sql.Date)
*/
public void setDate( String parameterName, Date value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDate(int, java.sql.Date)
*/
public void setDate( int parameterId, Date value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTime(java.lang.String, java.sql.Time)
*/
public void setTime( String parameterName, Time value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTime(int, java.sql.Time)
*/
public void setTime( int parameterId, Time value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTimestamp(java.lang.String, java.sql.Timestamp)
*/
public void setTimestamp( String parameterName, Timestamp value ) throws OdaException
{
// only applies to named input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTimestamp(int, java.sql.Timestamp)
*/
public void setTimestamp( int parameterId, Timestamp value ) throws OdaException
{
// only applies to input parameter
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#findInParameter(java.lang.String)
*/
public int findInParameter( String parameterName ) throws OdaException
{
// only applies to named input parameter
return 0;
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#getParameterMetaData()
*/
public IParameterMetaData getParameterMetaData() throws OdaException
{
// sub-class may override;
// @see default implementation in SimpleParameterMetaData class
return null; // has no parameters
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#setSortSpec(org.eclipse.datatools.connectivity.oda.SortSpec)
*/
public void setSortSpec( SortSpec sortBy ) throws OdaException
{
// only applies to sorting
}
/*
* @see org.eclipse.datatools.connectivity.oda.IQuery#getSortSpec()
*/
public SortSpec getSortSpec() throws OdaException
{
// only applies to sorting
return null;
}
}

View File

@@ -0,0 +1,260 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import org.eclipse.datatools.connectivity.oda.IBlob;
import org.eclipse.datatools.connectivity.oda.IClob;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IResultSet
* for a simple ODA runtime driver.
*/
public class SimpleResultSet implements IResultSet
{
private int m_maxRows;
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getMetaData()
*/
public IResultSetMetaData getMetaData() throws OdaException
{
return new SimpleResultSetMetaData();
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#setMaxRows(int)
*/
public void setMaxRows( int max ) throws OdaException
{
m_maxRows = max;
}
/**
* Returns the maximum number of rows that can be fetched from this result set.
* @return the maximum number of rows to fetch.
*/
protected int getMaxRows()
{
return m_maxRows;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#next()
*/
public boolean next() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#close()
*/
public void close() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getRow()
*/
public int getRow() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getString(int)
*/
public String getString( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getString(java.lang.String)
*/
public String getString( String columnName ) throws OdaException
{
return getString( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getInt(int)
*/
public int getInt( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getInt(java.lang.String)
*/
public int getInt( String columnName ) throws OdaException
{
return getInt( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDouble(int)
*/
public double getDouble( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDouble(java.lang.String)
*/
public double getDouble( String columnName ) throws OdaException
{
return getDouble( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBigDecimal(int)
*/
public BigDecimal getBigDecimal( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBigDecimal(java.lang.String)
*/
public BigDecimal getBigDecimal( String columnName ) throws OdaException
{
return getBigDecimal( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDate(int)
*/
public Date getDate( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDate(java.lang.String)
*/
public Date getDate( String columnName ) throws OdaException
{
return getDate( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTime(int)
*/
public Time getTime( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTime(java.lang.String)
*/
public Time getTime( String columnName ) throws OdaException
{
return getTime( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTimestamp(int)
*/
public Timestamp getTimestamp( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTimestamp(java.lang.String)
*/
public Timestamp getTimestamp( String columnName ) throws OdaException
{
return getTimestamp( findColumn( columnName ) );
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#wasNull()
*/
public boolean wasNull() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSet#findColumn(java.lang.String)
*/
public int findColumn( String columnName ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBlob(int)
*/
public IBlob getBlob( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBlob(java.lang.String)
*/
public IBlob getBlob( String columnName ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getClob(int)
*/
public IClob getClob( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getClob(java.lang.String)
*/
public IClob getClob( String columnName ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
}

View File

@@ -0,0 +1,101 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.impl;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* Default implementation of IResultSetMetaData
* for a simple ODA runtime driver.
*/
public class SimpleResultSetMetaData implements IResultSetMetaData
{
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnCount()
*/
public int getColumnCount() throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnName(int)
*/
public String getColumnName( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnLabel(int)
*/
public String getColumnLabel( int index ) throws OdaException
{
return getColumnName( index ); // default
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnType(int)
*/
public int getColumnType( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnTypeName(int)
*/
public String getColumnTypeName( int index ) throws OdaException
{
// TODO data source dependent
throw new UnsupportedOperationException( "Please override and implement me." ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnDisplayLength(int)
*/
public int getColumnDisplayLength( int index ) throws OdaException
{
return 0;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getPrecision(int)
*/
public int getPrecision( int index ) throws OdaException
{
return -1;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getScale(int)
*/
public int getScale( int index ) throws OdaException
{
return -1;
}
/**
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#isNullable(int)
*/
public int isNullable( int index ) throws OdaException
{
return IResultSetMetaData.columnNullableUnknown;
}
}

View File

@@ -0,0 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="white">
[<b>Non-API</b>] Provides a template implementation of the main ODA run-time interfaces.
These classes assume the behavior of a simple ODA driver,
and have labelled TODO tasks for a driver developer to
implement data source dependent behavior.
These concrete classes are provided for use as templates or
base classes to aid in the development of an ODA custom driver.
Their use is purely optional.
<!-- Put @see and @since tags down here. -->
@since 2.0
</body>
</html>

View File

@@ -0,0 +1,70 @@
/*
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.nls;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS
{
private static final String BUNDLE_NAME = "org.eclipse.datatools.connectivity.oda.nls.messages"; //$NON-NLS-1$
private Messages()
{
}
static
{
// initialize resource bundle
NLS.initializeMessages( BUNDLE_NAME, Messages.class );
}
public static String logManager_duplicateName;
public static String manifest_nullArgument;
public static String manifest_NO_DRIVER_RUNTIME_CONFIGURATION_DEFINED;
public static String manifest_NO_DATA_SOURCE_EXTN_ID_DEFINED;
public static String manifest_INVALID_VERSION_VALUE;
public static String manifest_NO_DRIVER_CLASS_DEFINED;
public static String manifest_INVALID_SET_THREAD_CONTEXT_CLASSLOADER_VALUE;
public static String manifest_NO_DATA_SET_TYPES_DEFINED;
public static String manifest_NO_ATTRIBUTE_ID_DEFINED;
public static String manifest_NO_DATA_TYPE_MAPPINGS_DEFINED;
public static String manifest_NO_NATIVE_TYPE_CODE_DEFINED;
public static String manifest_INVALID_NATIVE_TYPE_CODE_VALUE;
public static String manifest_NO_NATIVE_TYPE_NAME_DEFINED;
public static String manifest_NO_ODA_SCALAR_DATA_TYPE_DEFINED_1;
public static String manifest_NO_ODA_SCALAR_DATA_TYPE_DEFINED_2;
public static String manifest_INVALID_ODA_SCALAR_DATA_TYPE_VALUE;
public static String manifest_INVALID_LOG_LEVEL_VALUE;
public static String manifest_NO_LOG_FILENAME_PREFIX_DEFINED;
public static String sortSpec_INVALID_SORT_MODE_SPECIFIED;
public static String sortSpec_NULL_COLUMN_NAME_SPECIFIED;
public static String sortSpec_INVALID_COLUMN_NAME_SPECIFIED;
public static String sortSpec_INVALID_SORT_ORDER_SPECIFIED;
public static String sortSpec_NO_DYNAMIC_SORT_KEY_FOR_SORTMODENONE;
public static String sortSpec_ONE_SORTCOLUMN_FOR_SINGLE_COLUMN_MODE;
public static String sortSpec_ONE_SORTORDER_FOR_SINGLE_ORDER_MODE;
public static String sortSpec_ONLY_IN_SINGLE_ORDER_MODE;
public static String stringSubUtil_NO_STRING_VALUE_TO_REPLACE;
public static String stringSubUtil_DELIMITER_CANNOT_BE_EMPTY;
public static String stringSubUtil_DELIMITER_CANNOT_BE_NULL;
public static String stringSubUtil_SUBSTITUTION_LIST_CANNOT_BE_NULL;
public static String stringSubUtil_SUBSTITUTION_VALUE_CANNOT_BE_NULL;
public static String stringSubUtil_TEXT_STRING_CANNOT_BE_NULL;
public static String stringSubUtil_NAME_VALUE_MAP_CANNOT_BE_NULL;
}

View File

@@ -0,0 +1,49 @@
#
#************************************************************************
# Copyright (c) 2004, 2006 Actuate Corporation.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Actuate Corporation - initial API and implementation
#
#************************************************************************
#
logManager_duplicateName=Logger with same name exists.
#
manifest_nullArgument=Argument must not be null.
manifest_NO_DRIVER_RUNTIME_CONFIGURATION_DEFINED=The ODA driver plugin.xml is missing a <dataSource> element.
manifest_NO_DATA_SOURCE_EXTN_ID_DEFINED=The ODA driver plugin.xml data source extension is missing an id attribute.
manifest_INVALID_VERSION_VALUE=The ODA driver plugin.xml has an invalid odaVersion value ({0}) in the data source extension ({1}).
manifest_NO_DRIVER_CLASS_DEFINED=The ODA driver plugin.xml is missing a driverClass attribute in the data source extension ({0}).
manifest_INVALID_SET_THREAD_CONTEXT_CLASSLOADER_VALUE=The ODA driver plugin.xml has an invalid setThreadContextClassLoader value ({0}) in the data source extension ({1}).
manifest_NO_DATA_SET_TYPES_DEFINED=The ODA data source extension ({0}) has no <dataSet> element defined in the extension manifest. This is valid configuration, but does limit the ODA extension capabilities.
manifest_NO_ATTRIBUTE_ID_DEFINED=The ODA driver plugin extension is missing an attribute ({0}) in the ({1}) element.
manifest_NO_DATA_TYPE_MAPPINGS_DEFINED=The ODA driver plugin.xml should have at least one <dataTypeMapping> element defined for the <dataSet> ({0}).
manifest_NO_NATIVE_TYPE_CODE_DEFINED=The ODA driver plugin.xml is missing a nativeDataTypeCode attribute in the <dataTypeMapping> ({0}) of the <dataSet> ({1}).
manifest_INVALID_NATIVE_TYPE_CODE_VALUE=The ODA driver plugin.xml has an invalid nativeDataTypeCode value ({0}) in the <dataTypeMapping> ({1}) of the <dataSet> ({2}).
manifest_NO_NATIVE_TYPE_NAME_DEFINED=The ODA driver plugin.xml is missing a nativeDataType attribute in the <dataTypeMapping> of the <dataSet> ({0}).
manifest_NO_ODA_SCALAR_DATA_TYPE_DEFINED_1=The ODA driver plugin.xml is missing an odaScalarDataType attribute in the <dataTypeMapping> ({0}).
manifest_NO_ODA_SCALAR_DATA_TYPE_DEFINED_2=The ODA driver plugin.xml is missing an odaScalarDataType attribute in the <alternativeOdaDataType> of the <dataTypeMapping> ({0}).
manifest_INVALID_ODA_SCALAR_DATA_TYPE_VALUE=The ODA driver plugin.xml has an invalid odaScalarDataType value ({0}) in the <dataTypeMapping> ({1}).
manifest_INVALID_LOG_LEVEL_VALUE=The ODA driver plugin.xml has an invalid logLevel value ({0}) in the data source extension ({1}).
manifest_NO_LOG_FILENAME_PREFIX_DEFINED=The ODA driver plugin.xml is missing a logFileNamePrefix attribute in the <traceLogging> of the data source extension ({0}).
#
sortSpec_INVALID_SORT_MODE_SPECIFIED=Invalid sort mode specified: {0}.
sortSpec_NULL_COLUMN_NAME_SPECIFIED=Null column name specified.
sortSpec_INVALID_COLUMN_NAME_SPECIFIED=Invalid column name specified: {0}.
sortSpec_INVALID_SORT_ORDER_SPECIFIED=Invalid sort order specified: {0}.
sortSpec_NO_DYNAMIC_SORT_KEY_FOR_SORTMODENONE=This sortSpec with sortModeNone does not allow any dynamic sort key.
sortSpec_ONE_SORTCOLUMN_FOR_SINGLE_COLUMN_MODE=A sort column already exists. The sortModeSingleColumn mode allows a maximum of one dynamic sort column.
sortSpec_ONE_SORTORDER_FOR_SINGLE_ORDER_MODE=The sortModeSingleOrder mode supports only one sort order.
sortSpec_ONLY_IN_SINGLE_ORDER_MODE=Supported only in sortModeSingleOrder mode.
#
stringSubUtil_NO_STRING_VALUE_TO_REPLACE=No string value to replace: {0}.
stringSubUtil_DELIMITER_CANNOT_BE_EMPTY=The delimiter cannot be an empty string or contain only white spaces.
stringSubUtil_DELIMITER_CANNOT_BE_NULL=The delimiter cannot be null.
stringSubUtil_SUBSTITUTION_LIST_CANNOT_BE_NULL=The string substitution list cannot be null.
stringSubUtil_SUBSTITUTION_VALUE_CANNOT_BE_NULL=The string substitution value cannot be null.
stringSubUtil_TEXT_STRING_CANNOT_BE_NULL=The text string cannot be null.
stringSubUtil_NAME_VALUE_MAP_CANNOT_BE_NULL=The name-value map cannot be null.

View File

@@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="white">
[<b>Provisional</b>] Defines the runtime API of the Open Data Access (ODA) extensions.
ODA provides the capability to plug any external data source into
a data consumer application that supports the ODA framework.
<p>
The ODA extension framework defines a set of ODA design-time and
run-time interfaces.
It adopts the Eclipse plug-in framework for one to provide a designer tool,
and a runtime driver for data retrieval.
This public API package specifies the Java interfaces of an
ODA extension's runtime driver.
<br>
An ODA consumer application, such as the BIRT Data Engine, uses the
data source connection and data set query definitions specified at design time to
access an ODA runtime driver for query execution and data retrieval.
<p>
The ODA runtime interfaces are JDBC-like, but have been extended to
support additional capabilities of non-RDBMS data sources.
An ODA driver would implement the public runtime interfaces,
which would in turn wrap data-source-specific APIs, such as web services,
to retrieve a result set's data rows.
<p>
Below is a brief overview of the API's main interfaces.
<br>The IDriver serves as the entry point to an ODA
runtime driver.
The driver produces a dedicated IConnection for establishing
a connection to the data source provider.
<br>An open connection in turn creates an IQuery to define
the specifics of a data set query.
A connection also provides meta-data information on the
capabilities of the data source, and its
supported data set types in IDataSetMetaData.
<br>A query is executed to retrieve one or
more IResultSet instances.
<br>A result set is then used to fetch result data.
It also provides an IResultSetMetaData for its
meta-data information.
<!-- Put @see and @since tags down here. -->
@since 1.0
</body>
</html>

View File

@@ -0,0 +1,2 @@
OdaResources_*_*.java
vssver.*

View File

@@ -0,0 +1,55 @@
/*
*************************************************************************
* Copyright (c) 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.datatools.connectivity.oda.util.manifest.ManifestExplorer;
import org.osgi.framework.BundleContext;
/**
* Bundle activator class.
*/
public class OdaPlugin extends Plugin
{
private static OdaPlugin sm_plugin;
public OdaPlugin()
{
super();
sm_plugin = this;
}
/**
* Returns the shared instance of this plugin activator.
* @return
*/
public static OdaPlugin getDefault()
{
return sm_plugin;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop( BundleContext context ) throws Exception
{
// release plugin's singleton instance(s)
ManifestExplorer.releaseInstance();
super.stop( context );
sm_plugin = null;
}
}

View File

@@ -0,0 +1,808 @@
//----------------------------------------------------------------------
// StringSubstitutionUtil.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// StringSubstitutionUtil provides a utility class for performing
// string substitutions.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
/**
* StringSubstitutionUtil is a general utility that any ODA provider can use,
* which performs string substitutions. The utility is designed for ODA
* data sources that has a concept of embedded delimited strings in text strings.
* For example, an ODA driver query text could contain embedded parameters in the
* form of a colon followed by a parameter name, like ":myVariable". Two forms of
* string substitutions are supported by the utility: subsitution by index
* or by name.
*/
public final class StringSubstitutionUtil
{
private StringSubstitutionUtil()
{
// class is not meant to be instantiated
}
//---------------------------------------------------------------
// For logging purposes
//---------------------------------------------------------------
private static String sm_loggerName = StringSubstitutionUtil.class.getName();;
private static Logger sm_logger = Logger.getLogger( sm_loggerName );
/**
* Sets the <code>StringSubstitutionUtil</code> logger to log its
* utility methods.
* @param logger the logger that <code>StringSubstitutionUti</code>
* uses to log its methods.
*/
public static void setLogger( Logger logger )
{
sm_logger = logger;
}
/**
* Resets the <code>StringSubstitutionUtil</code> logger. The caller
* of <code>setLogger</code> should call this to remove its logger from
* the <code>StringSubstituionUtil</code>. Otherwise, subsequent calls
* to this utility's methods by other callers may be logged in the
* set logger.
*/
public static void resetLogger()
{
sm_logger = null;
}
private static void log( String message )
{
if( sm_logger != null )
sm_logger.log( Level.FINEST, message );
}
private static void log( Throwable thrown )
{
if( sm_logger != null )
sm_logger.log( Level.WARNING, thrown.getLocalizedMessage(),
thrown );
}
/**
* Returns the number of named and un-named delimited strings in the text argument, where
* the delimited strings are labeled by only a start delimiter. Calls
* <code>getDelimitedStringCount( text, startDelimiter, false )</code>.
* @param text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @return the number of named and un-named delimited strings.
* @see StringSubstitutionUtil#getDelimitedStringCount(String, String, boolean)
* getDelimitedStringCount
*/
public static int getDelimitedStringCount( String text,
String startDelimiter )
{
return getDelimitedStringCount( text, startDelimiter,
false /* requiresNamedDelimiters */ );
}
/**
* Returns the number of delimited strings in the text argument, where the delimited
* strings are labeled by only a start delimiter. If <code>requiresNamedDelimiters</code>
* is set to true, only the named delimiters will be counted. This should be used when
* the caller wants to perform substitution by name on the text string. Otherwise, both named
* and un-named delimiters will be counted. This should be used when the caller wants
* to perform substitution by index on the text string.
* <br>
* <br>
* <b>For example:</b><br>
* text = ":param1 :param2 :param3"<br>
* startDelimiter = ":"<br>
* returns: 3
* @param text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param requiresNamedDelimiters
* determines whether only named delimiters will be counted.
* @return the number of delimited strings.
* @throws NullPointerException if text or startDelimiter is <code>null</code>.
*/
public static int getDelimitedStringCount( String text,
String startDelimiter,
boolean requiresNamedDelimiters )
{
String context = "StringSubstitutionUtil.getDelimitedStringCount( " + //$NON-NLS-1$
text + ", " + startDelimiter + ", " + //$NON-NLS-1$ //$NON-NLS-2$
requiresNamedDelimiters + " )\t"; //$NON-NLS-1$
log( context + "Called." ); //$NON-NLS-1$
sanityCheck( text, startDelimiter );
// we'll remove all beginning and trailing whitespaces
startDelimiter = sanityCheckDelimiter( startDelimiter );
int startDelimiterLength = startDelimiter.length();
StringBuffer stringBuffer = new StringBuffer( text );
int index = 0;
int numOfDelimitedStrings = 0;
while( ( index = text.indexOf( startDelimiter, index ) ) >= 0 )
{
log( context + "index: " + index ); //$NON-NLS-1$
int endIndex = getDelimitedStringEndIndex( stringBuffer, index,
startDelimiterLength,
requiresNamedDelimiters );
if( endIndex == -1 )
{
index += startDelimiterLength;
continue;
}
numOfDelimitedStrings++;
index = endIndex + 1;
}
log( context + "Exiting: " + numOfDelimitedStrings ); //$NON-NLS-1$
return numOfDelimitedStrings;
}
/**
* Returns the number of named and un-named delimited strings in the text
* argument, where the delimited strings are labeled by a start delimiter
* and an end delimiter. Calls
* <code>getDelimitedStringCount( text, startDelimiter, endDelimiter, false )</code>.
* @param text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param endDelimiter the end delimiter string.
* @return the number of named and un-named delimited strings.
* @see StringSubstitutionUtil#getDelimitedStringCount(String, String, String, boolean)
* getDelimitedStringCount
*/
public static int getDelimitedStringCount( String text,
String startDelimiter,
String endDelimiter )
{
return getDelimitedStringCount( text, startDelimiter, endDelimiter,
false /* requiresNamedDelimiters */ );
}
/**
* Returns the number of delimited strings in the text argument, where the delimited
* strings are labeled by a start delimiter and an end delimiter. If <code>requiresNamedDelimiters</code>
* is set to true, only the named delimiters will be counted. This should be used when
* the caller wants to perform substitution by name on the text string. Otherwise, both named
* and un-named delimiters will be counted. This should be used when the caller wants
* to perform substitution by index on the text string.
* <br>
* <br>
* <b>For example:</b><br>
* text = "select &lt;start&gt;param1&lt;end&gt;.* from STUDENT"<br>
* startDelimiter = "&lt;start&gt;"<br>
* endDelimiter = "&lt;end&gt;"<br>
* returns: 1
* @param text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param endDelimiter the end delimiter string.
* @param requiresNamedDelimiters
* determines whether only named delimiters will be counted.
* @return the number of delimited strings.
* @throws NullPointerException if text, startDelimiter, or endDelimiter
* is <code>null</code>.
*/
public static int getDelimitedStringCount( String text,
String startDelimiter,
String endDelimiter,
boolean requiresNamedDelimiters )
{
String context = "StringSubstitutionUtil.getDelimitedStringCount( " + //$NON-NLS-1$
text + ", " + startDelimiter + ", " + endDelimiter + //$NON-NLS-1$ //$NON-NLS-2$
", " + requiresNamedDelimiters +" )\t"; //$NON-NLS-1$ //$NON-NLS-2$
log( context + "Called." ); //$NON-NLS-1$
sanityCheck( text, startDelimiter, endDelimiter );
// we'll remove all beginning and trailing whitespaces
startDelimiter = sanityCheckDelimiter( startDelimiter );
endDelimiter = sanityCheckDelimiter( endDelimiter );
int startDelimiterLength = startDelimiter.length();
int endDelimiterLength = endDelimiter.length();
StringBuffer stringBuffer = new StringBuffer( text );
int startIndex = 0;
int currIndex = 0;
int numOfDelimitedStrings = 0;
while( ( startIndex = text.indexOf( startDelimiter, currIndex ) ) >= 0 )
{
log( context + "startIndex: " + startIndex + ", currIndex: " + currIndex ); //$NON-NLS-1$ //$NON-NLS-2$
currIndex = startIndex + startDelimiterLength;
// check whether it's really a start delimiter
if( ! isStartDelimiter( startIndex, stringBuffer ) )
continue;
int endIndex = getDelimitedStringEndIndex( stringBuffer, startIndex,
startDelimiterLength,
endDelimiter,
requiresNamedDelimiters );
if( endIndex < 0 )
break;
numOfDelimitedStrings++;
endIndex += endDelimiterLength;
currIndex = endIndex;
}
log( context + "Exiting: " + numOfDelimitedStrings ); //$NON-NLS-1$
return numOfDelimitedStrings;
}
/**
* Performs string substitution based on index, where the delimited strings
* are labeled by only a start delimiter.
* <br>
* <br>
* <b>For example:</b><br>
* text = "SELECT STUDENT.:COLUMN, STUDENT.:COLUMN FROM STUDENT"<br>
* startDelimiter = ":"<br>
* substitutionList = ["ID", "NAME"]<br>
* returns: "SELECT STUDENT.ID, STUDENT.NAME FROM STUDENT"
* @param text text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param substitutionList list of substitution values for the delimited strings.
* @return the fully substituted string.
* @throws NullPointerException if text, startDelimiter, or substitutionList
* is <code>null</code>.
*/
public static String substituteByIndex( String text,
String startDelimiter,
List substitutionList )
{
String context = "StringSubstitutionUtil.substituteByIndex( " + //$NON-NLS-1$
text + ", " + startDelimiter + ", " + //$NON-NLS-1$ //$NON-NLS-2$
substitutionList + " )\t"; //$NON-NLS-1$
log( context + "Called." ); //$NON-NLS-1$
sanityCheck( text, startDelimiter, substitutionList );
// we'll remove all beginning and trailing whitespaces
startDelimiter = sanityCheckDelimiter( startDelimiter );
int startDelimiterLength = startDelimiter.length();
// string buffer is more efficient for manipulating strings
StringBuffer stringBuffer = new StringBuffer( text );
int index = 0;
ListIterator substitutionListIter = substitutionList.listIterator();
// find the index of the delimiter
while( ( index = stringBuffer.toString().indexOf( startDelimiter, index ) ) >= 0 )
{
log( context + "index: " + index ); //$NON-NLS-1$
int endIndex = getDelimitedStringEndIndex( stringBuffer, index,
startDelimiterLength,
false /* requiresNamedDelimiters */ );
if( endIndex == -1 )
{
index += startDelimiterLength;
continue;
}
if( ! substitutionListIter.hasNext() )
{
String message = Messages.bind( Messages.stringSubUtil_NO_STRING_VALUE_TO_REPLACE,
stringBuffer.substring( index + startDelimiterLength,
endIndex ) );
throw newIllegalArgumentException( message );
}
String replacementString = ( String ) substitutionListIter.next();
if( replacementString == null )
{
throw newIllegalArgumentException( Messages.stringSubUtil_SUBSTITUTION_VALUE_CANNOT_BE_NULL );
}
stringBuffer.replace( index, endIndex, replacementString );
index += ( replacementString.length() );
}
String ret = stringBuffer.toString();
log( context + "Exiting: " + ret ); //$NON-NLS-1$
return ret;
}
/**
* Performs string substitution based on index, where the delimited strings
* are labeled by a start delimiter and an end delimiter.
* <br>
* <br>
* <b>For example:</b><br>
* text = "SELECT &lt;start&gt;TABLE&lt;end&gt;.&lt;start&gt;COLUMN&lt;end&gt; FROM STUDENT"<br>
* startDelimiter = "&lt;start&gt;"<br>
* endDelimiter = "&lt;end&gt;"<br>
* substitutionList = ["STUDENT", "NAME"]<br>
* returns: "SELECT STUDENT.NAME FROM STUDENT"
* @param text text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param endDelimiter the end delimiter string.
* @param substitutionList list of substitution values for the delimited strings.
* @return the fully substituted string.
* @throws NullPointerException if text, startDelimiter, endDelimiter, or
* substitutionList is <code>null</code>.
*/
public static String substituteByIndex( String text,
String startDelimiter,
String endDelimiter,
List substitutionList )
{
String context = "StringSubstitutionUtil.substituteByIndex( " + //$NON-NLS-1$
text + ", " + startDelimiter + ", " + endDelimiter + //$NON-NLS-1$ //$NON-NLS-2$
", " + substitutionList + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
log( context + "Called." ); //$NON-NLS-1$
sanityCheck( text, startDelimiter, endDelimiter,
substitutionList );
// we'll remove all beginning and trailing whitespaces
startDelimiter = sanityCheckDelimiter( startDelimiter );
endDelimiter = sanityCheckDelimiter( endDelimiter );
int startDelimiterLength = startDelimiter.length();
int endDelimiterLength = endDelimiter.length();
// string buffer is more efficient for manipulating strings
StringBuffer stringBuffer = new StringBuffer( text );
ListIterator substitutionListIter = substitutionList.listIterator();
int startIndex = 0;
int currIndex = 0;
while( ( startIndex = stringBuffer.toString().indexOf( startDelimiter, currIndex ) ) >= 0 )
{
log( context + "startIndex: " + startIndex + ", currIndex: " + currIndex ); //$NON-NLS-1$ //$NON-NLS-2$
currIndex = startIndex + startDelimiterLength;
// check whether it's really a start delimiter
if( ! isStartDelimiter( startIndex, stringBuffer ) )
continue;
int endIndex = getDelimitedStringEndIndex( stringBuffer, startIndex,
startDelimiterLength,
endDelimiter,
false /* requiresNamedDelimiters */ );
if( endIndex < 0 )
break;
if( ! substitutionListIter.hasNext() )
{
String message = Messages.bind( Messages.stringSubUtil_NO_STRING_VALUE_TO_REPLACE,
stringBuffer.substring( startIndex + startDelimiterLength,
endIndex ) );
throw newIllegalArgumentException( message );
}
String replacementString = ( String ) substitutionListIter.next();
if( replacementString == null )
throw newIllegalArgumentException( Messages.stringSubUtil_SUBSTITUTION_VALUE_CANNOT_BE_NULL );
endIndex += endDelimiterLength;
stringBuffer.replace( startIndex, endIndex, replacementString );
currIndex = startIndex + replacementString.length();
}
String ret = stringBuffer.toString();
log( context + "Exiting: " + ret ); //$NON-NLS-1$
return ret;
}
/**
* Performs string substitution based on name, where the delimited strings
* are labeled by only a start delimiter.
* <br>
* <br>
* <b>For example:</b><br>
* text = "SELECT ?PARAM.?PARAM1 FROM ?PARAM"<br>
* startDelimiter = "?"<br>
* nameValues = {PARAM=PEOPLE, PARAM1=NAME}<br>
* returns: "SELECT PEOPLE.NAME FROM PEOPLE"<br>
* @param text text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param nameValues map of substitution name-value pairs.
* @return the fully substituted string.
* @throws NullPointerException if text, startDelimiter, or nameValues is
* <code>null</code>.
*/
public static String substituteByName( String text,
String startDelimiter,
Map nameValues )
{
String context = "StringSubstitutionUtil.substituteByName( " + //$NON-NLS-1$
text + ", " + startDelimiter + ", " + nameValues + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
log( context + "Called." ); //$NON-NLS-1$
sanityCheck( text, startDelimiter, nameValues );
// we'll remove all beginning and trailing whitespaces
startDelimiter = sanityCheckDelimiter( startDelimiter );
int startDelimiterLength = startDelimiter.length();
// string buffer is more efficient for manipulating strings
StringBuffer stringBuffer = new StringBuffer( text );
int index = 0;
// find the index of the delimiter
while( ( index = stringBuffer.toString().indexOf( startDelimiter, index ) ) >= 0 )
{
log( context + "index: " + index ); //$NON-NLS-1$
int endIndex = getDelimitedStringEndIndex( stringBuffer, index,
startDelimiterLength,
true /* requiresNamedDelimiters */ );
if( endIndex == -1 )
{
index += startDelimiterLength;
continue;
}
// found the start and end of the delimited string
String delimitedString = stringBuffer.substring( index + startDelimiterLength,
endIndex );
String replacementString = ( String ) nameValues.get( delimitedString );
if( replacementString == null )
{
String message = Messages.stringSubUtil_SUBSTITUTION_VALUE_CANNOT_BE_NULL;
message += " [" + delimitedString + "]"; //$NON-NLS-1$ //$NON-NLS-2$
throw newIllegalArgumentException( message );
}
stringBuffer.replace( index, endIndex, replacementString );
index += ( replacementString.length() );
}
String ret = stringBuffer.toString();
log( context + "Exiting: " + ret ); //$NON-NLS-1$
return ret;
}
/**
* Performs string substitution based on name, where the delimited strings
* are labeled by a start delimiter and an end delimiter.
* <br>
* <br>
* <b>For example:</b><br>
* text = "SELECT :PARAM:.:PARAM1: FROM :PARAM:<br>
* startDelimiter = ":"<br>
* endDelimiter = ":"<br>
* nameValues = {PARAM=PEOPLE, PARAM1=NAME}<br>
* returns: "SELECT PEOPLE.NAME FROM PEOPLE"<br>
* @param text text string containing delimited strings.
* @param startDelimiter the start delimiter string.
* @param endDelimiter the end delimiter string.
* @param nameValues map of substitution name-value pairs.
* @return the fully substituted string.
* @throws NullPointerException if text, startDelimiter, endDelimiter, or
* nameValues is <code>null</code>.
*/
public static String substituteByName( String text,
String startDelimiter,
String endDelimiter,
Map nameValues )
{
String context = "StringSubstitutionUtil.substituteByName( " + //$NON-NLS-1$
text + ", " + startDelimiter + ", " + endDelimiter + //$NON-NLS-1$ //$NON-NLS-2$
", " + nameValues + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
log( context + "Called." ); //$NON-NLS-1$
sanityCheck( text, startDelimiter,
endDelimiter, nameValues );
// we'll remove all beginning and trailing whitespaces
startDelimiter = sanityCheckDelimiter( startDelimiter );
endDelimiter = sanityCheckDelimiter( endDelimiter );
int startDelimiterLength = startDelimiter.length();
int endDelimiterLength = endDelimiter.length();
// string buffer is more efficient for manipulating strings
StringBuffer stringBuffer = new StringBuffer( text );
int startIndex = 0;
int currIndex = 0;
while( ( startIndex = stringBuffer.toString().indexOf( startDelimiter, currIndex ) ) >= 0 )
{
log( context + "startIndex: " + startIndex + ", currIndex: " + currIndex ); //$NON-NLS-1$ //$NON-NLS-2$
currIndex = startIndex + startDelimiterLength;
// check whether it's really a start delimiter
if( ! isStartDelimiter( startIndex, stringBuffer ) )
continue;
int endIndex = getDelimitedStringEndIndex( stringBuffer, startIndex,
startDelimiterLength,
endDelimiter,
true /* requiresNamedDelimiters */ );
if( endIndex < 0 )
break;
String delimitedString = stringBuffer.substring( startIndex + startDelimiterLength,
endIndex );
String replacementString = ( String ) nameValues.get( delimitedString );
if( replacementString == null )
{
String message = Messages.stringSubUtil_SUBSTITUTION_VALUE_CANNOT_BE_NULL;
message += " [" + delimitedString + "]"; //$NON-NLS-1$ //$NON-NLS-2$
throw newIllegalArgumentException( message );
}
endIndex += endDelimiterLength;
stringBuffer.replace( startIndex, endIndex, replacementString );
currIndex = startIndex + replacementString.length();
}
String ret = stringBuffer.toString();
log( context + "Exiting: " + ret ); //$NON-NLS-1$
return ret;
}
//-------------------------------------------------------------------------
// helper methods for sanity checks
private static void sanityCheck( String text,
String startDelimiter,
String endDelimiter,
Object listOrMap )
{
sanityCheck( text, startDelimiter, endDelimiter );
sanityCheck( listOrMap );
}
private static void sanityCheck( String text,
String startDelimiter,
Object listOrMap )
{
sanityCheck( text, startDelimiter );
sanityCheck( listOrMap );
}
private static void sanityCheck( String text,
String startDelimiter,
String endDelimiter )
{
sanityCheck( text, startDelimiter );
if( endDelimiter == null )
throw newNullPointerException( Messages.stringSubUtil_DELIMITER_CANNOT_BE_NULL );
}
private static void sanityCheck( String text,
String startDelimiter )
{
if( text == null )
throw newNullPointerException( Messages.stringSubUtil_TEXT_STRING_CANNOT_BE_NULL );
if( startDelimiter == null )
throw newNullPointerException( Messages.stringSubUtil_DELIMITER_CANNOT_BE_NULL );
}
private static void sanityCheck( Object listOrMap )
{
if( listOrMap == null )
{
String message = listOrMap instanceof List ?
Messages.stringSubUtil_SUBSTITUTION_LIST_CANNOT_BE_NULL :
Messages.stringSubUtil_NAME_VALUE_MAP_CANNOT_BE_NULL;
throw newNullPointerException( message );
}
}
private static String sanityCheckDelimiter( String delimiter )
{
String trimmed = delimiter.trim();
int length = trimmed.length();
if( length == 0 )
throw newIllegalArgumentException( Messages.stringSubUtil_DELIMITER_CANNOT_BE_EMPTY );
return trimmed;
}
// returns -1 if we see that the delimiter isn't part of a delimited string,
// otherwise it will return the end index of the delimited string
private static int getDelimitedStringEndIndex( StringBuffer stringBuffer,
int index,
int startDelimiterLength,
boolean requiresNamedDelimiters )
{
String context = "StringSubstitutionUtil.getDelimitedStringEndIndex( " + //$NON-NLS-1$
stringBuffer + ", " + index + ", " + //$NON-NLS-1$ //$NON-NLS-2$
startDelimiterLength + " )\t"; //$NON-NLS-1$
log( context + "Called." ); //$NON-NLS-1$
// check whether it's really a start delimiter
if( ! isStartDelimiter( index, stringBuffer ) )
{
log( context + "Not a start delimiter. Exiting: -1" ); //$NON-NLS-1$
return -1;
}
int endIndex = index + startDelimiterLength;
while( endIndex < stringBuffer.length() &&
isStringMarkerCharacter( stringBuffer.charAt( endIndex ) ) )
endIndex++;
// if the endIndex is still the same as the index after the start delimiter,
// then it may be an empty marker. We only support empty markers for substitution
// by index. We also need to check the character to see whether it's the
// end of the string or a white space character.
// if that's the case, then it would be considered an embedded marker.
// i.e.: select * from aaa where id = ? and aaaId < ?
// where the ? is the delimiter
if( endIndex == index + startDelimiterLength &&
( requiresNamedDelimiters ||
( endIndex < stringBuffer.length() &&
! Character.isWhitespace( stringBuffer.charAt( endIndex ) ) ) ) )
{
log( context + "Not an embedded marker. Exiting: -1" ); //$NON-NLS-1$
return -1;
}
log( context + "Exiting: " + endIndex ); //$NON-NLS-1$
return endIndex;
}
private static int getDelimitedStringEndIndex( StringBuffer stringBuffer,
int startIndex,
int startDelimiterLength,
String endDelimiter,
boolean requiresNamedDelimiters )
{
String context = "StringSubstitutional.getDelimitedStringEndIndex( " + //$NON-NLS-1$
stringBuffer + ", " + startIndex + ", " + //$NON-NLS-1$ //$NON-NLS-2$
startDelimiterLength + ", " + endDelimiter + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
log( context + "Called." ); //$NON-NLS-1$
int currIndex = startIndex + startDelimiterLength;
int endDelimiterLength = endDelimiter.length();
int endIndex = -1;
String string = stringBuffer.toString();
while( ( endIndex = string.indexOf( endDelimiter, currIndex ) ) >= 0 )
{
log( context + "endIndex: " + endIndex + ", currIndex: " + currIndex ); //$NON-NLS-1$ //$NON-NLS-2$
// check whether it's really an end delimiter
if( isEndDelimiter( startIndex + startDelimiterLength, endIndex,
endDelimiterLength, string, requiresNamedDelimiters ) )
break;
// look for another end delimiter
currIndex = endIndex + endDelimiterLength;
}
log( context + "Exiting: " + endIndex ); //$NON-NLS-1$
return endIndex;
}
private static boolean isStringMarkerCharacter( char c )
{
return Character.isLetterOrDigit( c ) ||
isContinuatorCharacter( c );
}
private static boolean isContinuatorCharacter( char c )
{
return ( c == '_' );
}
private static boolean isEscapeCharacter( char c )
{
return ( c == '\\' );
}
private static boolean isStartDelimiter( int startDelimiterIndex,
StringBuffer stringBuffer )
{
String context = "StringSubstitutionUtil.isStartDelimiter( " + //$NON-NLS-1$
startDelimiterIndex + ", " + stringBuffer + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
log( context + "Called." ); //$NON-NLS-1$
// it's a start delimiter if it's at the beginning of the string
if( startDelimiterIndex == 0 )
{
log( context + "Beginning of string. Exiting: " + true ); //$NON-NLS-1$
return true;
}
// check that the character before the start delimiter isn't
// an alpha numeric character or underscore or the escape character
char prevChar = stringBuffer.charAt( startDelimiterIndex - 1 );
boolean ret = ( ! isStringMarkerCharacter( prevChar ) &&
! isEscapeCharacter( prevChar ) );
log( context + "Exiting: " + ret ); //$NON-NLS-1$
return ret;
}
private static boolean isEndDelimiter( int afterStartDelimiterIndex, int endIndex,
int endDelimiterLength, String string,
boolean requiresNamedDelimiters )
{
String context = "StringSubsitutionUtil.isEndDelimiter( " + //$NON-NLS-1$
afterStartDelimiterIndex + ", " + endIndex + ", " + //$NON-NLS-1$ //$NON-NLS-2$
endDelimiterLength + ", " + string + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
log( context + "Called." ); //$NON-NLS-1$
// if the end delimiter occurs right after the start delimiter and
// we require named delimiters, then it's not an end delimiter.
if( endIndex == afterStartDelimiterIndex &&
requiresNamedDelimiters )
{
log( context + "Requires a named delimiter. Exiting: " + false ); //$NON-NLS-1$
return false;
}
// check whether the character right before the end delimiter is the
// escape character, which would mean it's not really an end delimiter
// unless it's part of the start delimiter
if( endIndex - 1 >= afterStartDelimiterIndex &&
isEscapeCharacter( string.charAt( endIndex - 1 ) ) )
{
log( context + "End delimiter escaped. Exiting: " + false ); //$NON-NLS-1$
return false;
}
// it also wouldn't be an end delimiter if the end delimiter were
// immediately followed by an alpha numeric character
boolean ret = !( endIndex + endDelimiterLength < string.length() &&
isStringMarkerCharacter( string.charAt( endIndex + endDelimiterLength ) ) );
log( context + "Exiting: " + ret ); //$NON-NLS-1$
return ret;
}
private static IllegalArgumentException newIllegalArgumentException( String msg )
{
IllegalArgumentException ex =
new IllegalArgumentException( msg );
log( ex );
return ex;
}
private static NullPointerException newNullPointerException( String msg )
{
NullPointerException ex =
new NullPointerException( msg );
log( ex );
return ex;
}
}

View File

@@ -0,0 +1,164 @@
//----------------------------------------------------------------------
// FileHandler.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// FileHandler is a specialized handler that publishes LogRecords
// to disk.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
import java.io.File;
import java.io.FileOutputStream;
/**
* The <code>FileHandler</code> is a file logging <code>Handler</code>
* that publishes <code>LogRecords</code> to a specified file.
*/
public class FileHandler extends StreamHandler
{
private String m_filename;
private File m_file;
// Constructors
private FileHandler()
{
// no default constructor
}
/**
* Creates a <code>FileHandler</code> to publish <code>LogRecords</code>
* to the specified file. This will use the default <code>SimpleFormatter</code>
* to format the <code>LogRecords</code>. This does not create the physical
* file or the parent directories until publish() is called.
* @param filename the file to publish <code>LogRecords</code> to.
*/
public FileHandler( String filename )
{
m_filename = filename;
}
/**
* Creates a <code>FileHandler</code> to publish <code>LogRecords</code>
* to the sepcified file using the specified <code>LogFormatter</code>.
* This does not create the physical file or the parent directories until
* publish() is called.
* @param filename the file to publish <code>LogRecords</code> to.
* @param formatter the <code>LogFormatter</code> to format the
* <code>LogRecords</code>.
*/
public FileHandler( String filename, LogFormatter formatter )
{
m_filename = filename;
setFormatter( formatter );
}
/**
* Creates the log file and its applicable parent directories when called
* for the first time.
* @param record the record to publish.
*/
public void publish( LogRecord record )
{
if( m_file == null )
setOutputFile( m_filename );
super.publish( record );
}
/**
* Closes the current file handler.
*/
public void close()
{
super.close();
m_file = null;
m_filename = null;
}
/**
* Generates a file with an unique filename based on the specified preferred name.
* This is for the case when two consumer instances run concurrently and
* each tries to create a file with the same name.
* @param preferredFileName
* @return
*/
private File getUniqueFile( String preferredFileName )
{
try
{
File file = new File( preferredFileName );
createParentDirectory( file );
// must use createNewFile() for atomicity!
// if this file is already locked by someone else, we'll append a
// numeric value to our filename, we'll repeat this 10 times only to
// prevent infinite loops.
int looping = 0;
int index = preferredFileName.lastIndexOf( "." ); //$NON-NLS-1$
String prefix = preferredFileName.substring( 0, index );
String suffix = preferredFileName.substring( index, preferredFileName.length() );
while( ! file.createNewFile() && looping < 10 )
{
file = new File( prefix + "-" + looping + suffix ); //$NON-NLS-1$
looping++;
}
return file;
}
catch( java.io.FileNotFoundException ex )
{
return null;
}
catch( java.io.IOException ex )
{
return null;
}
}
// this may not be the actual unique name of the File handle.
String getPreferredFilename()
{
return m_filename;
}
// create any parent directory if necessary
private void createParentDirectory( File file )
{
File parentDirectory = file.getParentFile();
// parent directory could be null if the file is at the top most
// directory.
// if there's a parent directory but it doesn't exist, then we'll
// need to create it.
if( parentDirectory != null && ! parentDirectory.exists() )
parentDirectory.mkdirs();
}
void setOutputFile( String filename )
{
try
{
m_file = getUniqueFile( filename );
if( m_file != null )
setOutputStream( new FileOutputStream( m_file ) );
else
reportError( "", null, LoggingErrorHandler.OPEN_FAILURE ); //$NON-NLS-1$
}
catch( java.io.FileNotFoundException ex )
{
reportError( "", ex, LoggingErrorHandler.OPEN_FAILURE ); //$NON-NLS-1$
}
}
}

View File

@@ -0,0 +1,39 @@
//----------------------------------------------------------------------
// Filter.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// Filter is an interface class from which all filter classes
// should implement. Filters will filter LogRecords from its
// parent handler based on the rules that are implemented in
// isLoggable().
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
/**
* A Filter can provide more control on what is logged.
* <br>
* <br>
* Each Handler can have an associated Filter and calls the
* <code>isLoggable</code> method to check whether the
* <code>LogRecord</code> should be published.
*/
public interface Filter
{
/**
* Checks if the the <code>LogRecord</code> should be published.
* @param record the log record.
* @return <code>true</code> if the log record should
* be published; <code>false</code> otherwise.
*/
public boolean isLoggable( LogRecord record );
}

View File

@@ -0,0 +1,165 @@
//----------------------------------------------------------------------
// Handler.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// Handler is the base class from which all Handlers derive from.
// Handlers processes the LogRecord using its Formatter and
// then publishes it.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
/**
* <code>Handler</code> is an abstract class that takes <code>LogRecords</code>
* from a <code>Logger</code> and outputs them. All log handler should inherit
* from this class and may publish log records to its supported sources. (i.e.
* console, file, etc. )
*/
public abstract class Handler
{
// member variables
private LoggingErrorHandler m_errorHandler;
private Filter m_filter;
private LogFormatter m_formatter;
private Level m_level;
/**
* Creates a <code>Handler</code> instance.
*/
protected Handler()
{
}
/**
* Close the <code>Handler</code> and free up resources.
*/
public abstract void close();
/**
* Flushes buffered output.
*/
public abstract void flush();
/**
* Publish the specified <code>LogRecord</code>. The record should
* only be published if it has the adequate log level, passes the
* associated <code>Filter</code>. This is responsible for formatting
* the <code>LogRecord</code>, if necessary.
* @param record the log record to publish.
*/
public abstract void publish( LogRecord record );
/**
* Checks whether the specified <code>LogRecord</code> should be logged.
* This checks whether the <code>LogRecord</code> has the adequate log level,
* passes the associated <code>Filter</code>, or other <code>Handler</code>
* specific checks.
* @param record the log record.
* @return true if the log record should be logged.
*/
public boolean isLoggable( LogRecord record )
{
// loggable if the record's log level is higher and if the handler's
// level isn't set to OFF, and if there's no associated filter or the
// filter allows the record to be logged.
return( ( record.getLevel().intValue() >= m_level.intValue() ) &&
m_level.intValue() <= Level.SEVERE &&
( m_filter == null || m_filter.isLoggable( record ) ) );
}
/**
* Reports an error to the assocated <code>LoggingErrorHandler</code>.
* @param message the error message.
* @param exception the exception that caused the error.
* @param errorCode the error code.
*/
protected void reportError( String message, Exception exception,
int errorCode )
{
if( m_errorHandler != null )
m_errorHandler.error( message, exception, errorCode );
}
/**
* Sets the <code>LoggingErrorHandler</code> for this <code>Handler</code>.
* @param errorHandler the error handler to set.
*/
public void setLoggingErrorHandler( LoggingErrorHandler errorHandler )
{
m_errorHandler = errorHandler;
}
/**
* Gets the <code>LoggingErrorHandler</code> associated with this <code>Handler</code>.
* @return the associated error handler.
*/
public LoggingErrorHandler getLoggingErrorHandler()
{
return m_errorHandler;
}
/**
* Sets the <code>Filter</code> for this <code>Handler</code>.
* @param filter the filter to set.
*/
public void setFilter( Filter filter )
{
m_filter = filter;
}
/**
* Gets the <code>Filter</code> associated with this <code>Handler</code>.
* @return the associated filter.
*/
public Filter getFilter()
{
return m_filter;
}
/**
* Sets the <code>LogFormatter</code> for this <code>Handler</code>.
* @param formatter the formatter to set.
*/
public void setFormatter( LogFormatter formatter )
{
if( formatter == null )
throw new NullPointerException();
m_formatter = formatter;
}
/**
* Gets the <code>LogFormatter</code> associated with this <code>Handler</code>.
* @return the associated formatter.
*/
public LogFormatter getFormatter()
{
return m_formatter;
}
/**
* Sets the <code>Level</code> for this <code>Handler</code>.
* @param level the level to set.
*/
public void setLevel( Level level )
{
m_level = level;
}
/**
* Gets the <code>Level</code> associated with this <code>Handler</code>.
* @return the associated level.
*/
public Level getLevel()
{
return m_level;
}
}

View File

@@ -0,0 +1,184 @@
//----------------------------------------------------------------------
// Level.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// Level is a class that represents logging levels within this
// logging framework.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
/**
* <code>Level</code> represents logging levels within the logging framework.
* It defines a standard set of logging levels to control logging.
*/
public final class Level
{
private static final int AC_LOG_LEVEL_MAX = Integer.MAX_VALUE;
private static final int AC_LOG_LEVEL_MIN = Integer.MIN_VALUE;
/**
* The constant indicating the integer value of OFF.
*/
public static final int OFF = AC_LOG_LEVEL_MAX;
/**
* The constant indicating the integer value of SEVERE.
*/
public static final int SEVERE = 1000;
/**
* The constant indicating the integer value of WARNING.
*/
public static final int WARNING = 900;
/**
* The constant indicating the integer value of INFO.
*/
public static final int INFO = 800;
/**
* The constant indicating the integer value of CONFIG.
*/
public static final int CONFIG = 700;
/**
* The constant indicating the integer value of FINE.
*/
public static final int FINE = 500;
/**
* The constant indicating the integer value of FINER.
*/
public static final int FINER = 400;
/**
* The constant indicating the integer value of FINEST.
*/
public static final int FINEST = 300;
/**
* The constant indicating the integer value of ALL.
*/
public static final int ALL = AC_LOG_LEVEL_MIN;
/**
* The constant indicating the log level OFF. OFF should be used to turn
* off logging.
*/
public static final Level OFF_LEVEL = new Level( "OFF", OFF ); //$NON-NLS-1$
/**
* The constant indicating the log level SEVERE. SEVERE should be used to
* indicate a serious failure.
*/
public static final Level SEVERE_LEVEL = new Level( "SEVERE", SEVERE ); //$NON-NLS-1$
/**
* The constant indicating the log level WARNING. WARNING should be used to
* indicate potential problems.
*/
public static final Level WARNING_LEVEL = new Level( "WARNING", WARNING ); //$NON-NLS-1$
/**
* The constant indicating the log level INFO. INFO should be used for
* informational messages.
*/
public static final Level INFO_LEVEL = new Level( "INFO", INFO ); //$NON-NLS-1$
/**
* The constant indicating the log level CONFIG. CONFIG should be used for
* configuration messages.
*/
public static final Level CONFIG_LEVEL = new Level( "CONFIG", CONFIG ); //$NON-NLS-1$
/**
* The constant indicating the log level FINE. FINE should be used for
* relatively detailed trace logging.
*/
public static final Level FINE_LEVEL = new Level( "FINE", FINE ); //$NON-NLS-1$
/**
* The constant indicating the log level FINER. FINER should be used for
* detailed trace logging.
*/
public static final Level FINER_LEVEL = new Level( "FINER", FINER ); //$NON-NLS-1$
/**
* The constant indicating the log level FINEST. FINEST should be used for
* very detailed trace logging.
*/
public static final Level FINEST_LEVEL = new Level( "FINEST", FINEST ); //$NON-NLS-1$
/**
* The constant indicating the log level ALL. ALL should be used to log
* everything.
*/
public static final Level ALL_LEVEL = new Level( "ALL", ALL ); //$NON-NLS-1$
// member variables
private String m_name;
private int m_level;
/**
* Creates a <code>Level</code> instance with the specified name and
* integer log level value.
* @param name the log level name.
* @param value the integer log level value.
*/
protected Level( String name, int value )
{
m_name = name;
m_level = value;
}
/**
* Checks whether the two objects have the same log level value.
* @param obj the object to compare against.
* @return true, if both objects have the same log level value.
*/
public boolean equals( Object obj )
{
if( ! ( obj instanceof Level ) )
return false;
Level level = ( Level ) obj;
return ( level.intValue() == m_level );
}
/**
* Generate a hashcode based on the log level value.
* @return the hashcode based on the log level value.
*/
public int hashCode()
{
// override hashCode() along with equals()
return m_level;
}
/**
* Gets the log level name.
* @return the log level name.
*/
public String getName()
{
return m_name;
}
/**
* Gets the log level value.
* @return the log level value.
*/
public int intValue()
{
return m_level;
}
}

View File

@@ -0,0 +1,40 @@
//----------------------------------------------------------------------
// LogFormatter.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// LogFormatter is an abstract class from which all formatter classes
// should implement. Formatters format the LogRecords based on
// rules that are implemented in format().
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
/**
* <code>LogFormatter</code> is an abstract class from which all
* formatter classes should implement. It converts <code>LogRecords</code>
* into formatted strings based on <code>format()</code> rules.
*/
public abstract class LogFormatter
{
/**
* Creates a <code>LogFormatter</code> instance.
*/
protected LogFormatter()
{
}
/**
* Format the specified <code>LogRecord</code> into a string.
* @param record the log record to format.
* @return the formatted string.
*/
public abstract String format( LogRecord record );
}

View File

@@ -0,0 +1,403 @@
//----------------------------------------------------------------------
// LogManager.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// LogManager is a static class that maintains a set of named Loggers.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Hashtable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
import org.eclipse.datatools.connectivity.oda.util.OdaPlugin;
import com.ibm.icu.text.SimpleDateFormat;
/**
* LogManager is a static class that maintains a set of named
* <code>Loggers</code>. It provides the interface to create
* named <code>Loggers</code> and to retrieve the loggers for
* logging purposes.
*/
public class LogManager
{
private static final String LOG_SUBFOLDER_NAME = "logs"; //$NON-NLS-1$
private static Hashtable m_loggers = new Hashtable();
private static SimpleDateFormat sm_dateFormat;
private LogManager()
{
// not meant to be instantiated.
}
/**
* Creates a named <code>Logger</code> with the necessary
* log configuration information. The specified logger name
* should be specific to the application using the logging
* framework to prevent name collision in the logger namespace,
* since multiple loggers cannot be created with the same
* logger name.
* @param loggerName the name of the logger to be created.
* @param logLevel the logger log level.
* @param logDirectory the required directory to store the logs.
* @param logPrefix the required file name prefix of the log
* file name; the format will be
* &lt;logPrefix&gt;-YYMMDD-hhmmss.log.
* @param formatterClassName a <code>LogFormatter</code> class
* name; if this is null or empty, the
* default <code>LogFormatter</code> will be
* used. The customized log formatter must inherit
* from <code>org.eclipse.datatools.connectivity.oda.logging.LogFormatter</code>
* and implements the <code>format()</code>
* method.
* @return the constructed named <code>Logger</code>.
* @throws IllegalArgumentException if logger with the same name
* already exists.
*/
public static Logger createLogger( String loggerName,
int logLevel,
String logDirectory,
String logPrefix,
String formatterClassName )
{
if( m_loggers.containsKey( loggerName ) )
throw new IllegalArgumentException( Messages.logManager_duplicateName );
validateInput( logLevel, logDirectory, logPrefix );
Logger logger = new Logger( loggerName );
// set up the logger
setLoggerLevel( logger, logLevel );
// if the caller wants the logger off, then don't bother setting the
// rest of the settings since they'll be empty strings
if( isLogLevelOff( logger.getLevel().intValue() ) )
return logger;
resetLoggerFileConfig( logger, logDirectory, logPrefix, formatterClassName );
m_loggers.put( loggerName, logger );
return logger;
}
private static void validateInput( int logLevel, String logDirectory, String logPrefix )
{
// no validation for log directory and log prefix if the caller just wants
// the logger off.
if( isLogLevelOff( logLevel ) )
return;
if( logDirectory == null || logPrefix == null )
throw new NullPointerException();
if( logDirectory.length() == 0 || logPrefix.length() == 0 )
throw new IllegalArgumentException();
}
/**
* Creates a named <code>Logger</code> with the specified log configuration
* information, if the named <code>Logger</code> doesn't already exist. If the
* named <code>Logger</code> already exists, then it will be updated the specified log
* configuration. If the specified log level or the formatter class is different,
* then the new values will be set while maintaining the same log file. If either
* the log directory or the log prefix has changed, then a new log file will be
* created.
* @param loggerName the name of the logger to be created or updated.
* @param logLevel the logger log level.
* @param logDirectory the required directory to store the logs.
* @param logPrefix the required file name prefix of the log
* file name; the format will be
* &lt;logPrefix&gt;-YYMMDD-hhmmss.log.
* @param formatterClassName a <code>LogFormatter</code> class
* name; if this is null or empty, the
* default <code>LogFormatter</code> will be
* used. The customized log formatter must inherit
* from <code>org.eclipse.datatools.connectivity.oda.logging.LogFormatter</code>
* and implements the <code>format()</code>
* method.
* @return the constructed or updated named <code>Logger</code>.
*/
public static Logger getLogger( String loggerName,
int logLevel,
String logDirectory,
String logPrefix,
String formatterClassName )
{
validateInput( logLevel, logDirectory, logPrefix );
Logger logger = getLogger( loggerName );
// if it didn't already exist, create it
if( logger == null )
return createLogger( loggerName, logLevel, logDirectory,
logPrefix, formatterClassName );
// the named logger already exists, update it.
// update with new log level
setLoggerLevel( logger, logLevel );
// if the caller wants the logger off, then don't bother setting the
// rest of the settings since they'll be empty strings
if( isLogLevelOff( logger.getLevel().intValue() ) )
{
logger.setHandler( null );
return logger;
}
// if the previous handler wasn't a file handler, then we need
// to replace the existing handler with a new file handler
Handler handler = logger.getHandler();
if( ! ( handler instanceof FileHandler ) )
{
resetLoggerFileConfig( logger, logDirectory, logPrefix, formatterClassName );
return logger;
}
// check whether the file configuration has changed.
FileHandler fileHandler = (FileHandler) handler;
if( hasLoggerFileConfigChanged( logger, fileHandler,
logDirectory, logPrefix ) )
{
resetLoggerFileConfig( logger, logDirectory, logPrefix, formatterClassName );
return logger;
}
// check if the formatter has changed
LogFormatter origFormatter = fileHandler.getFormatter();
String origFormatterClassName = origFormatter.getClass().getName();
if( origFormatterClassName.equals( formatterClassName ) )
return logger;
// formatter class was changed, try to change to the new formatter
try
{
LogFormatter formatter = getLogFormatterInstance( formatterClassName );
fileHandler.setFormatter( formatter );
}
catch( Exception ex )
{
// couldn't instantiate the new formatter class through reflection,
// so we're stuck using the old one, log the exception
logger.severe( ex );
}
return logger;
}
private static boolean hasLoggerFileConfigChanged( Logger logger,
FileHandler fileHandler,
String newLogDirectory,
String newLogPrefix )
{
String fullFilename = fileHandler.getPreferredFilename();
File origFile = new File( fullFilename );
File origDir = null;
File newDir = null;
try
{
origDir = origFile.getParentFile().getCanonicalFile();
newDir = ( new File( newLogDirectory ) ).getCanonicalFile();
}
catch( IOException ex )
{
// shouldn't be in here, but just in case that we can't resolve the
// canonical path for the original file's parent directory, then we
// need to create a new FileHandler based on the new log directory. Otherwise,
// the new directory couldn't be resolved, then we keep our old FileHandler.
logger.severe( ex );
return( origDir == null );
}
// check if the log directories are the same
if( ! origDir.equals( newDir ) )
return true;
// this gets just the file name without the directory part:
// <prefix>-YYYYMMDD-hhmmss.log
String origFilename = origFile.getName();
// check if the file name ends with the ".log" suffix and has the
// same prefix
if( ! origFilename.startsWith( newLogPrefix ) ||
! origFilename.endsWith( ".log" ) ) //$NON-NLS-1$
return true;
// validate whether the portion between the prefix and the log file
// suffix was our proper time stamp format
// (prefix length + 1) (length of string - 4)
// V V
// <prefix>-YYYYMMDD-hhmmss.log
String origTimetamp = origFilename.substring( newLogPrefix.length() + 1,
origFilename.length() - 4 );
// the length needs to be the same length as our time stamp format
if( origTimetamp.length() != 15 )
return true;
try
{
if( getDateFormat().parse( origTimetamp ) == null )
return true;
}
catch( ParseException ex )
{
// if there's parse exception, then the timestamp portion wasn't
// a time stamp, so it must have been something else which means that
// the file name has changed.
return true;
}
// the file config hasn't changed.
return false;
}
private static void setLoggerLevel( Logger logger, int logLevel )
{
// set to the specified level
Level level = new Level( "", logLevel ); //$NON-NLS-1$
logger.setLevel( level );
}
private static void resetLoggerFileConfig( Logger logger, String logDirectory,
String logPrefix, String formatterClassName )
{
// set the file handler with the file name and formatter
String logfileName = generateAbsoluteFileName( logDirectory, logPrefix );
// cache exceptions that could occur when users use a customized
// formatter, so that they can take a look at the log to see if something
// went wrong
Exception formatterException = null;
FileHandler handler = null;
try
{
LogFormatter formatter = getLogFormatterInstance( formatterClassName );
handler = ( formatter == null ) ? new FileHandler( logfileName ) :
new FileHandler( logfileName, formatter );
}
catch( Exception ex )
{
formatterException = ex;
// if a formatter class name wasn't specified or it can't be found using reflection,
// then we default back to the SimpleFormatter
handler = new FileHandler( logfileName );
}
logger.setHandler( handler );
// log the exception that we saw when looking for the formatter class
if( formatterException != null )
logger.severe( formatterException );
}
/**
* Gets a previously created <code>Logger</code> by name. The
* specified name must be the same name used in the
* <code>createLogger()</code> method.
* @param loggerName the logger's name.
* @return the <code>Logger</code> associated with the name;
* <code>null</code> if no <code>Logger</code> is
* associated with the specified name.
*/
public static Logger getLogger( String loggerName )
{
return (Logger) m_loggers.get( loggerName );
}
private static SimpleDateFormat getDateFormat()
{
if( sm_dateFormat == null )
sm_dateFormat = new SimpleDateFormat( "yyyyMMdd-HHmmss" ); //$NON-NLS-1$
return sm_dateFormat;
}
/**
* Logic to generate the absolute file name:
* <logDirectory>/<logPrefix>-YYYYMMDD-HHmmss.log
* If the specified <logDirectory> is not an absolute path,
* set it relative to the oda plugin's default log folder.
*/
private static String generateAbsoluteFileName( String logDirectory,
String logFilePrefix )
{
File logDir = getAbsoluteParent( logDirectory );
// format the filename with given prefix, followed by timestamp and .log suffix
String logfileName = logFilePrefix + "-"; //$NON-NLS-1$
Timestamp timestamp = new Timestamp( System.currentTimeMillis() );
logfileName += getDateFormat().format( timestamp ) + ".log"; //$NON-NLS-1$
return new File( logDir, logfileName ).getPath();
}
private static File getAbsoluteParent( String logDirectory )
{
assert( logDirectory != null && logDirectory.length() > 0 );
File logParent = new File( logDirectory );
if( logParent.isAbsolute() )
return logParent; // use as is
// the specified logDirectory is relative,
// set its parent to be the oda plugin's default log folder
logParent = getPluginLogPath().append( logDirectory ).toFile();
return logParent;
}
/**
* Returns the plugin's default log parent file
* in the workspace state location.
* @return
* @throws IllegalStateException when the plugin activator
* is not instantiated yet
*/
private static IPath getPluginLogPath() throws IllegalStateException
{
// try to use oda plugin's default state location's log folder as its parent
OdaPlugin odaPlugin = OdaPlugin.getDefault();
if( odaPlugin == null )
throw new IllegalStateException( "OdaPlugin.getDefault()" ); //$NON-NLS-1$
return odaPlugin.getStateLocation()
.append( LOG_SUBFOLDER_NAME );
}
// use reflection to generate the specified log formatter class instance
private static LogFormatter getLogFormatterInstance( String formatterClassName ) throws Exception
{
if( formatterClassName == null || formatterClassName.length() == 0 )
return null;
Class formatterClass = Class.forName( formatterClassName );
return (LogFormatter) formatterClass.newInstance();
}
// checks if the given log level is set to OFF
private static boolean isLogLevelOff( int logLevel )
{
return ( logLevel > Level.SEVERE );
}
}

View File

@@ -0,0 +1,119 @@
//----------------------------------------------------------------------
// LogRecord.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// LogRecord is a class that represents all log records that are
// passed internally within the logging framework.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
import java.io.Serializable;
/**
* <code>LogRecord</code> contains information that can be logged
* by a <code>Handler</code>.
*/
public class LogRecord implements Serializable
{
// member variables
private Level m_level;
private String m_message;
private long m_millis;
private Throwable m_thrown;
/**
* Creates a <code>LogRecord</code> instance with the specified
* log level and message. The <code>LogRecord</code> will automatically
* be set with the current time.
* @param level the log level.
* @param message the log message.
*/
public LogRecord( Level level, String message )
{
m_level = level;
m_message = message;
m_millis = System.currentTimeMillis();
}
/**
* Gets the logging level.
* @return the logging level.
*/
public Level getLevel()
{
return m_level;
}
/**
* Sets the logging level to the specified value.
* @param level the new logging level.
*/
public void setLevel( Level level )
{
m_level = level;
}
/**
* Sets the <code>LogRecord</code> message to the specified value.
* @param message the new log message.
*/
public void setMessage( String message )
{
m_message = message;
}
/**
* Gets the log message.
* @return the log message.
*/
public String getMessage()
{
return m_message;
}
/**
* Sets the <code>LogRecord</code> time to the specified value.
* @param millis the new time.
*/
public void setMillis( long millis )
{
m_millis = millis;
}
/**
* Gets the log time.
* @return the log time.
*/
public long getMillis()
{
return m_millis;
}
/**
* Sets an associated <code>Throwable</code> to the <code>LogRecord</code>.
* @param thrown the <code>Throwable</code>.
*/
public void setThrown( Throwable thrown )
{
m_thrown = thrown;
}
/**
* Gets the associated <code>Throwable</code>.
* @return the <code>Throwable</code>.
*/
public Throwable getThrown()
{
return m_thrown;
}
}

View File

@@ -0,0 +1,242 @@
//----------------------------------------------------------------------
// Logger.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
// Logger is class that contains the interface to allow java
// code to log messages through this logging framework.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
/**
* <code>Logger</code> allows callers to log messages for their application.
* Loggers should be created using the <code>LogManager.createLogger</code>
* method, which creates named loggers with specific logging settings.
* Loggers should be named appropriately based on the application using the
* logging framework to prevent logger name collision. For example, if
* logging were done on javax.sql package, then an appropriate logger name
* would be "javax.sql".
*/
public class Logger
{
// Member Variables
private String m_loggerName;
private Level m_level;
private Handler m_handler;
// private constructor to deal with handling the deprecated
// use of the "global" logger
private Logger()
{
m_loggerName = "global"; //$NON-NLS-1$
// default to logging level OFF.
m_level = Level.OFF_LEVEL;
}
/**
* Creates a <code>Logger</code> instance with the specified name.
* The name should be appropriately named based on the application
* that is doing the logging.
* @param loggerName the name of the logger.
*/
protected Logger( String loggerName )
{
m_loggerName = loggerName;
// default to logging level OFF.
m_level = Level.OFF_LEVEL;
}
/**
* Log a SEVERE error or exception.
* @param thrown the throwable being thrown.
*/
public void severe( Throwable thrown )
{
log( Level.SEVERE_LEVEL, thrown );
}
/**
* Log a SEVERE log message.
* @param message the log message.
*/
public void severe( String message )
{
log( Level.SEVERE_LEVEL, message );
}
/**
* Log a WARNING log message.
* @param message the log message.
*/
public void warning( String message )
{
log( Level.WARNING_LEVEL, message );
}
/**
* Log a INFO log message.
* @param message the log message.
*/
public void info( String message )
{
log( Level.INFO_LEVEL, message );
}
/**
* Log a CONFIG log message.
* @param message the log message.
*/
public void config( String message )
{
log( Level.CONFIG_LEVEL, message );
}
/**
* Log a FINE log message.
* @param message the log message.
*/
public void fine( String message )
{
log( Level.FINE_LEVEL, message );
}
/**
* Log a FINER log message.
* @param message the log message.
*/
public void finer( String message )
{
log( Level.FINER_LEVEL, message );
}
/**
* Log a FINEST log message.
* @param message the log message.
*/
public void finest( String message )
{
log( Level.FINEST_LEVEL, message );
}
/**
* Log a message at the specified level.
* @param level the log level to log the message.
* @param message the log message.
*/
public void log( Level level, String message )
{
if( isLoggable( level ) && m_handler != null )
{
LogRecord record = new LogRecord( level, message );
m_handler.publish( record );
}
}
/**
* Log a throwable at the specified level.
* @param level the log level to log the throwable.
* @param thrown the throwable to log.
*/
public void log( Level level, Throwable thrown )
{
if( isLoggable( level ) && m_handler != null )
{
LogRecord record = new LogRecord( level, "" ); //$NON-NLS-1$
record.setThrown( thrown );
m_handler.publish( record );
}
}
/**
* Get the associated log level.
* @return the associated log level.
*/
public Level getLevel()
{
return m_level;
}
/**
* Sets the level to associate with this <code>Logger</code>.
* @param level the log level to associate.
*/
public void setLevel( Level level )
{
m_level = level;
if( m_handler != null )
m_handler.setLevel( m_level );
}
/**
* Gets the name of this <code>Logger</code>.
* @return the name of the <cdoe>Logger</code>.
*/
public String getName()
{
return m_loggerName;
}
/**
* Gets the associated <code>Handler</code>.
* @return the associated <code>Handler</code>.
*/
protected Handler getHandler()
{
return m_handler;
}
/**
* Sets the specified <code>Handler</code> to associate with this
* <code>Logger</code>.
* @param handler the <code>Handler</code> to associate.
*/
protected void setHandler( Handler handler )
{
// if there's an existing handler and it isn't the same one
// that's being set, then we should close the existing one
// before assigning the new one.
if( m_handler != null && m_handler != handler )
m_handler.close();
m_handler = handler;
if( m_handler != null )
m_handler.setLevel( m_level );
}
/**
* Checks whether the specified level is loggable by this
* <code>Logger</code>. Also checks whether the <code>Logger</code>
* level is set to OFF.
* @param level the log level.
* @return true if the specified level is higher or equal
* to the <code>Logger</code>'s level and if the
* <code>Logger</code>'s level isn't OFF.
*/
public boolean isLoggable( Level level )
{
return ( level.intValue() >= m_level.intValue() &&
m_level.intValue() <= Level.SEVERE );
}
void changeLogFile( String filename )
{
if( m_handler != null )
{
m_handler.close();
( ( FileHandler ) m_handler ).setOutputFile( filename );
}
else //in the case where the previous file creation failed.
m_handler = new FileHandler( filename );
}
}

View File

@@ -0,0 +1,91 @@
//----------------------------------------------------------------------
// LoggingErrorHandler.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// LoggingErrorHandler simply catches all exceptions generated within
// the logging framework. The caller will not have to be concerned
// with dealing with exceptions during logging.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
/**
* <code>LoggingErrorHandler</code> can be associated with
* <code>Handlers</code> to process any exceptions that occur
* during logging. This will alleviate the log caller from
* having to handle logging errors.
*/
public class LoggingErrorHandler
{
/**
* The constant indicating a <code>close</code> of an
* <code>OutputStream</code> fails.
*/
public static int CLOSE_FAILURE = 0;
/**
* The constant indicating a <code>flush</code> of an
* <code>OutputStream</code> fails.
*/
public static int FLUSH_FAILURE = 1;
/**
* The constant indicating that formatting failed.
*/
public static int FORMAT_FAILURE = 2;
/**
* The constant indicating a failure not in the other
* categories.
*/
public static int GENERIC_FAILURE = 3;
/**
* The constant indicating a <code>open</code> of an
* <code>OutputStream</code> fails.
*/
public static int OPEN_FAILURE = 4;
/**
* The constant indicating a <code>write</code> of an
* <code>OutputStream</code> fails.
*/
public static int WRITE_FAILURE = 5;
/**
* Creates a <code>LoggingErrorHandler</code> instance.
*/
public LoggingErrorHandler()
{
}
/**
* This method is called when a <code>Handler</code> failure occurs.
* It outputs the failure to <code>System.err</code>.
* @param message the error message.
* @param exception the <code>Exception</code> that caused the
* <code>Handler</code> to fail.
* @param errorCode the error code constant.
*/
public void error( String message, Exception exception,
int errorCode )
{
// print out to System.err similar to JDK
String err = "org.eclipse.datatools.connectivity.oda.util.logging (" + errorCode + ")"; //$NON-NLS-1$ //$NON-NLS-2$
if( message != null && message.length() > 0 )
err += ": " + message; //$NON-NLS-1$
System.err.println( err );
if( exception != null )
exception.printStackTrace();
}
}

View File

@@ -0,0 +1,73 @@
//----------------------------------------------------------------------
// SimpleFormatter.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// SimpleFormatter is an implementation of LogFormatter that generates
// a string output based on the LogRecord in the form of:
//
// Log Level Time Log Message
// <Exception stack trace> ...
// ...
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Timestamp;
/**
* Formats a <code>LogRecord</code> into an understandable format.
*/
public class SimpleFormatter extends LogFormatter
{
/**
* Creates an <code>SimpleFormatter</code> instance.
*/
public SimpleFormatter()
{
}
/**
* Formats the specified <code>LogRecord</code> to an understandable
* format.
* @param record the <code>LogRecord</code> to format.
* @return the formatted string.
*/
public String format( LogRecord record )
{
// resulting string:
// Log Level Time Log Message
// <Exception stack trace> ...
// ...
Timestamp stamp = new Timestamp( record.getMillis() );
StringBuffer buffer = new StringBuffer();
buffer.append( record.getLevel().intValue() );
buffer.append( "\t" ); //$NON-NLS-1$
buffer.append( stamp.toString() );
buffer.append( "\t\t" ); //$NON-NLS-1$
buffer.append( record.getMessage() );
buffer.append( "\n" ); //$NON-NLS-1$
Throwable thrown = record.getThrown();
if( thrown != null )
{
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter( stringWriter );
thrown.printStackTrace( printWriter );
buffer.append( stringWriter.toString() );
printWriter.close();
// StringWriter.close() does nothing
}
return buffer.toString();
}
}

View File

@@ -0,0 +1,166 @@
//----------------------------------------------------------------------
// StreamHandler.java
//
// Copyright (c) 2004, 2005 Actuate Corporation.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// Actuate Corporation - initial API and implementation
//
// StreamHandler is a handler that uses OutputStream's to publish
// the LogRecords, these could include disk, network, console, etc.
//----------------------------------------------------------------------
package org.eclipse.datatools.connectivity.oda.util.logging;
import java.io.IOException;
import java.io.OutputStream;
/**
* <code>StreamHandler</code> is a stream based logging
* <code>Handler</code>.
*/
public class StreamHandler extends Handler
{
// member Variables
private OutputStream m_outStream;
/**
* Creates a <code>StreamHandler</code> with no output stream.
*/
public StreamHandler()
{
// defaults to SimpleFormatter
setFormatter( new SimpleFormatter() );
}
/**
* Creates a <code>StreamHandler</code> with the specified output
* stream and <code>LogFormatter</code>.
* @param output the output stream.
* @param formatter the log formatter.
*/
public StreamHandler( OutputStream output, LogFormatter formatter )
{
setOutputStream( output );
setFormatter( formatter );
}
/**
* Closes the current output stream.
*/
public void close()
{
try
{
// flush before closing
flush();
// this could happen if output stream was never specified.
if( m_outStream != null )
m_outStream.close();
}
catch( IOException ex )
{
reportError( "", ex, LoggingErrorHandler.CLOSE_FAILURE ); //$NON-NLS-1$
}
}
/**
* Cleans up this <code>StreamHandler</code> by calling the
* <code>close</code> method.
*/
protected void finalize()
{
close();
}
/**
* Flushes buffered message to the output stream.
*/
public void flush()
{
try
{
if( m_outStream != null )
m_outStream.flush();
}
catch( IOException ex )
{
reportError( "", ex, LoggingErrorHandler.FLUSH_FAILURE ); //$NON-NLS-1$
}
}
/**
* Format and publish the specified <code>LogRecord</code>. This first checks
* that there is an associated <code>OutputStream</code> and the specified
* <code>LogRecord</code> has the required log level. This also checks the
* <code>LogRecord</code> with the associated <code>Filter</code> to see if
* the record should be published. Then this uses its <code>LogFormatter</code>
* to format the record and publishes the result to the <code>OutputStream</code>.
* @param record the <code>LogRecord</code> to format and publish.
*/
public void publish( LogRecord record )
{
if( ! isLoggable( record ) )
return;
try
{
String recordString = getFormatter().format( record );
m_outStream.write( recordString.getBytes() );
}
catch( IOException ex )
{
reportError( "", ex, LoggingErrorHandler.WRITE_FAILURE ); //$NON-NLS-1$
}
catch( Exception ex )
{
reportError( "", ex, LoggingErrorHandler.FORMAT_FAILURE ); //$NON-NLS-1$
}
}
/**
* Checks if this <code>StreamHandler</code> has an associated
* <code>OutputStream</code>, whether the <code>LogRecord</code> has the
* adequate log level, and whether it satisfies the associated <code>Filter</code>.
* @param record the <code>LogRecord</code> to check.
* @return true if the <code>LogRecord</code> should be logged.
*/
public boolean isLoggable( LogRecord record )
{
return( super.isLoggable( record ) && m_outStream != null );
}
/**
* Sets the <code>LogFormatter</code> for this <code>StreamHandler</code>.
* If the formatter is <code>null</code>, then default <code>SimpleFormatter</code>
* will be used.
* @param formatter the formatter to set.
*/
public void setFormatter( LogFormatter formatter )
{
formatter = ( formatter != null ) ? formatter :
new SimpleFormatter();
super.setFormatter( formatter );
}
/**
* Sets the output stream.
* @param outStream the output stream.
*/
protected void setOutputStream( OutputStream outStream )
{
if( outStream == null )
throw new NullPointerException();
// flush the existing stream
flush();
m_outStream = outStream;
}
}

View File

@@ -0,0 +1,41 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="white">
[<b>Experimental</b>] Provides a trace logging utility to an
ODA runtime extension.
<p>
The package provides a default implementation of trace logging framework,
which does not impose dependency on other packages or specific platforms.
<br>It may serve to encapsulate the type of logging framework used,
by simply extending its implementation.
Each ODA runtime driver is then not required to make any direct changes when
switching to another logging framework.
<p>
The use of this logging utility is purely optional.
An ODA runtime driver extension may directly use its driver-specific logging
utility, as appropriate.
<!-- Put @see and @since tags down here. -->
@since 1.0
</body>
</html>

View File

@@ -0,0 +1,247 @@
/*
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.sql.Types;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Properties;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
/**
* Defines a type of data set supported by the ODA data source extension.
* A data set definition has a unique id, display name
* and a set of driver to ODA data type mappings.
*/
public class DataSetType
{
private String m_id;
private String m_displayName;
private Hashtable m_dataTypeMappings;
private Property[] m_properties = null;
private Properties m_propsVisibility;
private IConfigurationElement m_configElement;
private Relationship m_relationship;
DataSetType( IConfigurationElement dataSetElement ) throws OdaException
{
init( dataSetElement );
}
protected DataSetType()
{
}
protected void init( IConfigurationElement dataSetElement ) throws OdaException
{
m_id = dataSetElement.getAttribute( "id" ); //$NON-NLS-1$
assert( m_id != null ); // this check is already done by caller
m_displayName = ManifestExplorer.getElementDisplayName( dataSetElement );
// dataTypeMapping elements
m_dataTypeMappings = new Hashtable();
IConfigurationElement[] typeMappings = dataSetElement.getChildren( "dataTypeMapping" ); //$NON-NLS-1$
int numOfTypeMappings = typeMappings.length;
if( numOfTypeMappings == 0 )
throw new OdaException( Messages.bind( Messages.manifest_NO_DATA_TYPE_MAPPINGS_DEFINED,
m_id ) );
for( int i = 0; i < numOfTypeMappings; i++ )
{
IConfigurationElement typeMapping = typeMappings[i];
String nativeDataTypeCode = typeMapping.getAttribute( "nativeDataTypeCode" ); //$NON-NLS-1$
m_dataTypeMappings.put( nativeDataTypeCode,
new DataTypeMapping( typeMapping, m_id ) );
}
// properties element
IConfigurationElement[] propertiesElements = dataSetElement.getChildren( "properties" ); //$NON-NLS-1$
if ( propertiesElements.length > 0 )
{
// if multiple properties elements exist, use the last one
IConfigurationElement propertiesElement =
propertiesElements[ propertiesElements.length - 1 ];
m_properties = ExtensionManifest.getPropertyDefinitions( propertiesElement );
m_propsVisibility = ExtensionManifest.getPropertyVisibilities( propertiesElement );
}
// relationship element
m_relationship = Relationship.createInstance( dataSetElement );
// successfully initialized
m_configElement = dataSetElement;
}
/**
* Returns the configuration element used to initialize this instance.
*/
protected IConfigurationElement getConfigurationElement()
{
return m_configElement;
}
/**
* Returns the ID which uniquely identifes the type of data set among
* all ODA data sets supported by the driver.
* @return the data set type name.
*/
public String getID()
{
return m_id;
}
/**
* Returns the display name of the ODA data set type element.
* Defaults to element ID if no display name is specified.
* It can be used by the designer tool of an ODA consumer application
* to display a list of ODA data sets.
* @return The display name of the ODA data set element.
*/
public String getDisplayName()
{
return m_displayName;
}
/**
* Returns the data type mapping for the specified native data type code.
* @param nativeDataTypeCode the native data type code.
* @return the data type mapping for the native type code, or null
* if there is no data type mapping for the native type code in
* the data set type.
*/
public DataTypeMapping getDataTypeMapping( int nativeDataTypeCode )
{
String typeCode = Integer.toString( nativeDataTypeCode );
return (DataTypeMapping) m_dataTypeMappings.get( typeCode );
}
/**
* Returns the data type mappings for the data set type, or an
* empty array if no mappings exist.
* @return the data type mappings for this data set type, or an
* empty array if no mappings exist.
*/
public DataTypeMapping[] getDataTypeMappings()
{
Collection typeMappings = m_dataTypeMappings.values();
int count = typeMappings.size();
return ( DataTypeMapping[] ) typeMappings.toArray( new DataTypeMapping[count] );
}
/**
* Returns the primary ODA scalar data type code
* that the specified native data type is mapped to.
* <br>If none or unknown native data type value (0) is specified,
* maps to an ODA String data type by default.
* If no default ODA data type mapping is defined by the driver
* for the specified native data type, returns Types.NULL
* for unknown ODA data type.
* @return the primary ODA scalar data type code;
* may be java.sql.Types.NULL if no mapping is found.
*/
public int getDefaultOdaDataTypeCode( int nativeDataTypeCode )
{
DataTypeMapping mapping = getDataTypeMapping( nativeDataTypeCode );
if( mapping != null )
return mapping.getOdaScalarDataTypeCode();
// no mapping is defined by the ODA driver
// for the specified nativeDataTypeCode,
// maps a 0 native data type (defined as none or unknown value in
// the oda.design model) to an ODA String data type by default
if( nativeDataTypeCode == 0 )
return Types.CHAR;
// unknown ODA data type
return Types.NULL;
}
/**
* Returns an array of Property definition instances that represent
* the properties defined by this data set element.
* The collection includes both top-level properties and
* those in a group.
* @return an array of property definitions;
* an empty array is returned if no properties are defined.
*/
public Property[] getProperties()
{
if ( m_properties == null )
{
// creates an empty array to return
m_properties = new Property[ 0 ];
}
return m_properties;
}
/**
* Returns the Property definition instance that matches the specified name
* in the list of properties defined by this data set element.
* @param propertyName the name of a property
* @return the matching Property definition, or null if no match is found.
*/
public Property getProperty( String propertyName )
{
if ( propertyName == null || propertyName.length() == 0 )
return null;
Property[] props = getProperties();
for( int i = 0; i < props.length; i++ )
{
if ( propertyName.equals( props[ i ].getName() ))
return props[ i ];
}
return null; // no matching property
}
/**
* Returns a Properties collecton of property visibilty settings.
* @return Properties with the property name as key, and
* its visibility setting as value.
* An empty collection if no property visibility is defined.
*/
public Properties getPropertiesVisibility()
{
if ( m_propsVisibility == null )
m_propsVisibility = new Properties();
return m_propsVisibility;
}
/**
* Indicates whether this data set type is defined to be deprecated.
*/
public boolean isDeprecated()
{
return ( m_relationship != null && m_relationship.isDeprecated() );
}
/**
* Returns the related oda data set element id, if specified.
* @return the related oda data set element id, or
* null if none is specified.
*/
public String getRelatedDataSetId()
{
if( m_relationship == null )
return null;
return m_relationship.getRelatedId();
}
}

View File

@@ -0,0 +1,265 @@
/*
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.sql.Types;
import java.util.Hashtable;
import java.util.Locale;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
/**
* The data type mapping of a data provider's native data type to one or more ODA
* data types. A single native data type must be mapped to a primary ODA scalar
* data type. The driver can optionally provide a list of alternate ODA data types
* to which it is capable of converting the native data type.
*/
public class DataTypeMapping
{
private static Hashtable sm_odaTypeCodes;
private int m_nativeTypeCode;
private String m_nativeType;
private String m_odaScalarType;
private String[] m_alternativeDataTypes;
private int[] m_alternativeDataTypeCodes;
DataTypeMapping( IConfigurationElement dataTypeMapping,
String dataSetTypeName ) throws OdaException
{
m_nativeType = dataTypeMapping.getAttribute( "nativeDataType" ); //$NON-NLS-1$
if( m_nativeType == null )
throw new OdaException( Messages.bind( Messages.manifest_NO_NATIVE_TYPE_NAME_DEFINED,
dataSetTypeName ) );
String nativeDataTypeCode = dataTypeMapping.getAttribute( "nativeDataTypeCode" ); //$NON-NLS-1$
if( nativeDataTypeCode == null )
throw new OdaException( Messages.bind( Messages.manifest_NO_NATIVE_TYPE_CODE_DEFINED,
m_nativeType, dataSetTypeName ) );
try
{
m_nativeTypeCode = Integer.parseInt( nativeDataTypeCode );
}
catch( NumberFormatException ex )
{
throw new OdaException( Messages.bind( Messages.manifest_INVALID_NATIVE_TYPE_CODE_VALUE,
new Object[] { m_nativeType, nativeDataTypeCode, dataSetTypeName } ) );
}
m_odaScalarType = dataTypeMapping.getAttribute( "odaScalarDataType" ); //$NON-NLS-1$
sanityCheckOdaScalarType( m_odaScalarType, false /* isForAlternatives */ );
IConfigurationElement[] alternativeDataTypes =
dataTypeMapping.getChildren( "alternativeOdaDataType" ); //$NON-NLS-1$
int length = alternativeDataTypes.length;
m_alternativeDataTypes = new String[length];
for( int i = 0; i < length; i++ )
{
m_alternativeDataTypes[i] =
alternativeDataTypes[i].getAttribute( "odaScalarDataType" ); //$NON-NLS-1$
sanityCheckOdaScalarType( m_alternativeDataTypes[i], true /* isForAlternatives */ );
}
}
protected DataTypeMapping( int nativeTypeCode, String nativeType,
String odaScalarType,
String[] alternativeDataTypes )
{
m_nativeTypeCode = nativeTypeCode;
m_nativeType = nativeType;
m_odaScalarType = odaScalarType;
m_alternativeDataTypes = alternativeDataTypes;
}
private void sanityCheckOdaScalarType( String odaScalarType, boolean isForAlternatives )
throws OdaException
{
if( odaScalarType == null )
throw new OdaException( isForAlternatives ?
Messages.bind( Messages.manifest_NO_ODA_SCALAR_DATA_TYPE_DEFINED_2, m_nativeType ) :
Messages.bind( Messages.manifest_NO_ODA_SCALAR_DATA_TYPE_DEFINED_1, m_nativeType ) );
if( ! getOdaTypeCodes().containsKey( toOdaTypeKey( odaScalarType ) ))
throw new OdaException( Messages.bind( Messages.manifest_INVALID_ODA_SCALAR_DATA_TYPE_VALUE,
odaScalarType, m_nativeType ) );
}
/**
* Returns the native type name of the data type mapping.
* @return the native type name.
*/
public String getNativeType()
{
return m_nativeType;
}
/**
* Returns the native type code of the data type mapping.
* Its value must match one of the data type codes returned in the
* driver's ODA interface implementation.
* @return the native type code.
*/
public int getNativeTypeCode()
{
return m_nativeTypeCode;
}
/**
* Returns the primary ODA scalar data type that the native data type maps to
* @return the primary ODA scalar data type.
*/
public String getOdaScalarDataType()
{
return m_odaScalarType;
}
/**
* Returns the primary ODA scalar data type code
* that the native data type maps to.
* @return the primary ODA scalar data type code.
*/
public int getOdaScalarDataTypeCode()
{
return toOdaDataTypeCode( m_odaScalarType );
}
/**
* Returns the alternative ODA data types of the data type mapping, or
* an empty array if no alternative ODA data types exist.
* @return the alternative ODA data types, or an empty array if no alternative
* ODA data types exist.
*/
public String[] getAlternativeOdaDataTypes()
{
return m_alternativeDataTypes;
}
/**
* Returns the alternative ODA data type codes of the data type mapping, or
* an empty array if no alternative ODA data types exist.
* @return the alternative ODA data type codes, or an empty array if no alternative
* ODA data types exist.
*/
public int[] getAlternativeOdaDataTypeCodes()
{
if( m_alternativeDataTypeCodes == null )
{
int numCodes = m_alternativeDataTypes.length;
m_alternativeDataTypeCodes = new int[numCodes];
for( int i = 0; i < numCodes; i++ )
{
m_alternativeDataTypeCodes[i] =
toOdaDataTypeCode( m_alternativeDataTypes[i] );
}
}
return m_alternativeDataTypeCodes;
}
/**
* A convenient method to indicate whether the ODA data provider
* is capable of converting this mapping's native data type
* to the specified ODA data type code.
* @param odaDataTypeCode an ODA data type code
* @return true if the specified ODA data type can be converted from this
* mapping's native data type; false otherwise.
*/
public boolean canConvertToOdaType( int odaDataTypeCode )
{
// check if the specified code is the primary ODA data type
// defined in this native type's mapping
if( odaDataTypeCode == getOdaScalarDataTypeCode() )
return true;
// check if the specified code is one of the alternative ODA data types
// defined in this native type's mapping
int[] alternateOdaTypes = getAlternativeOdaDataTypeCodes();
for( int i = 0; i < alternateOdaTypes.length; i++ )
{
if( odaDataTypeCode == alternateOdaTypes[i] )
return true;
}
return false;
}
/**
* Converts an ODA data type literal value to its
* corresponding code value.
* @param odaDataTypeLiteral a literal value of an ODA data type
* @return corresponding ODA data type code value,
* or Types.NULL if specified literal value is
* not recognized
*/
public static int toOdaDataTypeCode( String odaDataTypeLiteral )
{
if( odaDataTypeLiteral == null ||
odaDataTypeLiteral.length() == 0 )
return Types.NULL;
Object typeCode =
getOdaTypeCodes().get( toOdaTypeKey( odaDataTypeLiteral ) );
if( typeCode != null )
return ((Integer) typeCode).intValue();
return Types.NULL;
}
/**
* Returns the cached table that maps each ODA data type name
* to its corresponding data type code.
* The data type name serves as the key in the cached table.
*/
private static Hashtable getOdaTypeCodes()
{
if( sm_odaTypeCodes == null )
{
sm_odaTypeCodes = new Hashtable( 10 );
sm_odaTypeCodes.put( toOdaTypeKey( "String" ), //$NON-NLS-1$
new Integer( Types.CHAR ));
sm_odaTypeCodes.put( toOdaTypeKey( "Integer" ), //$NON-NLS-1$
new Integer( Types.INTEGER ));
sm_odaTypeCodes.put( toOdaTypeKey( "Double" ), //$NON-NLS-1$
new Integer( Types.DOUBLE ));
sm_odaTypeCodes.put( toOdaTypeKey( "Decimal" ), //$NON-NLS-1$
new Integer( Types.DECIMAL ));
sm_odaTypeCodes.put( toOdaTypeKey( "Date" ), //$NON-NLS-1$
new Integer( Types.DATE ));
sm_odaTypeCodes.put( toOdaTypeKey( "Time" ), //$NON-NLS-1$
new Integer( Types.TIME ));
sm_odaTypeCodes.put( toOdaTypeKey( "Timestamp" ), //$NON-NLS-1$
new Integer( Types.TIMESTAMP ));
sm_odaTypeCodes.put( toOdaTypeKey( "Blob" ), //$NON-NLS-1$
new Integer( Types.BLOB ));
sm_odaTypeCodes.put( toOdaTypeKey( "Clob" ), //$NON-NLS-1$
new Integer( Types.CLOB ));
}
return sm_odaTypeCodes;
}
private static String toOdaTypeKey( String odaDataTypeLiteral )
{
assert odaDataTypeLiteral != null;
return odaDataTypeLiteral.toLowerCase( Locale.US );
}
}

View File

@@ -0,0 +1,456 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Properties;
import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
/**
* Encapsulates access to the content of an ODA data source
* plug-in extension manifest.
*/
public class ExtensionManifest
{
public static final String CLASS_ATTRIBUTE_NAME = "driverClass"; //$NON-NLS-1$
private String m_namespace;
private String m_dataSourceElementId;
private String m_odaVersion;
private String m_displayName;
private RuntimeInterface m_runtime;
private Hashtable m_dataSetTypes;
private TraceLogging m_traceLogging;
private Property[] m_properties = null;
private Properties m_propsVisibility;
private IConfigurationElement m_dataSourceElement;
private IExtension m_dataSourceExtn;
private Relationship m_relationship;
ExtensionManifest( IExtension dataSourceExtn ) throws OdaException
{
init( dataSourceExtn );
}
protected ExtensionManifest()
{
}
protected void init( IExtension dataSourceExtn ) throws OdaException
{
m_dataSourceElement =
ManifestExplorer.getDataSourceElement( dataSourceExtn );
assert( m_dataSourceElement != null );
m_namespace = dataSourceExtn.getContributor().getName();
// first cache the data source element's attributes
m_dataSourceElementId = m_dataSourceElement.getAttribute( "id" ); //$NON-NLS-1$
if( m_dataSourceElementId == null || m_dataSourceElementId.length() == 0 )
throw new OdaException( Messages.manifest_NO_DATA_SOURCE_EXTN_ID_DEFINED );
m_odaVersion = m_dataSourceElement.getAttribute( "odaVersion" ); //$NON-NLS-1$
m_displayName = ManifestExplorer.getElementDisplayName( m_dataSourceElement );
// runtime interface
String driverClass = m_dataSourceElement.getAttribute( CLASS_ATTRIBUTE_NAME );
if( driverClass == null )
throw new OdaException( Messages.bind( Messages.manifest_NO_DRIVER_CLASS_DEFINED,
m_dataSourceElementId ) );
String needSetThreadContextClassLoader =
m_dataSourceElement.getAttribute( "setThreadContextClassLoader" ); //$NON-NLS-1$
if( needSetThreadContextClassLoader == null ||
needSetThreadContextClassLoader.length() == 0 )
{
// assign default
needSetThreadContextClassLoader = "false"; //$NON-NLS-1$
}
else // validate specified value
{
if( ! needSetThreadContextClassLoader.equalsIgnoreCase( "true" ) && //$NON-NLS-1$
! needSetThreadContextClassLoader.equalsIgnoreCase( "false" ) ) //$NON-NLS-1$
throw new OdaException( Messages.bind( Messages.manifest_INVALID_SET_THREAD_CONTEXT_CLASSLOADER_VALUE,
needSetThreadContextClassLoader, m_dataSourceElementId ) );
}
m_runtime =
new JavaRuntimeInterface( driverClass,
Boolean.valueOf( needSetThreadContextClassLoader ).booleanValue(),
m_namespace );
// data set definition elements in the same extension
m_dataSetTypes = ManifestExplorer.getDataSetElements( dataSourceExtn, m_dataSourceElementId );
// trace logging element
IConfigurationElement[] traceLogging = m_dataSourceElement.getChildren( "traceLogging" ); //$NON-NLS-1$
int numOfTraceLogging = traceLogging.length;
// if multiple trace logging configuration exist, use the last one
if( numOfTraceLogging > 0 )
m_traceLogging = new TraceLogging( traceLogging[ numOfTraceLogging - 1 ], m_dataSourceElementId );
// properties element
IConfigurationElement[] propertiesElements = m_dataSourceElement.getChildren( "properties" ); //$NON-NLS-1$
if( propertiesElements.length > 0 )
{
// if multiple properties elements exist, use the last one
IConfigurationElement propertiesElement =
propertiesElements[ propertiesElements.length - 1 ];
m_properties = getPropertyDefinitions( propertiesElement );
m_propsVisibility = getPropertyVisibilities( propertiesElement );
}
// relationship element
m_relationship = Relationship.createInstance( m_dataSourceElement );
// successfully initialized
m_dataSourceExtn = dataSourceExtn;
}
/**
* Returns the data source extension element used to initialize this instance.
*/
protected IExtension getDataSourceExtension()
{
return m_dataSourceExtn;
}
/*
* Parse and return all the property definitions,
* combining both top-level and grouped properties.
*/
static Property[] getPropertyDefinitions( IConfigurationElement propertiesElement )
throws OdaException
{
IConfigurationElement[] propElements = propertiesElement.getChildren( "property" ); //$NON-NLS-1$
IConfigurationElement[] propGroupElements = propertiesElement.getChildren( "propertyGroup" ); //$NON-NLS-1$
int numProperties = propElements.length + propGroupElements.length;
if ( numProperties <= 0 )
return new Property[ 0 ];
ArrayList properties = new ArrayList();
// first convert top-level property elements
for( int i = 0, size = propElements.length; i < size; i++ )
{
IConfigurationElement propElement = propElements[i];
properties.add( new Property( propElement ) );
}
// next convert property elements in each group
for( int j = 0, size2 = propGroupElements.length; j < size2; j++ )
{
IConfigurationElement propGroupElement = propGroupElements[j];
// no validation is done; up to the consumer to process
String groupName = propGroupElement.getAttribute( "name" ); //$NON-NLS-1$
String groupDisplayName = ManifestExplorer.getElementDisplayName( propGroupElement );
IConfigurationElement[] groupedPropElements = propGroupElement.getChildren( "property" ); //$NON-NLS-1$
for( int i = 0, size = groupedPropElements.length; i < size; i++ )
{
IConfigurationElement groupedPropElement = groupedPropElements[i];
properties.add( new Property( groupedPropElement, groupName, groupDisplayName ) );
}
}
return (Property[]) properties.toArray( new Property[ properties.size() ] );
}
/*
* Parse and return the property visibility definitions.
*/
static Properties getPropertyVisibilities( IConfigurationElement propertiesElement )
throws OdaException
{
// convert propertyVisibility elements to a collection
IConfigurationElement[] propVisibilityElements =
propertiesElement.getChildren( "propertyVisibility" ); //$NON-NLS-1$
if ( propVisibilityElements.length == 0 )
return null; // done
Properties propsVisibility = new Properties();
for( int i = 0, size = propVisibilityElements.length; i < size; i++ )
{
IConfigurationElement propVisibltyElement = propVisibilityElements[i];
// no validation is done; up to the consumer to process
String propName = propVisibltyElement.getAttribute( "name" ); //$NON-NLS-1$
String propVisbility = propVisibltyElement.getAttribute( "visibility" ); //$NON-NLS-1$
propsVisibility.setProperty( propName, propVisbility );
}
return propsVisibility;
}
/**
* Returns the namespace of the plugin that contributes this ODA runtime extension.
* @return the plugin namespace for the ODA driver, null if the driver does not have
* a namespace.
*/
public String getNamespace()
{
return m_namespace;
}
/**
* Returns the ID that uniquely identifies this
* ODA data source extension in an ODA consumer application's
* environment. This is the extension that implements
* the org.eclipse.datatools.connectivity.oda.dataSource extension point.
* <br>Since each data source extension
* has one and only one data source element, the element ID
* is used as the extension ID.
* @return the data source extension ID.
*/
public String getExtensionID()
{
return getDataSourceElementID();
}
/**
* Returns the ID that uniquely identifies the dataSource element defined
* in the ODA data source extension.
* @return the data source element ID.
*/
public String getDataSourceElementID()
{
return m_dataSourceElementId;
}
/**
* Returns the configuration element of this extension's
* data source element.
* @return a dataSource configuration element
*/
public IConfigurationElement getDataSourceElement()
{
return m_dataSourceElement;
}
/**
* Returns the driver installation location.
* @return the driver directory.
* @throws IOException if an IO error occurs.
*/
public URL getDriverLocation() throws IOException
{
// should be same as the runtime library location in this case
return m_runtime.getLibraryLocation();
}
/**
* Returns the version of the <i>org.eclipse.datatools.connectivity.oda</i>
* interfaces for which this driver is developed.
* @return The ODA interface version. Its format is as defined
* in the extension point schema.
*/
public String getOdaVersion()
{
return m_odaVersion;
}
/**
* Returns the display name of the data source element
* defined in the ODA data source extension.
* Defaults to element ID if no display name is specified.
* It can be used by an ODA consumer application's designer tool
* to display a list of ODA data source extensions.
* @return The display name of the ODA data source element.
*/
public String getDataSourceDisplayName()
{
return m_displayName;
}
/**
* Returns an array of DataSetType instances that
* represent the dataSet elements defined in
* this data source extension.
* @return an array of data set types; may return an empty array
* if no dataSet elements are defined.
*/
public DataSetType[] getDataSetTypes()
{
Collection dataSetTypes = m_dataSetTypes.values();
int size = dataSetTypes.size();
return (DataSetType[]) dataSetTypes.toArray( new DataSetType[size] );
}
/**
* Returns an array of ids of the dataSet elements
* defined in this data source extension.
* @return an array of data set type IDs; may return an empty array
* if no dataSet elements are defined.
*/
public String[] getDataSetTypeIDs()
{
Set dataSetTypeIDs = m_dataSetTypes.keySet();
int size = dataSetTypeIDs.size();
return (String[]) dataSetTypeIDs.toArray( new String[size] );
}
/**
* Returns the number of data set types defined in this ODA data source extension.
* @return number of data set types defined; may be zero if none is defined
*/
public int getDataSetTypeCount()
{
return m_dataSetTypes.size();
}
/**
* Returns the DataSetType instance that
* represents the dataSet element with the given ID
* defined in this data source extension.
* If the given data set element ID is null and the data source
* extension supports only one data set type, that
* data set element will be returned by default.
* @param dataSetElementID the id of the data set element.
* @return the data set element definition.
* @throws OdaException if there is no data set definition associated
* with the specified data set element ID, or
* if there are more than one data set elements
* that match the ID.
*/
public DataSetType getDataSetType( String dataSetElementID ) throws OdaException
{
if( dataSetElementID == null )
{
// find default data set element and return it if found
if( m_dataSetTypes.size() != 1 )
throwsIllegalArgumentOdaException( dataSetElementID );
Collection dataSetTypes = m_dataSetTypes.values();
assert( dataSetTypes.size() == 1 );
return (DataSetType) dataSetTypes.toArray()[0];
}
DataSetType dsType = (DataSetType) m_dataSetTypes.get( dataSetElementID );
if( dsType == null )
throwsIllegalArgumentOdaException( dataSetElementID );
return dsType;
}
private void throwsIllegalArgumentOdaException( String arg ) throws OdaException
{
Exception illegalArg = new IllegalArgumentException( arg );
OdaException ex = new OdaException( illegalArg.toString() );
ex.initCause( illegalArg );
throw ex;
}
/**
* Returns the optional trace logging configuration for the driver.
* @return the trace logging configuration, or null if no trace logging
* configuration was specified.
*/
public TraceLogging getTraceLogging()
{
return m_traceLogging;
}
/**
* Returns the runtime interface configuration.
* @return the runtime interface configuration.
*/
public RuntimeInterface getRuntimeInterface()
{
return m_runtime;
}
/**
* Returns an array of Property definition instances that represent
* the properties defined by this data source extension.
* The collection includes both top-level properties and
* those in a group.
* @return an array of property definitions;
* an empty array is returned if no properties are defined.
*/
public Property[] getProperties()
{
if ( m_properties == null )
{
// creates an empty array to return
m_properties = new Property[ 0 ];
}
return m_properties;
}
/**
* Returns the Property definition instance that matches the specified name
* in the list of properties defined by this data source extension.
* @param propertyName the name of a property
* @return the matching Property definition, or null if no match is found.
*/
public Property getProperty( String propertyName )
{
if ( propertyName == null || propertyName.length() == 0 )
return null;
Property[] props = getProperties();
for( int i = 0; i < props.length; i++ )
{
if ( propertyName.equals( props[ i ].getName() ))
return props[ i ];
}
return null; // no matching property
}
/**
* Returns a Properties collecton of property visibilty settings.
* @return Properties with the property name as key, and
* its visibility setting as value.
* An empty collection if no property visibility is defined.
*/
public Properties getPropertiesVisibility()
{
if ( m_propsVisibility == null )
m_propsVisibility = new Properties();
return m_propsVisibility;
}
/**
* Indicates whether this extension is defined to be deprecated.
*/
public boolean isDeprecated()
{
return ( m_relationship != null && m_relationship.isDeprecated() );
}
/**
* Returns the related oda data source element id, if specified.
* @return the related oda data source element id, or
* null if none is specified.
*/
public String getRelatedDataSourceId()
{
if( m_relationship == null )
return null;
return m_relationship.getRelatedId();
}
}

View File

@@ -0,0 +1,100 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
/**
* This class encapsulates the Java runtime interface specific configurations.
*/
public class JavaRuntimeInterface extends RuntimeInterface
{
private String m_driverClass;
private boolean m_needSetThreadContextClassLoader;
private String m_namespace;
JavaRuntimeInterface( String driverClass,
boolean needSetThreadContextClassLoader,
String namespace )
{
m_driverClass = driverClass;
m_needSetThreadContextClassLoader = needSetThreadContextClassLoader;
m_namespace = namespace;
}
public int getInterfaceType()
{
return JAVA_TYPE;
}
/**
* Returns the fully qualified concrete class that implements the
* <i>org.eclipse.datatools.connectivity.oda.IDriver</i> interface.
* This is the entry point of the ODA runtime extension.
* @return the fully qualified connection factory class name.
*/
public String getDriverClass()
{
return m_driverClass;
}
/**
* If true, the consumer of the ODA runtime extension plugin should set the
* thread context class loader to the class loader used to load this driver
* before calling any ODA interface method. The default is false.
* @return true if the thread context classloader is to be set for the
* ODA runtime extension plugin.
*/
public boolean needSetThreadContextClassLoader()
{
return m_needSetThreadContextClassLoader;
}
/**
* @see org.eclipse.datatools.connectivity.oda.util.manifest.RuntimeInterface#getLibraryLocation()
*/
public URL getLibraryLocation() throws IOException
{
return getLocation( "/" ); //$NON-NLS-1$
}
/**
* @see org.eclipse.datatools.connectivity.oda.util.manifest.RuntimeInterface#getDriverFileLocation(java.lang.String)
*/
public URL getDriverFileLocation( String filename ) throws IOException
{
return getLocation( filename );
}
private URL getLocation( String entry ) throws IOException
{
Bundle bundle = Platform.getBundle( m_namespace );
URL url = bundle.getEntry( entry );
return Platform.asLocalURL( url );
}
/**
* @see org.eclipse.datatools.connectivity.oda.util.manifest.RuntimeInterface#getLibraries()
*/
public String[] getLibraries()
{
// Eclipse core classes doesn't expose this information
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,669 @@
/*
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
/**
* The Manifest Explorer is the entry point to explore and access
* the manifest of all the ODA plug-ins extensions that implement the
* <code>org.eclipse.datatools.connectivity.oda.dataSource</code> extension point.
* The <code>ManifestExplorer</code> singleton instance is retrieved
* using the <code>getInstance()</code> method.
*/
public class ManifestExplorer
{
private static ManifestExplorer sm_instance = null;
// trace logging variables
private static Logger sm_logger = null;
private Hashtable m_manifestsById; // cached copy of manifests by odaDataSourceId
private static final String DTP_ODA_EXT_POINT =
"org.eclipse.datatools.connectivity.oda.dataSource"; //$NON-NLS-1$
// works around bug in some J2EE servers - Bugzilla #126073
private static final String PACKAGE_NAME =
"org.eclipse.datatools.connectivity.oda.util.manifest"; //$NON-NLS-1$
/**
* Gets the <code>ManifestExplorer</code> instance to
* explore the manifest of the data source extensions.
* @return the <code>ManifestExplorer</code> instance.
*/
public static ManifestExplorer getInstance()
{
if( sm_instance == null )
sm_instance = new ManifestExplorer();
return sm_instance;
}
/**
* Singleton instance release method.
*/
public static void releaseInstance()
{
sm_instance = null;
sm_logger = null;
}
static Logger getLogger()
{
if( sm_logger == null )
sm_logger = Logger.getLogger( PACKAGE_NAME );
return sm_logger;
}
private ManifestExplorer()
{
}
/**
* Refresh the manifest explorer, and allows it to get
* the latest ODA Design UI extension manifests.
*/
public void refresh()
{
// reset the cached collection of ODA extension manifest instances
m_manifestsById = null;
}
private Hashtable getCachedManifests()
{
if( m_manifestsById == null )
m_manifestsById = new Hashtable();
return m_manifestsById;
}
/**
* Returns a collection of identifiers of
* all ODA data source extensions.
* The extension's data source element ID and display name
* are stored as the key and value in the returned Properties instance.
* The returned collection includes all matching extensions, including those
* with no dataSet elements defined.
* Returns an empty <code>Properties</code> if there are
* no data source extensions found.
* @return a <code>Properties</code> containing the id
* and display name of all data source extensions.
*/
public Properties getDataSourceIdentifiers()
{
IExtension[] extensions = getDataSourceExtensions();
int length = ( extensions == null ) ?
0 : extensions.length;
Properties extensionIds = new Properties();
for( int i = 0; i < length; i++ )
{
IExtension extension = extensions[i];
try
{
IConfigurationElement dsElement = getDataSourceElement( extension );
String dataSourceId = dsElement.getAttribute( "id" ); //$NON-NLS-1$
String dataSourceDisplayName = getElementDisplayName( dsElement );
extensionIds.setProperty( dataSourceId, dataSourceDisplayName );
}
catch( OdaException ex )
{
getLogger().log( Level.WARNING, "Ignoring invalid extension.", ex ); //$NON-NLS-1$
}
}
return extensionIds;
}
/**
* Returns the extension configuration information found
* in the plugin manifest file of the data source extension
* that contains the specified data source element and
* implements the DTP ODA run-time extension point -
* org.eclipse.datatools.connectivity.oda.dataSource.
* @param dataSourceId the unique id of the data source element
* in a data source extension.
* @return the extension manifest information
* @throws OdaException if the extension manifest is invalid.
* @throws IllegalArgumentException if no extension is found.
*/
public ExtensionManifest getExtensionManifest( String dataSourceId )
throws OdaException
{
ExtensionManifest manifest =
getExtensionManifest( dataSourceId, DTP_ODA_EXT_POINT );
if( manifest != null )
return manifest;
throw new IllegalArgumentException( dataSourceId );
}
/**
* Returns the extension configuration information found
* in the plugin manifest file of the data source extension
* that contains the specified data source element and
* implements the specified ODA extension point.
* @param dataSourceId the unique id of the data source element
* in a data source extension.
* @param extensionPoint the id of the extension point to search
* @return the extension manifest information,
* or null if no extension configuration is found.
* @throws OdaException if the extension manifest is invalid.
*/
public ExtensionManifest getExtensionManifest( String dataSourceId,
String extensionPoint )
throws OdaException
{
if ( dataSourceId == null || dataSourceId.length() == 0 )
throw new IllegalArgumentException( dataSourceId );
if ( extensionPoint == null || extensionPoint.length() == 0 )
throw new IllegalArgumentException( extensionPoint );
// first check if specified dataSourceId's manifest
// is already in cache, and use it
ExtensionManifest aManifest =
(ExtensionManifest) getCachedManifests().get( dataSourceId );
if( aManifest != null )
return aManifest;
IExtension[] extensions = getExtensions( extensionPoint );
IExtension dataSourceExtn = findExtension( dataSourceId, extensions );
if ( dataSourceExtn == null ) // not found
return null;
// found extension
return getExtensionManifest( dataSourceExtn );
}
/**
* Returns the extension configuration information found
* in the plugin manifest file for the specified data source
* extension.
* Applies the matching manifest from the cached collection,
* if exists. Otherwise, instantiates a new manifest, and saves in cache.
* @param dataSourceExtn data source extension object
* @return the extension manifest information
* @throws OdaException if the extension manifest is invalid
*/
private ExtensionManifest getExtensionManifest( IExtension dataSourceExtn )
throws OdaException
{
if( dataSourceExtn == null )
throw new OdaException(
new IllegalArgumentException( Messages.manifest_nullArgument ));
IConfigurationElement dataSourceElement =
getDataSourceElement( dataSourceExtn );
assert( dataSourceElement != null );
String dataSourceId = dataSourceElement.getAttribute( "id" ); //$NON-NLS-1$
// first check if specified extension's dataSourceId manifest
// is already in cache, and use it
ExtensionManifest aManifest =
(ExtensionManifest) getCachedManifests().get( dataSourceId );
if( aManifest != null )
return aManifest;
// validate and create its extension manifest
aManifest = new ExtensionManifest( dataSourceExtn );
// keep it in cached collection
getCachedManifests().put( dataSourceId, aManifest );
return aManifest;
}
/**
* Returns an array of DTP ODA dataSource extension configuration information
* found in corresponding plugin manifest file.
* Returns an empty array if there are no data source extensions found.
* Invalid data source extension definitions are ignored.
* @return an <code>ExtensionManifest</code> array containing
* the definition of all matching ODA data source extensions.
*/
public ExtensionManifest[] getExtensionManifests()
{
return getExtensionManifests( DTP_ODA_EXT_POINT );
}
/**
* Returns an array of ODA dataSource extension configuration information
* of those extensions that implement the specified extension point.
* Returns an empty array if there are no data source extensions found.
* Invalid data source extension definitions are ignored.
* @param extensionPoint name of an ODA data source extension point
* @return an <code>ExtensionManifest</code> array containing
* the definition of all matching ODA data source extensions.
*/
public ExtensionManifest[] getExtensionManifests( String extensionPoint )
{
// for backward compatibility, exclude those extensions
// that have no data set elements defined, and
// include deprecated extensions
Filter aFilter = createFilter();
aFilter.setMissingDataSetTypesFilter( true );
aFilter.setDeprecatedFilter( false );
return getExtensionManifests( extensionPoint, aFilter );
}
/**
* Returns an array of DTP ODA dataSource extension configuration information
* found in corresponding plugin manifest file.
* The argument specifies whether to include all matching extensions, regardless of
* whether it has defined no dataSet element, such as a driver adapter plugin.
* @param includesAllExtensions true to return all matching extensions,
* including those with no valid dataSet element defined;
* false to include only those matching extensions
* with at least one valid dataSet element defined
* @return an <code>ExtensionManifest</code> array containing
* the definition of all matching ODA data source extensions.
* @deprecated As of DTP 1.0, replaced by
* {@link #getExtensionManifests(String, org.eclipse.datatools.connectivity.oda.util.manifest.ManifestExplorer.Filter)}
*/
public ExtensionManifest[] getExtensionManifests( boolean includesAllExtensions )
{
return getExtensionManifests( DTP_ODA_EXT_POINT, includesAllExtensions );
}
/**
* Returns an array of ODA dataSource extension configuration information
* of those extensions that implement the specified extension point.
* The argument specifies whether to include all matching extensions, regardless of
* whether it has defined no dataSet element, such as a driver adapter plugin.
* @param extensionPoint name of an ODA data source extension point
* @param includesAllExtensions true to return all matching extensions,
* including those with no valid dataSet element defined;
* false to include only those matching extensions
* with at least one valid dataSet element defined
* @return an <code>ExtensionManifest</code> array containing
* the definition of all matching ODA data source extensions.
* @deprecated As of DTP 1.0, replaced by
* {@link #getExtensionManifests(String, org.eclipse.datatools.connectivity.oda.util.manifest.ManifestExplorer.Filter)}
*/
public ExtensionManifest[] getExtensionManifests( String extensionPoint,
boolean includesAllExtensions )
{
Filter aFilter = createFilter();
aFilter.setMissingDataSetTypesFilter( includesAllExtensions == false );
aFilter.setDeprecatedFilter( false );
return getExtensionManifests( extensionPoint, aFilter );
}
/**
* Returns an array of ODA dataSource extension configuration information
* of those extensions that implement the specified extension point and
* meet the filter criteria.
* @param extensionPoint name of an ODA data source extension point
* @param collectionFilter specifies the types of extensions to exclude in
* the returned collection;
* may be null if no filtering is needed
* @return an <code>ExtensionManifest</code> array containing
* the definition of all matching ODA data source extensions.
*/
public ExtensionManifest[] getExtensionManifests( String extensionPoint,
Filter collectionFilter )
{
IExtension[] extensions = getExtensions( extensionPoint );
int length = ( extensions == null ) ?
0 : extensions.length;
ArrayList manifestList = new ArrayList( length );
for( int i = 0; i < length; i++ )
{
IExtension dataSourceExtn = extensions[i];
try
{
ExtensionManifest manifest = getExtensionManifest( dataSourceExtn );
boolean includeExtension = true;
// applies filter options, if specified
if( collectionFilter != null )
{
/* excludes this extension manifest if the specified filter argument
* indicates to filter out those without a data set element
*/
if( collectionFilter.isMissingDataSetTypesFilterOn() &&
manifest.getDataSetTypeCount() <= 0 )
includeExtension = false;
/* excludes this extension manifest if the filter argument
* indicates to filter out deprecated extensions
*/
if( collectionFilter.isDeprecatedFilterOn() &&
manifest.isDeprecated() )
includeExtension = false;
}
if( includeExtension )
manifestList.add( manifest );
}
catch( OdaException ex )
{
getLogger().log( Level.WARNING, "Ignoring invalid extension.", ex ); //$NON-NLS-1$
}
}
int numOfValidExtensions = manifestList.size();
return (ExtensionManifest[])
manifestList.toArray( new ExtensionManifest[ numOfValidExtensions ] );
}
private IExtension findExtension( String dataSourceId, IExtension[] extensions )
throws OdaException
{
int length = ( extensions == null ) ?
0 : extensions.length;
for( int i = 0; i < length; i++ )
{
IExtension extension = extensions[i];
String extnDataSourceId = null;
try
{
/* Each odaDataSource extension should have only
* one dataSource element.
*/
IConfigurationElement dataSourceElement =
getDataSourceElement( extension );
extnDataSourceId = dataSourceElement.getAttribute( "id" ); //$NON-NLS-1$
}
catch( OdaException ex )
{
getLogger().log( Level.WARNING, "Ignoring invalid extension.", ex ); //$NON-NLS-1$
continue;
}
/* The first extension found with matching dataSourceId
* in its dataSource element is considered a match.
*/
if( extnDataSourceId != null &&
extnDataSourceId.equalsIgnoreCase( dataSourceId ) )
return extension;
}
return null;
}
private IExtension[] getDataSourceExtensions()
{
return getExtensions( DTP_ODA_EXT_POINT );
}
// Package static helper methods
/*
* Returns all the plugin extensions that implements the given
* extension point.
*/
public static IExtension[] getExtensions( String extPoint )
{
IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry();
if( pluginRegistry == null ) // possible in web deployment
return null;
IExtensionPoint extensionPoint =
pluginRegistry.getExtensionPoint( extPoint );
if ( extensionPoint == null )
return null;
return extensionPoint.getExtensions();
}
/*
* Returns the dataSource element of the given data source extension.
*/
static IConfigurationElement getDataSourceElement( IExtension extension )
throws OdaException
{
return getNamedElement( extension, "dataSource" ); //$NON-NLS-1$
}
/**
* Returns the configuration element of the given extension
* and element name.
* <br>For internal use only.
*/
public static IConfigurationElement getNamedElement( IExtension extension,
String elementName )
throws OdaException
{
IConfigurationElement[] configElements =
getNamedElements( extension, elementName );
if( configElements.length == 0 )
throw new OdaException( Messages.manifest_NO_DRIVER_RUNTIME_CONFIGURATION_DEFINED );
return configElements[0]; // returns the first matching element
}
/**
* Returns a collection of configuration elements with the given name
* in the given extension.
* Validates that each element has an id attribute defined.
* @return a collection of matching configuration elements
* <br>For internal use only.
*/
public static IConfigurationElement[] getNamedElements(
IExtension extension,
String elementName )
throws OdaException
{
return getNamedElements( extension, elementName, "id" ); //$NON-NLS-1$
}
/**
* Returns a collection of configuration elements with the given name
* in the given extension.
* Validates that each element has the specified attribute defined.
* @return a collection of matching configuration elements
* <br>For internal use only.
*/
public static IConfigurationElement[] getNamedElements(
IExtension extension,
String elementName,
String requiredAttributeName )
throws OdaException
{
IConfigurationElement[] configElements = extension.getConfigurationElements();
ArrayList matchedElements = new ArrayList();
for( int i = 0, n = configElements.length; i < n; i++ )
{
IConfigurationElement configElement = configElements[i];
if( ! configElement.getName().equalsIgnoreCase( elementName ) )
continue;
// validate that the element has the required attribute with non-empty value
String attrValue = configElement.getAttribute( requiredAttributeName );
if( attrValue == null || attrValue.length() == 0 )
throw new OdaException(
Messages.bind( Messages.manifest_NO_ATTRIBUTE_ID_DEFINED,
requiredAttributeName, elementName ));
matchedElements.add( configElement );
}
return (IConfigurationElement[]) matchedElements.toArray(
new IConfigurationElement[ matchedElements.size() ] );
}
/*
* Returns a collection of dataSet elements of the given data source extension.
* May return an empty collection if no dataSet elements are defined.
*/
static Hashtable getDataSetElements( IExtension extension,
String dataSourceElementId )
throws OdaException
{
IConfigurationElement[] configElements =
getNamedElements( extension, "dataSet" ); //$NON-NLS-1$
Hashtable dataSetElements = new Hashtable();
int numConfigElements = configElements.length;
for( int i = 0; i < numConfigElements; i++ )
{
IConfigurationElement configElement = configElements[i];
String dataSetTypeId = configElement.getAttribute( "id" ); //$NON-NLS-1$
// if duplicated data set type ids exist in the extension,
// only the last one applies
dataSetElements.put( dataSetTypeId, new DataSetType( configElement ) );
}
if( dataSetElements.size() < 1 )
{
String msg = Messages.bind( Messages.manifest_NO_DATA_SET_TYPES_DEFINED,
dataSourceElementId );
if( numConfigElements >= 1 ) // defined elements are all invalid
throw new OdaException( msg );
// no dataSet elements are defined; ok to proceed
getLogger().log( Level.CONFIG, msg );
}
return dataSetElements;
}
/*
* Encapsulates the logic of finding the most appropriate
* display name to use for the given element.
*/
static String getElementDisplayName( IConfigurationElement dsElement )
{
String displayName = dsElement.getAttribute( "defaultDisplayName" ); //$NON-NLS-1$
// Default to its id or name, if no display name is specified
if ( displayName == null || displayName.length() == 0 )
{
displayName = dsElement.getAttribute( "name" ); //$NON-NLS-1$
if ( displayName == null ) // no such attribute
displayName = dsElement.getAttribute( "id" ); //$NON-NLS-1$
}
return displayName;
}
/**
* Converts the specified native data type code to
* its default ODA data type code,
* based on the data type mapping defined
* by the specified ODA data source and data set types.
* @param nativeTypeCode native type code specific to the ODA data source
* @param odaDataSourceId the ODA data source element id
* @param dataSetType the type of data set
* @return the converted ODA data type code,
* or java.sql.Types.NULL if no valid mapping is found
*/
public int getDefaultOdaDataTypeCode( int nativeTypeCode,
String odaDataSourceId, String dataSetType )
{
DataSetType setType = null;
try
{
ExtensionManifest manifest = getExtensionManifest( odaDataSourceId );
if( manifest == null )
return Types.NULL;
setType = manifest.getDataSetType( dataSetType );
}
catch( OdaException e )
{
// ignore
}
if( setType == null )
return Types.NULL;
return setType.getDefaultOdaDataTypeCode( nativeTypeCode );
}
/**
* Instantiates a new Filter object for the manifest explorer to apply when
* retrieving a collection of ODA data source extension manifests.
* @return a new Filter object
*/
public static Filter createFilter()
{
return getInstance().new Filter();
}
/**
* Filtering options for the manifest explorer to apply when
* retrieving a collection of ODA data source extension manifests.
*/
public class Filter
{
private boolean m_noDataSetTypes; // extensions with no data set types defined
private boolean m_deprecated; // deprecated extensions
Filter()
{
// do not exclude or filter out any extensions, by default
m_noDataSetTypes = false;
m_deprecated = false;
}
/**
* Specifies whether to exclude extensions with no data set types defined.
* @param exclude true to exclude, false otherwise.
*/
public void setMissingDataSetTypesFilter( boolean exclude )
{
m_noDataSetTypes = exclude;
}
/**
* Specifies whether to exclude deprecated extensions.
* @param exclude true to exclude, false otherwise.
*/
public void setDeprecatedFilter( boolean exclude )
{
m_deprecated = exclude;
}
/**
* Indicates whether to exclude extensions with no data set types defined.
*/
public boolean isMissingDataSetTypesFilterOn()
{
return m_noDataSetTypes;
}
/**
* Indicates whether to exclude deprecated extensions.
*/
public boolean isDeprecatedFilterOn()
{
return m_deprecated;
}
}
}

View File

@@ -0,0 +1,279 @@
/*
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.util.ArrayList;
import java.util.Properties;
import org.eclipse.core.runtime.IConfigurationElement;
/**
* The definition of a property defined by an ODA data source extension or
* its supported data set definitions.
* <br>
* No validation is done on the attribute values;
* it is up to the consumer to process as appropriate.
*/
public class Property
{
private static final String VISIBILITY_LOCK = "lock"; //$NON-NLS-1$
private static final String VISIBILITY_CHANGE = "change"; //$NON-NLS-1$
private static final String VISIBILITY_HIDE = "hide"; //$NON-NLS-1$
private static final String LITERAL_TRUE = "true"; //$NON-NLS-1$
private static final String LITERAL_FALSE = "false"; //$NON-NLS-1$
private static final String NAME_ATTR = "name"; //$NON-NLS-1$
private static final String TYPE_ATTR = "type"; //$NON-NLS-1$
private static final String DEFAULT_VALUE_ATTR = "defaultValue"; //$NON-NLS-1$
private static final String ENCRYPTABLE_ATTR = "isEncryptable"; //$NON-NLS-1$
private static final String CAN_INHERIT_ATTR = "canInherit"; //$NON-NLS-1$
private static final String EMPTY_VALUE_TYPE_ATTR = "allowsEmptyValueAsNull"; //$NON-NLS-1$
private static final String CHOICE_ELEMENT = "choice"; //$NON-NLS-1$
private String m_name;
private String m_displayName;
private String m_groupName;
private String m_groupDisplayName;
private String m_type;
private boolean m_canInherit;
private String m_defaultValue;
private boolean m_isEncryptable;
private PropertyChoice[] m_choices = null;
private boolean m_allowsEmptyValueAsNull;
Property( IConfigurationElement propertyElement )
{
setAttributes( propertyElement, null, null );
}
Property( IConfigurationElement propertyElement,
String groupName, String groupDisplayName )
{
setAttributes( propertyElement, groupName, groupDisplayName );
}
private void setAttributes( IConfigurationElement propertyElement,
String groupName, String groupDisplayName )
{
// no validation is done; up to the consumer to process
m_name = propertyElement.getAttribute( NAME_ATTR );
m_displayName = ManifestExplorer.getElementDisplayName( propertyElement );
m_groupName = groupName;
m_groupDisplayName = groupDisplayName;
m_type = propertyElement.getAttribute( TYPE_ATTR );
if( m_type == null || m_type.length() == 0 ) // assign default
m_type = "string"; //$NON-NLS-1$
m_defaultValue = propertyElement.getAttribute( DEFAULT_VALUE_ATTR );
Boolean boolValue = convertBooleanValue(
propertyElement.getAttribute( ENCRYPTABLE_ATTR ) );
m_isEncryptable = ( boolValue != null ) ? boolValue.booleanValue() : false;
boolValue = convertBooleanValue(
propertyElement.getAttribute( CAN_INHERIT_ATTR ) );
m_canInherit = ( boolValue != null ) ? boolValue.booleanValue() : true;
boolValue = convertBooleanValue(
propertyElement.getAttribute( EMPTY_VALUE_TYPE_ATTR ) );
m_allowsEmptyValueAsNull = ( boolValue != null ) ? boolValue.booleanValue() : true;
// choice elements
IConfigurationElement[] choiceElements =
propertyElement.getChildren( CHOICE_ELEMENT );
int numChoices = choiceElements.length;
if ( numChoices <= 0 )
return; // done
ArrayList choices = new ArrayList( numChoices );
for( int i = 0; i < numChoices; i++ )
{
IConfigurationElement choiceElement = choiceElements[i];
choices.add( new PropertyChoice( choiceElement ) );
}
m_choices = (PropertyChoice[]) choices.toArray( new PropertyChoice[ numChoices ] );
}
private Boolean convertBooleanValue( String value )
{
if ( value == null || value.length() == 0 )
return null;
if ( value.equalsIgnoreCase( LITERAL_TRUE ) ||
value.equalsIgnoreCase( LITERAL_FALSE ) )
return Boolean.valueOf( value );
return null;
}
/**
* Returns the property name.
* @return property name
*/
public String getName()
{
return m_name;
}
/**
* Returns the display name of the extension-defined property.
* Defaults to property name if no display name is specified.
* @return The display name of the property
*/
public String getDisplayName()
{
return m_displayName;
}
/**
* If the property is defined in a group, returns
* the group's name. Returns null for top-level property.
* @return the group name of the property, if applicable.
*/
public String getGroupName()
{
return m_groupName;
}
/**
* If the property is defined in a group, returns
* the group's display name.
* Defaults to group name if no display name is specified.
* Returns null for top-level property.
* @return the group display name of the property, if applicable.
*/
public String getGroupDisplayName()
{
return m_groupDisplayName;
}
/**
* Returns the type of property. See the extension point
* schema for a list of valid type values.
* @return property type.
*/
public String getType()
{
return m_type;
}
/**
* Returns whether the property can inherit from parent.
* Defaults to true if none is specified.
* @return whether the property can inherit.
*/
public boolean canInherit()
{
return m_canInherit;
}
/**
* Returns the default value of the property.
* Could be null value.
* @return property default value.
*/
public String getDefaultValue()
{
return m_defaultValue;
}
/**
* Returns a flag indicating whether this property value should be encrypted
* in the persistent report design file.
* @return 'true' or 'false' value that indicates whether
* the property value should be encrypted.
*/
public boolean isEncryptable()
{
return m_isEncryptable;
}
/**
* Returns a flag that indicates whether an empty value of this property
* can be treated as a null value.
* @return 'true' or 'false' value that indicates whether
* this property value can be treated as a null value.
*/
public boolean allowsEmptyValueAsNull()
{
return m_allowsEmptyValueAsNull;
}
/**
* Returns the selection list of choices for the property value.
* An empty array is returned if no choices are specified.
* @return an array of PropertyChoice instances that
* represent the choice elements defined for the property.
*/
public PropertyChoice[] getChoices()
{
if ( m_choices == null )
{
m_choices = new PropertyChoice[ 0 ];
}
return m_choices;
}
/**
* Indicates whether this property should be visible
* per the definition specified in the properties element.
* @param propertiesVisibility the collection of property visibility
* defined for the element associated with
* this property
* @return true if property is defined to be visible;
* false otherwise
*/
public boolean isVisible( Properties propertiesVisibility )
{
String visibility =
getVisibility( getName(), propertiesVisibility );
if( visibility.equalsIgnoreCase( VISIBILITY_HIDE ) )
return false;
return true;
}
/**
* Indicates whether this property value should be editable,
* per the definition specified in the properties element.
* @param propertiesVisibility the collection of property visibility
* defined for the element associated with
* this property
* @return true if property is defined to be editable;
* false if the property value should be read only.
*/
public boolean isEditable( Properties propertiesVisibility )
{
String visibility =
getVisibility( getName(), propertiesVisibility );
if( visibility.equalsIgnoreCase( VISIBILITY_HIDE ) ||
visibility.equalsIgnoreCase( VISIBILITY_LOCK ) )
return false;
return true;
}
/**
* Finds the property visibility value.
*/
private String getVisibility( String propName,
Properties propertiesVisibility )
{
if( propertiesVisibility == null ||
propertiesVisibility.size() == 0 )
return VISIBILITY_CHANGE; // default
assert( propName != null );
return propertiesVisibility.getProperty(
propName, VISIBILITY_CHANGE );
}
}

View File

@@ -0,0 +1,64 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import org.eclipse.core.runtime.IConfigurationElement;
/**
* A choice of property values for an extension-defined property.
*/
public class PropertyChoice
{
private String m_name;
private String m_displayName;
private String m_value;
PropertyChoice( IConfigurationElement choiceElement )
{
// no validation is done; up to the consumer to process
m_name = choiceElement.getAttribute( "name" ); //$NON-NLS-1$
m_displayName = ManifestExplorer.getElementDisplayName( choiceElement );
m_value = choiceElement.getAttribute( "value" ); //$NON-NLS-1$
}
/**
* Returns the name of the choice element.
* @return the name of the choice
*/
public String getName()
{
return m_name;
}
/**
* Returns the display name of the choice element.
* Defaults to the choice name if no display name is specified.
* @return the display name of the choice
*/
public String getDisplayName()
{
return m_displayName;
}
/**
* Returns the value of this choice of property values.
* @return the value of the choice.
*/
public String getValue()
{
return m_value;
}
}

View File

@@ -0,0 +1,126 @@
/*
*************************************************************************
* Copyright (c) 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.nls.Messages;
/**
* Represents a data source extension manifest's relationship element.
*/
class Relationship
{
static final String ELEMENT_NAME = "relationship"; //$NON-NLS-1$
static final String RELATED_ID_ATTRIBUTE_NAME = "relatedId"; //$NON-NLS-1$
static final String TYPE_ATTRIBUTE_NAME = "type"; //$NON-NLS-1$
// relationship types
static final int TYPE_REPLACED_BY_CODE = 1;
static final String[] sm_typeValues =
{
"none", //$NON-NLS-1$
"replacedBy" //$NON-NLS-1$
};
private int m_type;
private String m_relatedId;
/**
* Instantiates a Relationship object that represents the content
* of the relationship element in the specified parent element.
* @param relationshipParentElement configuration element that may contain
* a relationship element
* @return the relationship object, or null if none is defined or
* has an invalid element
*/
static Relationship createInstance( IConfigurationElement relationshipParentElement )
{
Relationship anInstance = new Relationship();
try
{
anInstance.init( relationshipParentElement );
}
catch( OdaException e )
{
// none or invalid relationship element, ignore and return null
return null;
}
return anInstance;
}
private Relationship()
{
}
private void init( IConfigurationElement parentElement )
throws OdaException
{
if( parentElement == null )
throw new OdaException(); // nothing to initialize
IConfigurationElement[] elements =
parentElement.getChildren( ELEMENT_NAME );
if( elements.length < 1 ) // no relationship element
throw new OdaException();
// expects one element only, use the first element found
IConfigurationElement relationshipElement = elements[0];
m_relatedId = relationshipElement.getAttribute( RELATED_ID_ATTRIBUTE_NAME );
if( m_relatedId == null || m_relatedId.length() == 0 )
throw new OdaException(
Messages.bind( Messages.manifest_NO_ATTRIBUTE_ID_DEFINED,
RELATED_ID_ATTRIBUTE_NAME, ELEMENT_NAME ));
setRelationshipType( relationshipElement.getAttribute( TYPE_ATTRIBUTE_NAME ) );
}
private void setRelationshipType( String typeAttributeValue )
throws OdaException
{
if( typeAttributeValue == null || typeAttributeValue.length() == 0 )
throw new OdaException();
for( int i = 1; i < sm_typeValues.length; i++ )
{
if( typeAttributeValue.equalsIgnoreCase( sm_typeValues[i] ) )
{
m_type = i;
return; // found a match, done with setting type value
}
}
// not a recognized type
throw new OdaException();
}
/**
* Indicates whether this extension is defined to be deprecated with
* a replacedBy relationship type.
*/
boolean isDeprecated()
{
return ( m_type == TYPE_REPLACED_BY_CODE );
}
/**
* Returns the related id.
*/
String getRelatedId()
{
return m_relatedId;
}
}

View File

@@ -0,0 +1,64 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.io.IOException;
import java.net.URL;
/**
* Encapsulates the runtime interface specific configurations
* of an ODA driver that implements a data source extension.
*/
public abstract class RuntimeInterface
{
/**
* Implements C/C++ runtime interface.
*/
public static final int C_TYPE = 0;
/**
* Implements Java runtime interface.
*/
public static final int JAVA_TYPE = 1;
/**
* Returns the interface type of the runtime. Either RuntimeInterface.C_TYPE
* or RuntimeInterface.JAVA_TYPE.
* @return runtime interface type: RuntimeInterface.C_TYPE or
* RuntimeInterface.JAVA_TYPE.
*/
public abstract int getInterfaceType();
/**
* Returns the library location for the current OS platform.
* @return the library location URL.
* @throws IOException if an IO error occurs.
*/
public abstract URL getLibraryLocation() throws IOException;
/**
* Returns the driver file location for the current OS platform.
* @param filename the name of the driver file.
* @return the driver file location URL.
* @throws IOException if an IO error occurs.
*/
public abstract URL getDriverFileLocation( String filename ) throws IOException;
/**
* Returns the list of libraries for the current OS platform.
* @return the list of libraries.
*/
public abstract String[] getLibraries();
}

View File

@@ -0,0 +1,141 @@
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.datatools.connectivity.oda.util.manifest;
import java.util.HashMap;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.util.logging.Level;
/**
* Configuration of the driver's trace logging settings
* for a data source extension.
*/
public class TraceLogging
{
private int m_logLevel;
private String m_logFileNamePrefix;
private String m_logDirectory;
private String m_logFormatterClass;
private static HashMap sm_logLevelLiterals = null;
TraceLogging( IConfigurationElement traceLogging, String dataSourceElementId ) throws OdaException
{
String logLevelString = traceLogging.getAttribute( "logLevel" ); //$NON-NLS-1$
m_logLevel = toLogLevelNumber( logLevelString );
m_logFileNamePrefix = traceLogging.getAttribute( "logFileNamePrefix" ); //$NON-NLS-1$
m_logDirectory = traceLogging.getAttribute( "logDirectory" ); //$NON-NLS-1$
m_logFormatterClass = traceLogging.getAttribute( "logFormatterClass" ); //$NON-NLS-1$
}
/**
* Returns the value for the driver's log level,
* as defined in the ODA data source extension point schema.
* @return the log level.
*/
public int getLogLevel()
{
return m_logLevel;
}
/**
* Returns the string prefix for driver's log file names.
* @return the log file name prefix.
*/
public String getLogFileNamePrefix()
{
return m_logFileNamePrefix;
}
/**
* Returns the optional directory for log files.
* @return the log directory, or null if a log directory was not specified.
*/
public String getLogDirectory()
{
return m_logDirectory;
}
/**
* Returns the full class name of a concrete log formatter implementation,
* suitable for use by the driver-specific logging utility.
* @return the fully qualified class name for the log formatter class, or
* null if the class was not specified.
*/
public String getLogFormatterClass()
{
return m_logFormatterClass;
}
/**
* Converts a string that represents a log level name or
* numeric value to a number.
* Returns the default WARNING log level if given string value is null or
* not valid.
* @param logLevelName A string that represents a log level name or numeric value.
* @return A log level number.
*/
static public int toLogLevelNumber( String logLevelName )
{
int defaultLogLevel = Level.WARNING;
if( logLevelName == null || logLevelName.length() == 0 )
return defaultLogLevel;
// first check if given string value is a pre-defined log level name or number
Integer mappedLevel = (Integer) getLogLevelLiterals().get( logLevelName );
if( mappedLevel != null ) // found a match
return mappedLevel.intValue();
// could be numeric string value, try to convert to number
try
{
int logLevel = Short.parseShort( logLevelName );
if( logLevel > Level.SEVERE )
logLevel = Level.OFF;
return logLevel;
}
catch( NumberFormatException ex )
{
return defaultLogLevel;
}
}
static private HashMap getLogLevelLiterals()
{
if( sm_logLevelLiterals != null )
return sm_logLevelLiterals;
sm_logLevelLiterals = new HashMap( 18, 1 );
sm_logLevelLiterals.put( "SEVERE", new Integer( Level.SEVERE ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "1000", new Integer( Level.SEVERE ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "WARNING", new Integer( Level.WARNING ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "900", new Integer( Level.WARNING ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "INFO", new Integer( Level.INFO ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "800", new Integer( Level.INFO ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "CONFIG", new Integer( Level.CONFIG ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "700", new Integer( Level.CONFIG ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "FINE", new Integer( Level.FINE ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "500", new Integer( Level.FINE ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "FINER", new Integer( Level.FINER ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "400", new Integer( Level.FINER ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "FINEST", new Integer( Level.FINEST ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "300", new Integer( Level.FINEST ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "ALL", new Integer( Level.ALL ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "0", new Integer( Level.ALL ) ); //$NON-NLS-1$
sm_logLevelLiterals.put( "OFF", new Integer( Level.OFF ) ); //$NON-NLS-1$
return sm_logLevelLiterals;
}
}

View File

@@ -0,0 +1,43 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="white">
[<b>Provisional</b>] Provides a utility component for accessing the content of an
ODA data source extension's manifest.
<br>
It can be used by an ODA consumer and/or a data provider
to discover the plug-in extension configuration.
<p>
The utility's initial entry point is the singleton <code>ManifestExplorer</code>.
It provides the service to explore all the static
ODA data source extensions, and access to each
extension's configuration information specified
in its plug-in manifest file.
<br>
The content of such ODA data source extension configuration
is encapsulated in an <code>ExtensionManifest</code> and its
associated objects.
<!-- Put @see and @since tags down here. -->
@since 2.0
</body>
</html>

View File

@@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
*************************************************************************
* Copyright (c) 2004, 2006 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="white">
[<b>Provisional</b>] Provides utility components for the development of Open Data Access (ODA)
consumers and providers. This package includes functionalities that
are commonly needed by both ODA providers and consumers, such as
accessing the content of an ODA data source extension's manifest,
and a string substitution utility.
<!-- Put @see and @since tags down here. -->
@since 1.0
</body>
</html>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,5 @@
bin
download
*.jar
*.zip
utestreports

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.datatools.enablement.oda.xml</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DTP ODA-XML Driver
Bundle-SymbolicName: org.eclipse.datatools.enablement.oda.xml;singleton:=true
Bundle-Version: 1.0.0.200610021
Bundle-ClassPath: .
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
Require-Bundle: org.eclipse.datatools.connectivity.oda;bundle-version="3.0.1";visibility:=reexport,
org.eclipse.jface,
org.apache.xerces,
org.eclipse.xsd;bundle-version="2.6.0",
org.talend.libraries.apache;bundle-version="1.0.0"
Eclipse-LazyStart: true
Export-Package: org.eclipse.datatools.enablement.oda.xml;x-internal:=false,
org.eclipse.datatools.enablement.oda.xml.i18n;x-friends:="org.eclipse.birt.report.data.oda.xml",
org.eclipse.datatools.enablement.oda.xml.impl;x-friends:="org.eclipse.birt.report.data.oda.xml,org.eclipse.datatools.enablement.oda.xml.ui,org.eclipse.datatools.enablement.oda.xml.tests",
org.eclipse.datatools.enablement.oda.xml.util;x-friends:="org.eclipse.birt.report.data.oda.xml,org.eclipse.datatools.enablement.oda.xml.ui,org.eclipse.datatools.enablement.oda.xml.tests",
org.eclipse.datatools.enablement.oda.xml.util.date;x-friends:="org.eclipse.birt.report.data.oda.xml,org.eclipse.datatools.enablement.oda.xml.tests",
org.eclipse.datatools.enablement.oda.xml.util.ui;x-friends:="org.eclipse.birt.report.data.oda.xml,org.eclipse.datatools.enablement.oda.xml.ui,org.eclipse.datatools.enablement.oda.xml.tests"

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>June 28, 2006</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
<h3>Third Party Content</h3>
<p>The Content includes items that have been sourced from third parties as set out below. If you
did not receive this Content directly from the Eclipse Foundation, the following is provided
for informational purposes only, and you should look to the Redistributor&rsquo;s license for
terms and conditions of use.</p>
<h4> Xerces2 Java Parser 2.6.2</strong></h4>
The plug-in is accompanied by software developed by the Apache Software Foundation at
<a href="http://xerces.apache.org/xerces2-j/">http://xerces.apache.org/xerces2-j/</a>.
The binary code of Xerces2 Java Parser 2.6.2 (&quot;Xerces&quot;) is included with the plug-in without modification
in the following files:</p>
<ul>
<li>lib/resolver.jar</li>
<li>lib/xercesImpl.jar</li>
<li>lib/xml-apis.jar</li>
</ul>
<p>Your use of Xerces is subject to the terms and conditions of the Apache License, Version 2.0 (&quot;Apache License&quot;).
A copy of the Apache License can be found in <a href="about_files/LICENSE-2.0.txt">about_files/LICENSE-2.0.txt</a>
and is also available at <a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>.</p>
</body>
</html>

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.

View File

@@ -0,0 +1,25 @@
#
#*************************************************************************
# Copyright (c) 2004, 2006 Actuate Corporation.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Actuate Corporation - initial API and implementation
#
#*************************************************************************
#
# $Id: build.properties,v 1.2 2006/09/30 01:17:57 lchan Exp $
#
bin.includes = about.html,\
plugin.xml,\
META-INF/,\
lib/,\
.,\
plugin.properties,\
about_files/
download.dir = ./download/
source.. = src/
output.. = bin/

View File

@@ -0,0 +1,6 @@
fix bug 0003796: tfileinputXML choose wrong DTD-Path
see http://www.talendforge.org/bugs/view.php?id=3796
modify SchemaPopulationUtil.getSchemaTree and SaxParser
use method public void parse (String systemId) in XMLReader instead of public void parse (InputSource input)
because it cannot load the dtd file with relative path

View File

@@ -0,0 +1,20 @@
###############################################################################
# Copyright (c) 2004,2005 Actuate Corporation.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Actuate Corporation - initial API and implementation
###############################################################################
###############################################################################
# NLS String
###############################################################################
datasource.name=DTP XML Data Source
dataset.name=DTP XML Data Set
datasource.property.xmlFile=XML Data Source File
datasource.property.schemaFile=XML Schema File

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension
point="org.eclipse.datatools.connectivity.oda.dataSource">
<dataSet
defaultDisplayName="%dataset.name"
id="org.eclipse.datatools.enablement.oda.xml.dataSet">
<properties>
<propertyGroup
defaultDisplayName="Dataset Properties"
name="dateset properties">
<property
type="string"
defaultDisplayName="max row"
canInherit="true"
name="MAX_ROW"/>
<property
type="string"
defaultDisplayName="xml file"
canInherit="true"
name="XML_FILE"/>
</propertyGroup>
<propertyVisibility name="queryText" visibility="hide"/>
<propertyVisibility name="MAX_ROW" visibility="hide"/>
<propertyVisibility name="XML_FILE" visibility="hide"/>
</properties>
<dataTypeMapping
nativeDataType="BIT"
nativeDataTypeCode="-7"
odaScalarDataType="Integer"/>
<dataTypeMapping
nativeDataType="TINYINT"
nativeDataTypeCode="-6"
odaScalarDataType="Integer"/>
<dataTypeMapping
nativeDataType="SMALLINT"
nativeDataTypeCode="5"
odaScalarDataType="Integer"/>
<dataTypeMapping
nativeDataType="INTEGER"
nativeDataTypeCode="4"
odaScalarDataType="Integer"/>
<dataTypeMapping
nativeDataType="BIGINT"
nativeDataTypeCode="-5"
odaScalarDataType="Decimal"/>
<dataTypeMapping
nativeDataType="FLOAT"
nativeDataTypeCode="6"
odaScalarDataType="Double"/>
<dataTypeMapping
nativeDataType="REAL"
nativeDataTypeCode="7"
odaScalarDataType="Double"/>
<dataTypeMapping
nativeDataType="DOUBLE"
nativeDataTypeCode="8"
odaScalarDataType="Double"/>
<dataTypeMapping
nativeDataType="NUMERIC"
nativeDataTypeCode="2"
odaScalarDataType="Decimal"/>
<dataTypeMapping
nativeDataType="DECIMAL"
nativeDataTypeCode="3"
odaScalarDataType="Decimal"/>
<dataTypeMapping
nativeDataType="CHAR"
nativeDataTypeCode="1"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="VARCHAR"
nativeDataTypeCode="12"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="LONGVARCHAR"
nativeDataTypeCode="-1"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="DATE"
nativeDataTypeCode="91"
odaScalarDataType="Date"/>
<dataTypeMapping
nativeDataType="TIME"
nativeDataTypeCode="92"
odaScalarDataType="Time"/>
<dataTypeMapping
nativeDataType="TIMESTAMP"
nativeDataTypeCode="93"
odaScalarDataType="Timestamp"/>
<dataTypeMapping
nativeDataType="BINARY"
nativeDataTypeCode="-2"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="VARBINARY"
nativeDataTypeCode="-3"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="LONGVARBINARY"
nativeDataTypeCode="-4"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="BOOLEAN"
nativeDataTypeCode="16"
odaScalarDataType="Integer"/>
</dataSet>
<dataSource
odaVersion="3.0.0"
driverClass="org.eclipse.datatools.enablement.oda.xml.impl.Driver"
defaultDisplayName="%datasource.name"
id="org.eclipse.datatools.enablement.oda.xml"
setThreadContextClassLoader="false">
<properties>
<propertyGroup
defaultDisplayName="Connection Properties"
name="connectionProperties">
<property
type="string"
defaultDisplayName="%datasource.property.xmlFile"
canInherit="true"
name="FILELIST"/>
<property
type="string"
defaultDisplayName="%datasource.property.schemaFile"
canInherit="true"
name="SCHEMAFILELIST"/>
</propertyGroup>
</properties>
</dataSource>
</extension>
</plugin>

View File

@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
/**
* This class hosts all constants used in xml driver.
*/
public final class Constants
{
private Constants()
{}
public static final int DATA_SOURCE_MAJOR_VERSION = 1;
public static final int DATA_SOURCE_MINOR_VERSION = 0;
public static final String DATA_SOURCE_PRODUCT_NAME = Messages.getString("Constants.DriverName");
public static final int CACHED_RESULT_SET_LENGTH = 10000;
public static final String APPCONTEXT_INPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.inputStream";
public static final String APPCONTEXT_CLOSEINPUTSTREAM = "org.eclipse.datatools.enablement.oda.xml.closeInputStream";
//The connection proporty that is used to give the relation information string
//to the driver.
public static final String CONST_PROP_RELATIONINFORMATION = "RELATIONINFORMATION";
//The connection property that gives the file name(s).Currently we only
//support single file.
public static final String CONST_PROP_FILELIST = "FILELIST";
}

View File

@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.i18n;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
*
*/
public class Messages
{
private static final String BUNDLE_NAME = "org.eclipse.datatools.enablement.oda.xml.i18n.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private Messages( )
{
}
public static String getString( String key )
{
// TODO Auto-generated method stub
try
{
return RESOURCE_BUNDLE.getString( key );
}
catch ( MissingResourceException e )
{
return '!' + key + '!';
}
}
}

View File

@@ -0,0 +1,10 @@
Connection.PropertiesMissing=Some connection properties are missing.
Connection.InvalidAppContext=Invalid AppContext.
Constants.DriverName=DTP ODA XML Driver
ResultSet.ResultSetClosed=ResultSet is closed.
Query.QueryHasNotBeenPrepared=The query has not been prepared yet.
Query.ResultSetClosed=ResultSet is closed.
Query.InvalidQueryText=The query text is invalid.
RelationInformation.InputStringCannotBeNull=The input string cannot be null or blank.
RelationInformation.InvalidDataTypeName=The provided data type name is invalid.
DateUtil.ConvertFails=Convert to date fails. Source:

View File

@@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
[<b>Non-API</b>] DTP XML Driver - an ODA run-time extension.
<p>
Note: <i>The implementation classes are <b>not</b> public APIs.
<br>Backward compatibility support in future releases is not guaranteed.</i>
<h2>Package Specification</h2>
The DTP ODA XML driver is a driver that can be used to parse XML files.
This internal package is used for internationalization purpose.
</body>
</html>

View File

@@ -0,0 +1,175 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.Constants;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.util.XMLDataInputStreamCreator;
/**
* This class is used to build an XML data source connection.
*/
public class Connection implements IConnection
{
//The file which server as data source.
private XMLDataInputStreamCreator is;
//The boolean indicate whether the connection is open.
private boolean isOpen;
private Map appContext;
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IConnection#open(java.util.Properties)
*/
public void open( Properties connProperties )
throws org.eclipse.datatools.connectivity.oda.OdaException
{
if( isOpen == true )
return;
String file = (String) connProperties.get( Constants.CONST_PROP_FILELIST );
if ( appContext != null
&& appContext.get( Constants.APPCONTEXT_INPUTSTREAM ) != null
&& appContext.get( Constants.APPCONTEXT_INPUTSTREAM ) instanceof InputStream )
is = XMLDataInputStreamCreator.getCreator( (InputStream) appContext.get( Constants.APPCONTEXT_INPUTSTREAM ) );
else if ( file != null )
is = XMLDataInputStreamCreator.getCreator( file );
else
throw new OdaException( Messages.getString( "Connection.PropertiesMissing" ) );
isOpen = true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#close()
*/
public void close( )
throws org.eclipse.datatools.connectivity.oda.OdaException
{
isOpen = false;
try
{
if(appContext != null && appContext.get(Constants.APPCONTEXT_INPUTSTREAM)!= null)
{
Object closeInputStream = appContext.get(Constants.APPCONTEXT_CLOSEINPUTSTREAM);
if( closeInputStream != null )
{
if( closeInputStream.toString().equalsIgnoreCase("true"))
closeInputStreamFromAppContext( );
}
}
}
catch ( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
this.appContext = null;
}
/**
* @throws IOException
*/
private void closeInputStreamFromAppContext( ) throws IOException
{
((InputStream) appContext.get( Constants.APPCONTEXT_INPUTSTREAM )).close( );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#isOpen()
*/
public boolean isOpen( )
throws OdaException
{
return isOpen;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#setAppContext(java.lang.Object)
*/
public void setAppContext( Object context ) throws OdaException
{
if( !( context instanceof Map ) )
throw new OdaException( Messages.getString("Connection.InvalidAppContext") );
this.appContext = (Map)context;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#getMetaData(java.lang.String)
*/
public IDataSetMetaData getMetaData( String dataSetType )
throws OdaException
{
return new DataSetMetaData( this );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#newQuery(java.lang.String)
*/
public IQuery newQuery( String dataSetType ) throws OdaException
{
return new Query( this.is );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#getMaxQueries()
*/
public int getMaxQueries( ) throws OdaException
{
return 0;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#commit()
*/
public void commit( ) throws OdaException
{
throw new UnsupportedOperationException( );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.connectivity.oda.IConnection#rollback()
*/
public void rollback( ) throws OdaException
{
throw new UnsupportedOperationException( );
}
}

View File

@@ -0,0 +1,164 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.Constants;
/**
* This class descript the meta data information of xml driver.
*
*/
public class DataSetMetaData implements IDataSetMetaData
{
//
private IConnection connection = null;
/**
*
* @param connection
*/
public DataSetMetaData( Connection connection )
{
this.connection = connection;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getConnection()
*/
public IConnection getConnection( ) throws OdaException
{
return this.connection;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceObjects(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
public IResultSet getDataSourceObjects( String catalog, String schema,
String object, String version ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceMajorVersion()
*/
public int getDataSourceMajorVersion( ) throws OdaException
{
return Constants.DATA_SOURCE_MAJOR_VERSION;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceMinorVersion()
*/
public int getDataSourceMinorVersion( ) throws OdaException
{
return Constants.DATA_SOURCE_MINOR_VERSION;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceProductName()
*/
public String getDataSourceProductName( ) throws OdaException
{
return Constants.DATA_SOURCE_PRODUCT_NAME;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getDataSourceProductVersion()
*/
public String getDataSourceProductVersion( ) throws OdaException
{
return String.valueOf(this.getDataSourceMajorVersion()) + "." +
String.valueOf(this.getDataSourceMinorVersion());
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getSQLStateType()
*/
public int getSQLStateType( ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsMultipleResultSets()
*/
public boolean supportsMultipleResultSets( ) throws OdaException
{
return false;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsMultipleOpenResults()
*/
public boolean supportsMultipleOpenResults( ) throws OdaException
{
return false;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsNamedResultSets()
*/
public boolean supportsNamedResultSets( ) throws OdaException
{
return false;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsNamedParameters()
*/
public boolean supportsNamedParameters( ) throws OdaException
{
return false;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsInParameters()
*/
public boolean supportsInParameters( ) throws OdaException
{
return false;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#supportsOutParameters()
*/
public boolean supportsOutParameters( ) throws OdaException
{
return false;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDataSetMetaData#getSortMode()
*/
public int getSortMode( )
{
throw new UnsupportedOperationException ();
}
}

View File

@@ -0,0 +1,108 @@
/*******************************************************************************
* Copyright (c) 2004 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import java.sql.Types;
import java.util.HashMap;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* This class hosts the information of data types that are supported by flat
* file driver
*/
public final class DataTypes
{
//
public static final int INT = Types.INTEGER;
public static final int DOUBLE = Types.DOUBLE;
public static final int STRING = Types.VARCHAR;
public static final int DATE = Types.DATE;
public static final int TIME = Types.TIME;
public static final int TIMESTAMP = Types.TIMESTAMP;
public static final int BLOB = Types.BLOB;
public static final int BIGDECIMAL = Types.NUMERIC;
//
private static HashMap typeStringIntPair = new HashMap( );
private static HashMap typeIntStringPair = new HashMap( );
static
{
typeStringIntPair.put( "Int", new Integer( INT ) ); //$NON-NLS-1$
typeStringIntPair.put( "Double", new Integer( DOUBLE ) ); //$NON-NLS-1$
typeStringIntPair.put( "String", new Integer( STRING ) ); //$NON-NLS-1$
typeStringIntPair.put( "Date", new Integer( DATE ) ); //$NON-NLS-1$
typeStringIntPair.put( "Time", new Integer( TIME ) ); //$NON-NLS-1$
typeStringIntPair.put( "Timestamp", new Integer( TIMESTAMP ) ); //$NON-NLS-1$
typeStringIntPair.put( "Bigdecimal", new Integer( BIGDECIMAL ) ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( INT ),"Int" ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( DOUBLE ),"Double" ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( STRING ),"String" ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( DATE ),"Date" ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( TIME ),"Time" ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( TIMESTAMP ),"Timestamp" ); //$NON-NLS-1$
typeIntStringPair.put( new Integer( BIGDECIMAL ),"Bigdecimal" ); //$NON-NLS-1$
}
/**
* Return the int which stands for the type specified by input argument
*
* @param typeName
* the String value of a Type
* @return the int which stands for the type specified by input typeName
* @throws OdaException
* Once the input arguement is not a valid type name
*/
public static int getType( String typeName ) throws OdaException
{
String preparedTypeName = typeName == null ? "":typeName.trim( );
if ( typeStringIntPair.containsKey( preparedTypeName ) )
return ( (Integer) typeStringIntPair.get( preparedTypeName ) ).intValue( );
throw new OdaException( ); //$NON-NLS-1$
}
/**
* Return the String which stands for the type specified by input argument
*
* @param typeName
* the int value of a Type
* @return the String which stands for the type specified by input typeName
* @throws OdaException
* Once the input arguement is not a valid type name
*/
public static String getTypeString( int type ) throws OdaException
{
Integer typeInteger = new Integer( type );
if ( typeIntStringPair.containsKey( typeInteger ) )
return typeIntStringPair.get( typeInteger ).toString();
throw new OdaException( ); //$NON-NLS-1$
}
/**
* Evalute whether an input String is a valid type that is supported by flat
* file driver
*
* @param typeName
* @return
*/
public static boolean isValidType( String typeName )
{
return typeStringIntPair.containsKey( typeName.trim( ) );
}
private DataTypes( )
{
}
}

View File

@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import org.eclipse.datatools.connectivity.oda.IConnection;
import org.eclipse.datatools.connectivity.oda.IDriver;
import org.eclipse.datatools.connectivity.oda.LogConfiguration;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* This class implements IDriver interface.
*/
public class Driver implements IDriver
{
/**
*
*/
public IConnection getConnection( String dataSourceId ) throws OdaException
{
return new Connection();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDriver#setLogConfiguration(org.eclipse.datatools.connectivity.oda.LogConfiguration)
*/
public void setLogConfiguration( LogConfiguration logConfig )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDriver#getMaxConnections()
*/
public int getMaxConnections( ) throws OdaException
{
// TODO Auto-generated method stub
return 0;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IDriver#setAppContext(java.lang.Object)
*/
public void setAppContext( Object context ) throws OdaException
{
throw new UnsupportedOperationException ();
}
}

View File

@@ -0,0 +1,355 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
import org.eclipse.datatools.connectivity.oda.IQuery;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.connectivity.oda.SortSpec;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.util.RelationInformation;
import org.eclipse.datatools.enablement.oda.xml.util.XMLDataInputStreamCreator;
/**
* This class implements IQuery interface.
*/
public class Query implements IQuery
{
public static final String QUERYTEXT_TABLE_NAME_DEFN_DELIMITER = "#-TNAME-#";
//The RelationInformation
private RelationInformation relationInformation;
//The name of the XML table that will be prepared
private String tableName;
//The max rows of result set created by this query that might returned
private int maxRows;
// indicate whether the result set has been closed.
private boolean isClosed;
private XMLDataInputStreamCreator xmlDataInputStreamCreator;
/**
*
* @param file
* @param ri
*/
public Query( XMLDataInputStreamCreator creator )
{
tableName = null;
maxRows = 0;
isClosed = false;
xmlDataInputStreamCreator = creator;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#prepare(java.lang.String)
*/
public void prepare( String queryText ) throws OdaException
{
testClosed();
if ( queryText == null )
throw new org.eclipse.datatools.connectivity.oda.OdaException( Messages.getString("Query.InvalidQueryText") ); //$NON-NLS-1$
String[] temp = queryText.split(QUERYTEXT_TABLE_NAME_DEFN_DELIMITER);
assert temp.length == 2;
if ( temp.length != 2 )
throw new org.eclipse.datatools.connectivity.oda.OdaException( Messages.getString("Query.InvalidQueryText") ); //$NON-NLS-1$
this.tableName = temp[0];
this.relationInformation = new RelationInformation( temp[1] );
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setProperty(java.lang.String, java.lang.String)
*/
public void setProperty( String name, String value ) throws OdaException
{
//Do nothing.
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#close()
*/
public void close( ) throws OdaException
{
this.isClosed = true;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setMaxRows(int)
*/
public void setMaxRows( int max ) throws OdaException
{
testClosed();
this.maxRows = max > 0 ? max:0;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#getMaxRows()
*/
public int getMaxRows( ) throws OdaException
{
testClosed();
return this.maxRows;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#getMetaData()
*/
public IResultSetMetaData getMetaData( ) throws OdaException
{
testClosed();
return new ResultSetMetaData( relationInformation, tableName);
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#executeQuery()
*/
public IResultSet executeQuery( ) throws OdaException
{
testClosed( );
if ( this.tableName == null || this.tableName.trim( ).length( ) == 0 )
throw new OdaException( Messages.getString( "Query.QueryHasNotBeenPrepared" ) ); //$NON-NLS-1$
ResultSet result = new ResultSet( xmlDataInputStreamCreator.createXMLDataInputStream( ),
relationInformation,
tableName,
this.getMaxRows( ));
return result;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#clearInParameters()
*/
public void clearInParameters( ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setInt(java.lang.String, int)
*/
public void setInt( String parameterName, int value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setInt(int, int)
*/
public void setInt( int parameterId, int value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDouble(java.lang.String, double)
*/
public void setDouble( String parameterName, double value )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDouble(int, double)
*/
public void setDouble( int parameterId, double value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setBigDecimal(java.lang.String, java.math.BigDecimal)
*/
public void setBigDecimal( String parameterName, BigDecimal value )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setBigDecimal(int, java.math.BigDecimal)
*/
public void setBigDecimal( int parameterId, BigDecimal value )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setString(java.lang.String, java.lang.String)
*/
public void setString( String parameterName, String value )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setString(int, java.lang.String)
*/
public void setString( int parameterId, String value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDate(java.lang.String, java.sql.Date)
*/
public void setDate( String parameterName, Date value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setDate(int, java.sql.Date)
*/
public void setDate( int parameterId, Date value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTime(java.lang.String, java.sql.Time)
*/
public void setTime( String parameterName, Time value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTime(int, java.sql.Time)
*/
public void setTime( int parameterId, Time value ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTimestamp(java.lang.String, java.sql.Timestamp)
*/
public void setTimestamp( String parameterName, Timestamp value )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setTimestamp(int, java.sql.Timestamp)
*/
public void setTimestamp( int parameterId, Timestamp value )
throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#findInParameter(java.lang.String)
*/
public int findInParameter( String parameterName ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#getParameterMetaData()
*/
public IParameterMetaData getParameterMetaData( ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setSortSpec(org.eclipse.datatools.connectivity.oda.SortSpec)
*/
public void setSortSpec( SortSpec sortBy ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#getSortSpec()
*/
public SortSpec getSortSpec( ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/**
* Get the RelationInformation of this Query.
* @return
*/
RelationInformation getRelationInformation()
{
return this.relationInformation;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IQuery#setAppContext(java.lang.Object)
*/
public void setAppContext( Object context ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/**
* If the result set is closed then throw an OdaException. This method is invoked
* before an method defined in IResultSet is called.
*
* @throws OdaException
*/
private void testClosed() throws OdaException
{
if( isClosed )
throw new OdaException( Messages.getString("Query.ResultSetClosed")); //$NON-NLS-1$
}
}

View File

@@ -0,0 +1,526 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.util.RelationInformation;
import org.eclipse.datatools.enablement.oda.xml.util.SaxParserConsumer;
import org.eclipse.datatools.enablement.oda.xml.util.XMLDataInputStream;
import org.eclipse.datatools.enablement.oda.xml.util.date.DateUtil;
import org.eclipse.datatools.connectivity.oda.IBlob;
import org.eclipse.datatools.connectivity.oda.IClob;
import org.eclipse.datatools.connectivity.oda.IResultSet;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* This class implement IResultSet class
*/
public class ResultSet implements IResultSet
{
//The ResultSetMetaData of this resultSet.
private ResultSetMetaData rsMetaData;
//the max number of rows can be fetched from this result set.
private int maxRows;
//indicate whether the last getX() returns null.
private boolean wasNull;
//indicate whether the result set has been closed.
private boolean isClosed;
//The ISaxParserConsumer class used to help populating the data.
private SaxParserConsumer spConsumer;
/**
*
* @param fileName
* @param ri
* @param tableName
* @throws OdaException
*/
public ResultSet( XMLDataInputStream is, RelationInformation ri, String tableName, int maxRows )
throws OdaException
{
this.rsMetaData = new ResultSetMetaData( ri, tableName );
this.maxRows = maxRows;
isClosed = false;
spConsumer = new SaxParserConsumer( this, ri, is, tableName );
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getMetaData()
*/
public IResultSetMetaData getMetaData( ) throws OdaException
{
testClosed();
return rsMetaData;
}
/**
* If the result set is closed then throw an OdaException. This method is invoked
* before an method defined in IResultSet is called.
*
* @throws OdaException
*/
private void testClosed() throws OdaException
{
if( isClosed )
throw new OdaException( Messages.getString("ResultSet.ResultSetClosed")); //$NON-NLS-1$
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#close()
*/
public void close( ) throws OdaException
{
this.spConsumer.close();
this.rsMetaData = null;
this.isClosed = true;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#setMaxRows(int)
*/
public void setMaxRows( int max ) throws OdaException
{
testClosed();
this.maxRows = max;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#next()
*/
public boolean next( ) throws OdaException
{
testClosed();
//If the row number exceeds the defined maxRows then return false;
if ( spConsumer.getCurrentRowNo() >= maxRows && maxRows != 0 )
{
return false;
}
return spConsumer.next();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getRow()
*/
public int getRow( ) throws OdaException
{
testClosed();
return spConsumer.getCurrentRowNo();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getString(int)
*/
public String getString( int index ) throws OdaException
{
testClosed();
String result = spConsumer.getResultSet()[getRowPosition( )][getColumnPosition( index )];
this.wasNull = result == null ? true : false;
return result;
}
/**
* Transform 1-based column index to 0-based column position in the array.
* @param index
* @return
*/
private int getColumnPosition( int index )
{
return index - 1;
}
/**
* Transform the 1-based row number to 0-based row position in the array
* @return
*/
private int getRowPosition( )
{
return spConsumer.getRowPosition();
}
/**
* Return the index of a column
*
* @param columnName
* @return
* @throws OdaException
*/
private int getColumnIndex( String columnName ) throws OdaException
{
for ( int i = 1; i <= rsMetaData.getColumnCount( ); i++ )
{
if ( rsMetaData.getColumnName( i ).equals( columnName ) )
return i;
}
throw new OdaException( );
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getString(java.lang.String)
*/
public String getString( String name ) throws OdaException
{
testClosed();
return this.getString(this.getColumnIndex( name));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getInt(int)
*/
public int getInt( int index ) throws OdaException
{
return stringToInt ( getString(index) );
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getInt(java.lang.String)
*/
public int getInt( String name ) throws OdaException
{
return stringToInt( getString( name));
}
/**
* Transform a String value to an int value.
*
* @param stringValue String value
* @return Corresponding int value
* @throws OdaException
*/
private int stringToInt( String stringValue ) throws OdaException
{
testClosed();
if( stringValue != null )
{
try
{
return new Integer( stringValue ).intValue();
}
catch( NumberFormatException e )
{
this.wasNull = true;
}
}
return 0;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDouble(int)
*/
public double getDouble( int index ) throws OdaException
{
return stringToDouble( getString(index));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDouble(java.lang.String)
*/
public double getDouble( String name ) throws OdaException
{
return stringToDouble( getString( name));
}
/**
* Transform a String value to a double value
*
* @param stringValue String value
* @return Corresponding double value
* @throws OdaException
*/
private double stringToDouble( String stringValue ) throws OdaException
{
testClosed();
if( stringValue != null )
{
try
{
return new Double( stringValue ).doubleValue();
}
catch( NumberFormatException e )
{
this.wasNull = true;
}
}
return 0;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBigDecimal(int)
*/
public BigDecimal getBigDecimal( int index ) throws OdaException
{
return stringToBigDecimal( getString( index ));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBigDecimal(java.lang.String)
*/
public BigDecimal getBigDecimal( String name ) throws OdaException
{
return stringToBigDecimal( getString( name ));
}
/**
* Transform a String value to a big decimal value
*
* @param stringValue String value
* @return Corresponding BigDecimal value
* @throws OdaException
*/
private BigDecimal stringToBigDecimal( String stringValue ) throws OdaException
{
testClosed( );
if( stringValue != null )
{
try
{
return new BigDecimal( stringValue );
}
catch( NumberFormatException e )
{
this.wasNull = true;
}
}
return null;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDate(int)
*/
public Date getDate( int index ) throws OdaException
{
return stringToDate( getString( index ));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getDate(java.lang.String)
*/
public Date getDate( String columnName ) throws OdaException
{
return stringToDate( getString( columnName ) );
}
/**
* Transform a String value to a date value
*
* @param stringValue String value
* @return Corresponding date value
* @throws OdaException
*/
private Date stringToDate( String stringValue ) throws OdaException
{
testClosed();
if ( stringValue != null )
{
try
{
java.util.Date date = DateUtil.toDate( stringValue );
return new Date( date.getTime( ) );
}
catch ( OdaException oe )
{
this.wasNull = true;
return null;
}
}
return null;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTime(int)
*/
public Time getTime( int index ) throws OdaException
{
return stringToTime( this.getString( index ));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTime(java.lang.String)
*/
public Time getTime( String columnName ) throws OdaException
{
return stringToTime( this.getString( columnName ));
}
/**
* Transform a String value to a Time value
* @param stringValue String value
* @return Corresponding Time value
* @throws OdaException
*/
private Time stringToTime( String stringValue ) throws OdaException
{
testClosed();
if ( stringValue != null )
{
try
{
java.util.Date date = DateUtil.toDate( stringValue );
return new Time( date.getTime( ) );
}
catch ( OdaException oe )
{
this.wasNull = true;
return null;
}
}
this.wasNull = true;
return null;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTimestamp(int)
*/
public Timestamp getTimestamp( int index ) throws OdaException
{
return stringToTimestamp( this.getString( index ) );
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getTimestamp(java.lang.String)
*/
public Timestamp getTimestamp( String columnName ) throws OdaException
{
return stringToTimestamp( this.getString( columnName) );
}
/**
* Transform a String value to a Timestamp value
* @param stringValue String value
* @return Corresponding Timestamp value
* @throws OdaException
*/
private Timestamp stringToTimestamp( String stringValue ) throws OdaException
{
testClosed();
if( stringValue != null )
{
try
{
stringValue = stringValue.replaceAll("\\QT\\E"," ").split("\\QZ\\E")[0];
return Timestamp.valueOf( stringValue );
}
catch( IllegalArgumentException e )
{
try{
long timeMills = new Long(stringValue).longValue();
return new Timestamp( timeMills );
}catch ( NumberFormatException e1)
{
try
{
java.util.Date date = DateUtil.toDate( stringValue );
Timestamp timeStamp = new Timestamp( date.getTime( ) );
return timeStamp;
}
catch ( OdaException oe )
{
this.wasNull = true;
return null;
}
}
}
}
this.wasNull = true;
return null;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#wasNull()
*/
public boolean wasNull( ) throws OdaException
{
testClosed();
return this.wasNull;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#findColumn(java.lang.String)
*/
public int findColumn( String columnName ) throws OdaException
{
testClosed();
return this.getColumnIndex( columnName );
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBlob(int)
*/
public IBlob getBlob( int index ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getBlob(java.lang.String)
*/
public IBlob getBlob( String columnName ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getClob(int)
*/
public IClob getClob( int index ) throws OdaException
{
throw new UnsupportedOperationException ();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSet#getClob(java.lang.String)
*/
public IClob getClob( String columnName ) throws OdaException
{
throw new UnsupportedOperationException ();
}
}

View File

@@ -0,0 +1,134 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.impl;
import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.util.RelationInformation;
/**
* This class describe the information of certain ResultSet.
*/
public class ResultSetMetaData implements IResultSetMetaData
{
//Column Names
private String[] columnNames;
private RelationInformation ri;
//Table Name.
private String tableName;
/**
*
* @param ri
* @param tableName
*/
public ResultSetMetaData(RelationInformation ri, String tableName)
{
this.ri = ri;
this.tableName = tableName;
columnNames = ri.getTableColumnNames(tableName);
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnCount()
*/
public int getColumnCount( ) throws OdaException
{
return columnNames.length;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnName(int)
*/
public String getColumnName( int index ) throws OdaException
{
return columnNames[index-1];
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnLabel(int)
*/
public String getColumnLabel( int index ) throws OdaException
{
return columnNames[index-1];
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnType(int)
*/
public int getColumnType( int index ) throws OdaException
{
return DataTypes.getType(getColumnTypeName(index));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnTypeName(int)
*/
public String getColumnTypeName( int index ) throws OdaException
{
return ri.getTableColumnType(tableName, getColumnName(index));
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getColumnDisplayLength(int)
*/
public int getColumnDisplayLength( int index ) throws OdaException
{
throw new UnsupportedOperationException();
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getPrecision(int)
*/
public int getPrecision( int index ) throws OdaException
{
return -1;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#getScale(int)
*/
public int getScale( int index ) throws OdaException
{
return -1;
}
/*
* (non-Javadoc)
* @see org.eclipse.datatools.connectivity.oda.IResultSetMetaData#isNullable(int)
*/
public int isNullable( int index ) throws OdaException
{
return columnNullableUnknown;
}
/**
* Return the column's Xpath expression.
*
* @param index
* @return
* @throws OdaException
*/
public String getColumnPath( int index ) throws OdaException
{
return ri.getTableColumnPath(tableName,getColumnName(index));
}
}

View File

@@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
[<b>Non-API</b>] DTP XML Driver - an ODA run-time extension.
<p>
Note: <i>The implementation classes are <b>not</b> public APIs.
<br>Backward compatibility support in future releases is not guaranteed.</i>
<h2>Package Specification</h2>
The DTP ODA XML driver is a data provider that parses and accesses data
in XML files using XPath expressions.
<br>This package implements ODA 3.0 interfaces.
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<body bgcolor="white">
[<b>Non-API</b>] DTP XML Driver - an ODA run-time extension.
<p>
Note: <i>The implementation classes are <b>not</b> public APIs.
<br>Backward compatibility support in future releases is not guaranteed.</i>
<h2>Package Specification</h2>
The DTP ODA XML driver is a data provider that parses and accesses data
in XML files using XPath expressions.
</body>
</html>

View File

@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation. All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.util;
/**
* This interface defined the methods that would be used by classes that use sax parser.
*/
public interface ISaxParserConsumer {
/**
* The method is used to populate one column that is specified by path in current row.
*
* @param path
* @param value
*/
public void manipulateData(String path, String value);
/**
* This method is used by sax parser to notify the ISaxParserConsumer so that it can be active rather than blocked.
*
*/
public void wakeup();
/**
* Indicate whether a new row should started according to the given xPath expression. A new row would only started
* when the given xPath matches the root path of certain table.
*
* @param path
* @param start
*/
public void detectNewRow(String path, String prefix, String uri, boolean start);
}

View File

@@ -0,0 +1,166 @@
package org.eclipse.datatools.enablement.oda.xml.util;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* This class is used to process nested xml columns, either Simple one or Complex one.
* For the definition of Simple nesed xml columns and Complex nested xml columns, please
* refer to RelationInformation
*/
class NestedColumnUtil {
// The HashMap
private HashMap nestedXMLColumns;
private RelationInformation relationInfo;
private String tableName;
/**
* Constructor
*
* @param relationInfo
* @param tableName
* @param isSimple
*/
NestedColumnUtil(RelationInformation relationInfo, String tableName,
boolean isSimple) {
this.relationInfo = relationInfo;
this.tableName = tableName == null ? "":tableName.trim( );
String[] namesOfNestedColumns = isSimple ? relationInfo
.getTableSimpleNestedXMLColumnNames(this.tableName) : relationInfo
.getTableComplexNestedXMLColumnNames(this.tableName);
nestedXMLColumns = new HashMap();
for (int i = 0; i < namesOfNestedColumns.length; i++)
{
int backRefNumber = relationInfo.getTableNestedColumnBackRefNumber( tableName, namesOfNestedColumns[i] );
int forwardRefNumber = relationInfo.getTableColumnForwardRefNumber( tableName, namesOfNestedColumns[i] );
nestedXMLColumns.put(namesOfNestedColumns[i], new ThreshHoldInfo(
backRefNumber, forwardRefNumber, isSimple));
}
}
/**
* Return the value of certain nested column marked by the column name and current root path(the SaxParser generated one)
*
* @param columnName
* @param currentRootPath
* @return
*/
String getNestedColumnValue(String columnName, String currentRootPath) {
ThreshHoldInfo thInfo = (ThreshHoldInfo) nestedXMLColumns
.get(columnName);
assert columnName != null;
return thInfo.getValue(currentRootPath);
}
void update(String columnName, String path, String value) {
String columnPath = relationInfo.getTableColumnPath(tableName,
columnName);
if (SaxParserUtil.isSamePath(columnPath, path))
((ThreshHoldInfo) this.nestedXMLColumns.get(columnName)).addInfo(
path, value);
}
}
/**
* This class is used to map column XPath expressions and their corresponding values. Each instance of this
* class is responsible for the storage of values of one nested XML column.
*
*/
class ThreshHoldInfo {
//
private Map map;
private int backRefLevel;
private boolean isSimple;
private int forwardRefLevel;
/**
* The constructor.
*
*/
ThreshHoldInfo(int backRefLevel, int forwardRefLevel, boolean isSimple) {
this.map = new HashMap();
this.backRefLevel = backRefLevel;
this.isSimple = isSimple;
this.forwardRefLevel = forwardRefLevel;
}
/**
* Add nested column info.
*
* @param path
* @param value
*/
void addInfo(String path, String value) {
map.put(path, value);
}
/**
* Get value of nested column according to the current rootpath and the backRefNumber of the very nested column.
*
* @param rootPath
* @return
*/
String getValue(String rootPath) {
String nestedXMLPath = getCorrespondingNestedXMLColumnPath(rootPath);
if (nestedXMLPath == null)
return null;
return map.get(nestedXMLPath).toString();
}
/**
* @param rootPath
* @param backRefNumber
* @return
*/
private String getCorrespondingNestedXMLColumnPath(String rootPath) {
Iterator it = map.keySet().iterator();
String nestedXMLPath = null;
while (it.hasNext()) {
String temp = it.next().toString();
if (pathMatch(temp, rootPath)) {
nestedXMLPath = temp;
break;
}
}
return nestedXMLPath;
}
/**
* Test if the current root path is acceptable as the root path of nested XML column,
* if so then return true else return false.
*
* @param path
* @param currentRootPath
* @param backRefNumber
* @return
*/
private boolean pathMatch(String path, String currentRootPath) {
if (path == null)
return false;
String[] paths = path.split("/");
String[] nestedXMLColumnPaths = currentRootPath.split("/");
int commonRootLen = nestedXMLColumnPaths.length - backRefLevel;
if (commonRootLen < 0 || paths.length != commonRootLen + this.forwardRefLevel)
return false;
for (int i = 0; i < commonRootLen; i++) {
if (!paths[i].startsWith(nestedXMLColumnPaths[i]))
return false;
}
if (isSimple && paths.length != commonRootLen)
return false;
return true;
}
}

View File

@@ -0,0 +1,852 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.i18n.Messages;
import org.eclipse.datatools.enablement.oda.xml.impl.DataTypes;
/**
* This class is used to dealing with the strings which are parsed as arguments to
* create an XML data source connection.The structure of string must follow the given rule:
* TableName1#:#[TableRootPath]#:#{columnName1;Type;RelativeXPath},{columnName2;Type;RelativeXPath}...
* #-#TableName2#:#[TableRootPath]#:#{columnName1;Type;RelativeXpath}.....
*
*/
public class RelationInformation
{
//
public static final String CONST_TABLE_DELIMITER = "#-#";
public static final String CONST_TABLE_COLUMN_DELIMITER = "#:#";
public static final String CONST_COLUMN_METAINFO_DELIMITER = ";";
public static final String CONST_COLUMN_DELIMITER = ",";
//
private HashMap tableInfos;
/**
*
* @param relationString
* @throws OdaException
*/
public RelationInformation( String relationString ) throws OdaException
{
this.tableInfos = new HashMap( );
initialize( relationString.trim( ) );
}
/**
* Initialize tableInfos by analyzing the input string.
* @param relationString
* @throws OdaException
*/
private void initialize( String relationString ) throws OdaException
{
if( relationString == null|| relationString.length() == 0)
throw new OdaException( Messages.getString("RelationInformation.InputStringCannotBeNull"));
String[] tables = relationString.split( CONST_TABLE_DELIMITER );
for ( int i = 0; i < tables.length; i++ )
{
String[] temp = tables[i].trim( )
.split( CONST_TABLE_COLUMN_DELIMITER );
assert ( temp.length == 3 );
// //////////////////////////////
TableInfo tableInfo = new TableInfo( temp[0].trim( ),
temp[1].substring( 1, temp[1].length( ) - 1 ).trim( ) );
// ////////////////////////////////
String[] columns = temp[2].trim( ).split( CONST_COLUMN_DELIMITER );
for ( int j = 0; j < columns.length; j++ )
{
String trimedColumn = columns[j].trim( );
// remove column info delimiter "{" and "}"
String[] columnInfos = trimedColumn.substring( 1,
trimedColumn.length( ) - 1 )
.split( CONST_COLUMN_METAINFO_DELIMITER );
//columnInfos[0]: column name
//columnInfos[1]: column type
//columnInfos[2]: column XPath
String columnXpath = null;
if( columnInfos.length == 3 )
{
columnXpath = columnInfos[2];
}else
{
columnXpath = "";
}
for ( int m = 0; m < columnInfos.length; m++ )
columnInfos[m] = columnInfos[m].trim( );
String originalColumnXpath = columnXpath;
//if it is a filter expression
if ( columnXpath.matches( ".*\\Q[@\\E.*\\Q=\\E.*" ) )
{
//get the filter value
String value = columnXpath.replaceAll( ".*\\Q[@\\E.*\\Q=\\E",
"" )
.trim( );
value = value.substring( 1, value.length( ) - 2 );
//add it to filter
tableInfo.addFilter( columnInfos[0], value );
columnXpath = columnXpath.replaceAll( "\\Q=\\E.*",
"]" );
}
tableInfo.addColumn( new ColumnInfo( j + 1,
columnInfos[0],
columnInfos[1],
tableInfo.getRootPath( ), columnXpath, originalColumnXpath));
}
this.tableInfos.put( temp[0].trim( ), tableInfo );
}
}
/**
* Return the path of a column in certain table.
*
* @param tableName
* @param columnName
* @return
*/
public String getTableColumnPath( String tableName, String columnName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo) tableInfo ).getPath( columnName == null? "":columnName.trim( ) );
else
return null;
}
/**
* Return the path of a column in certain table.
*
* @param tableName
* @param columnName
* @return
*/
public String getTableOriginalColumnPath( String tableName, String columnName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo != null )
return ( (TableInfo) tableInfo ).getOriginalPath( columnName == null? "":columnName.trim( ) );
else
return null;
}
/**
* Return the back ref number of a column in certain table.
*
* @param tableName
* @param columnName
* @return
*/
public int getTableNestedColumnBackRefNumber( String tableName, String columnName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getBackRefNumber( columnName == null? "":columnName.trim( ) );
else
return -1;
}
/**
* Return the forward ref number of a column in certain table.
*
* @param tableName
* @param columnName
* @return
*/
public int getTableColumnForwardRefNumber( String tableName, String columnName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getForwardRefNumber( columnName == null? "":columnName.trim( ) );
else
return -1; }
/**
* Return the type of a column in certain table.
*
* @param tableName
* @param columnName
* @return
*/
public String getTableColumnType( String tableName, String columnName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getType( columnName == null? "":columnName.trim( ) );
else
return null;
}
/**
* Return the array of column names of certain table.
*
* @param tableName
* @return
*/
public String[] getTableColumnNames( String tableName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getColumnNames( );
else
return new String[0];
}
/**
* Return the array of complex nested column names of certain table.
*
* @param tableName
* @return
*/
public String[] getTableComplexNestedXMLColumnNames( String tableName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getComplexNestXMLColumnNames( );
else
return new String[0];
}
/**
* Return the array of simple nested column names of certain table.
*
* @param tableName
* @return
*/
public String[] getTableSimpleNestedXMLColumnNames( String tableName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getSimpleNestXMLColumnNames( );
else
return new String[0];
}
/**
* Return the table root path.
*
* @param tableName
* @return
*/
public String getTableRootPath( String tableName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getRootPath( );
else
return null;
}
/**
* Return the table original root path.
*
* @param tableName
* @return
*/
public String getTableOriginalRootPath( String tableName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getOriginalRootPath( );
else
return null;
}
/**
* Return the table filter.
*
* @param tableName
* @return
*/
public HashMap getTableFilter( String tableName )
{
Object tableInfo = this.tableInfos.get( tableName == null ? "":tableName.trim( ) );
if( tableInfo!= null )
return ( (TableInfo)tableInfo ).getFilter( );
else
return null;
}
public Iterator getTableNames()
{
return this.tableInfos.keySet( ).iterator( );
}
}
/**
* The instance of this class describe a table.
*
*/
class TableInfo
{
//The name of the table.
private String tableName;
//The hashmap which host columnInfos
private HashMap columnInfos;
//The hashmap which host filterInfos
private HashMap filterInfos;
//The original root path of this table
private String originalRootPath;
//The root path of this table
private String rootPath;
public TableInfo( String tableName, String rootPath )
{
this.tableName = tableName;
this.originalRootPath = rootPath;
String temp = SaxParserUtil.processParentAxis( originalRootPath );
if( "//".equals( temp ))
this.rootPath = "//*";
else
this.rootPath = temp;
this.columnInfos = new HashMap( );
this.filterInfos = new HashMap( );
}
/**
* Return the name of the table.
*
* @return
*/
public String getTableName( )
{
return this.tableName;
}
/**
* Return the path of certain column.
*
* @param columnName
* @return
*/
public String getPath( String columnName )
{
return ( (ColumnInfo) this.columnInfos.get( columnName ) ).getColumnPath( );
}
/**
* Return the original path of certain column.
*
* @param columnName
* @return
*/
public String getOriginalPath( String columnName )
{
return ( (ColumnInfo) this.columnInfos.get( columnName ) ).getColumnOriginalPath();
}
/**
* Return the back reference number of the column, this only applys to nested xml columns.
*
* @param columnName
* @return
*/
public int getBackRefNumber( String columnName )
{
return ( (ColumnInfo) this.columnInfos.get( columnName ) ).getBackRefNumber();
}
/**
* Return the forward reference number of the column.
*
* @param columnName
* @return
*/
public int getForwardRefNumber( String columnName )
{
return ( (ColumnInfo) this.columnInfos.get( columnName ) ).getForwardRefNumber();
}
/**
* Return the defined data type of certain column.
*
* @param columnName
* @return
*/
public String getType( String columnName )
{
return ( (ColumnInfo) this.columnInfos.get( columnName ) ).getColumnType( );
}
/**
* Return the hash map which defines the filters.
*
* @return
*/
public HashMap getFilter( )
{
return this.filterInfos;
}
/**
* Add a column to a table.
*
* @param ci
*/
public void addColumn( ColumnInfo ci )
{
this.columnInfos.put( ci.getColumnName( ), ci );
}
/**
* Add a filter to a table.
*
* @param columnName
* @param value
*/
public void addFilter( String columnName, String value )
{
this.filterInfos.put( columnName, value );
}
/**
* Return the column name array.
*
* @return
*/
public String[] getColumnNames( )
{
Object[] names = this.columnInfos.keySet( ).toArray( );
String[] result = new String[names.length];
for ( int i = 0; i < names.length; i++ )
{
result[( (ColumnInfo) columnInfos.get( names[i] ) ).getColumnIndex( ) - 1] = names[i].toString( );
}
return result;
}
/**
* The complex nested xml columnNames are the names of columns the value of which may be shared by multiple
* columns. The most significant feature of a complex nested xml column is that its xpath expression does not start with
* table root path, nor is it an attribute of parent of root path element.
*
* @return
*/
public String[] getComplexNestXMLColumnNames( )
{
ArrayList temp = new ArrayList();
String[] columnNames = getColumnNames();
String[] simpleNestXMLColumnNames = getSimpleNestXMLColumnNames( );
for(int i = 0; i < columnNames.length; i++)
{
//First filter out all "non-nested xml columns
if(!((ColumnInfo)columnInfos.get(columnNames[i])).getColumnPath().startsWith(rootPath))
{
boolean isComplexNestXMLColumn = true;
//Then filter out all simple nested xml columns
for( int j = 0; j < simpleNestXMLColumnNames.length; j++ )
{
if( simpleNestXMLColumnNames[j].equals( columnNames[i] ))
{
isComplexNestXMLColumn = false;
break;
}
}
if( isComplexNestXMLColumn )
temp.add( columnNames[i]);
}
}
return getStringArrayFromList( temp );
}
/**
* @param temp
* @return
*/
private String[] getStringArrayFromList( ArrayList temp )
{
String[] result = new String[temp.size()];
for(int i = 0; i < result.length; i ++)
{
result[i] = temp.get(i).toString();
}
return result;
}
/**
* The simple nested xml columnNames are the names of columns the value of which may be shared by multiple
* columns. The most significant feature of a simple nested xml column is that its xpath expression does not start with
* table root path, and it is an attribute of parent of root path element.
*
* @return
*/
public String[] getSimpleNestXMLColumnNames( )
{
ArrayList temp = new ArrayList();
String[] columnNames = getColumnNames();
for( int i = 0; i < columnNames.length; i++)
{
String nestedXMLColumnPathPrefix = ((ColumnInfo)columnInfos.get(columnNames[i])).getColumnPath();
//All simple nested xml column must be xml attributes rather than xml elements.
if( !nestedXMLColumnPathPrefix.matches( ".*\\Q@\\E.*" ))
continue;
//Remove the attribute so that only
nestedXMLColumnPathPrefix = nestedXMLColumnPathPrefix.replaceAll( "\\Q[@\\E.*", "" );
if( isSimpleNestedColumn( rootPath, nestedXMLColumnPathPrefix))
temp.add( columnNames[i] );
}
return getStringArrayFromList( temp );
}
/**
* Test if given treated column path refer to a Simple Nested Column
*
* @param rootPath
* @param treatedColumPath
* @return
*/
private boolean isSimpleNestedColumn( String rootPath, String treatedColumPath )
{
String[] tempString1 = treatedColumPath.split( "/" );
String[] tempString2 = rootPath.split( "/" );
if( tempString2.length <= tempString1.length )
return false;
for( int j = 0; j < tempString1.length; j++ )
{
if ( !(( ( tempString1[j] == null || tempString2[j] == null ) )
|| ( tempString1[j].equals( tempString2[j] )
|| "*".equals( tempString1[j] ) || "*".equals( tempString2[j] ) ) ))
return false;
}
return true;
}
/**
* Return the root path of that table.
*
* @return
*/
public String getRootPath( )
{
return this.rootPath;
}
/**
* Return the original root path of this table.
*
* @return
*/
public String getOriginalRootPath( )
{
return this.originalRootPath;
}
/**
* Return the table's ancestor path. A table's ancestor path is the common prefix that all table columns'
* pathes shared. Table's rootpath should only equal to, or prefixed with a table's ancestor path.
* @return
*/
public String getAncestor( )
{
String[] columnNames = this.getColumnNames( );
// If the table only contains one column. Then the root path of that
// table is the path of
// the column without the tailing attribute path(if exists)
if ( columnNames.length == 1 )
return getPath( columnNames[0] );// .replaceFirst("@.*","");
String[] paths = new String[columnNames.length];
for ( int i = 0; i < paths.length; i++ )
{
paths[i] = getPath( columnNames[i] ).replaceFirst("\\Q\\[@\\E.*\\Q\\]\\E","");
}
String theLongestPath = "";
for ( int i = 0; i < paths.length; i++ )
{
if ( paths[i].split( "\\Q/\\E" ).length > theLongestPath.split( "\\Q/\\E" ).length )
theLongestPath = paths[i];
}
boolean isAbsolutePath = false;
if ( theLongestPath.startsWith( "//" ) )
{
isAbsolutePath = false;
theLongestPath = theLongestPath.replaceFirst( "\\Q//\\E", "" );
}
else
{
isAbsolutePath = true;
theLongestPath = theLongestPath.replaceFirst( "\\Q/\\E", "" );
}
String[] temp = theLongestPath.split( "\\Q/\\E" );
String prefix = isAbsolutePath ? "/" : "//";
for ( int j = 0; j < temp.length; j++ )
{
String attempedPrefix = j == 0 ? prefix + temp[j] : prefix + "/" + temp[j];
for ( int i = 0; i < paths.length; i++ )
{
if ( !paths[i].startsWith( attempedPrefix ) )
return prefix;
}
prefix = attempedPrefix;
}
return prefix;
}
}
/**
* The instance of this class describe a single column.
*
*/
class ColumnInfo
{
//
private int index;
private String name;
private String type;
private String path;
private String originalPath;
//The backRefNumber is the number of parent element should a nested xml column
//retrieve back from its root XPath to find itself.This is only used in nest xml column
//mapping.
private int backRefNumber;
//The forwardRefNumber is the number of element of the corrent column substract the number of
//elements contains in the common part of current root path. In case of not nested column path,
//the common part of current root path is the root path itself.
private int forwardRefNumber;
/**
*
* @param index
* @param name
* @param type
* @param path
* @param originalPath
* @throws OdaException
*/
public ColumnInfo( int index, String name, String type, String rootPath, String relativePath,
String originalPath ) throws OdaException
{
this.index = index;
this.name = name;
this.type = type;
if ( !DataTypes.isValidType( type ) )
throw new OdaException( Messages.getString( "RelationInformation.InvalidDataTypeName" ) );
this.path = fixTrailingAttr( SaxParserUtil.processParentAxis( combineColumnPath( rootPath, relativePath ) ) );
this.originalPath = originalPath;
this.initBackAndForwardRefNumbers( );
}
/**
* Combine column root path and the relative column path.
*
* @param rootPath
* @param declaredPath
* @return
*/
private String combineColumnPath( String rootPath, String declaredPath)
{
if (declaredPath == null || declaredPath.length() == 0)
return rootPath;
else if( declaredPath.startsWith("[")||declaredPath.startsWith("/"))
return rootPath+declaredPath;
return rootPath + "/" + declaredPath;
}
/**
*
*
*/
private void initBackAndForwardRefNumbers( )
{
this.generateBackRefNumber( this.originalPath );
this.generateForwardRefNumber( this.originalPath );
}
/**
* @param originalPath
*/
private void generateBackRefNumber( String originalPath )
{
if ( this.originalPath.matches( ".*\\Q..\\E.*" ) )
{
String[] originalPathFrags = originalPath.split( UtilConstants.XPATH_SLASH );
int lastTwoDotAbbrevationPosition = 0;
int numberOfConcretePathFragsBefore2DotAbb = 0;
for ( int i = 0; i < originalPathFrags.length; i++ )
{
if ( originalPathFrags[i].equals( ".." ) )
lastTwoDotAbbrevationPosition = i;
}
for ( int i = 0; i < lastTwoDotAbbrevationPosition; i++ )
{
if ( !originalPathFrags[i].equals( ".." ) )
numberOfConcretePathFragsBefore2DotAbb++;
}
int numberOf2DotAbb = lastTwoDotAbbrevationPosition
- numberOfConcretePathFragsBefore2DotAbb + 1;
backRefNumber = numberOf2DotAbb
- numberOfConcretePathFragsBefore2DotAbb;
if ( backRefNumber < 0 )
{
backRefNumber = 0;
return;
}
//The back reference number cannot larger than the number of elements
//of root path.
/* String[] temp = rootPath.split( "\\Q/\\E" );
int count = 0;
for( int i = 0; i < temp.length; i ++)
{
if( temp[i].trim( ).length( )> 0 )
count++;
}
backRefNumber = backRefNumber>count?count:backRefNumber;*/
}
else
{
backRefNumber = 0;
}
}
/**
*
* @param originalPath
*/
private void generateForwardRefNumber( String originalPath )
{
String path = originalPath;
String[] split = path.split( "/" );
int elementCount = 0;
int _2dotAbbCount = 0;
for( int j = 0; j < split.length; j++ )
{
if( split[j].equals( ".." ))
{
_2dotAbbCount++;
}
else if ( ( !( split[j].trim( ).length( ) == 0 || split[j].trim( ).matches( "\\Q[@\\E.*" ) || split[j].trim( )
.matches( "\\Q@\\E.*" ) )))
{
elementCount++;
}
}
this.forwardRefNumber = elementCount + this.backRefNumber - _2dotAbbCount;
}
/**
* If the path is refer to an attribute, use syntax /elementName/@attributeName
* then we change it to /elementName[@attributeName] to compliment the standard xpath syntax.
*
*/
private String fixTrailingAttr( String path )
{
if ( path.matches(".*//@.*"))
path = path.replaceFirst("//@","//[@")+"]";
else if ( path.matches(".*/@.*"))
path = path.replaceFirst("/@","[@")+"]";
/*if ( path.startsWith( "//[" ))
path = path.replaceFirst( "\\Q//[\\E", "//*[" );
if ( path.startsWith( "/[" ))
path = path.replaceFirst( "\\Q/[\\E", "//*[" );*/
return path;
}
/**
* Return the columnName.
*
* @return
*/
public String getColumnName( )
{
return this.name;
}
/**
* Return the columnType.
*
* @return
*/
public String getColumnType( )
{
return this.type;
}
/**
* Return the column xPath.
*
* @return
*/
public String getColumnPath( )
{
return this.path;
}
/**
* Return the colum index.
*
* @return
*/
public int getColumnIndex( )
{
return this.index;
}
/**
* Return the original path of the column. The original path of a column is the path
* directly get from relation information String without building it to an absolute path.
* This method is mainly used by UI.
*
* @return
*/
public String getColumnOriginalPath()
{
return this.originalPath;
}
/**
* Return the back ref number.
*
* @return
*/
public int getBackRefNumber( )
{
return this.backRefNumber;
}
/**
* Return the forward ref number.
*
* @return
*/
public int getForwardRefNumber( )
{
return this.forwardRefNumber;
}
}

View File

@@ -0,0 +1,402 @@
/***********************************************************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation. All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Actuate Corporation - initial API and implementation
**********************************************************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.util;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
import org.apache.xerces.parsers.SAXParser;
import org.eclipse.swt.widgets.Display;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
* This instance interacts with a SaxParserConsumer instance to populate the ResultSet data.
*
*/
public class SaxParser extends DefaultHandler implements Runnable {
// the xml file name
private String fileName;
private final XMLDataInputStream inputStream;
// The XPathHolder instance that hold the information of element currently
// being proceed
private XPathHolder pathHolder;
// The ISaxParserConsumer instance that servers as middle-man between
// ResultSet and SaxParser.
private final ISaxParserConsumer spConsumer;
// This HashMap records the occurance of element being proceed.
private final HashMap currentElementRecoder;
// The boolean indicates that whether the parsing has started.
private boolean start;
// The boolean indicates that whether the parsing thread is alive or not.
private boolean alive;
/*
* We will override method org.xml.sax.helpers.DefaultHandler.characters(char[], int start, int length) to rechieve
* value of an xml element.
*
* In the Xerces2 Java Parser 2.6.2 implementation (the one we used), the first argument, that is, char[], which is
* a cache of xml input stream, passed by the Xerces parser would always be of 2048 bytes in length. If a value of
* an xml element exceeds 2048 bytes, or only parts of its value being cached on the rear of the char array, then
* the method characters() will be called multiple times so that the whole value could be achieved.
*
* Based on the above consideration, we decide to cache the chars fetched from the characters method and proceed
* them when endDocument method is called
*/
private String currentCacheValue;
private boolean stopCurrentThread;
private boolean isInvalidFile = false;
/**
*
* @param fileName
* @param consumer
*/
public SaxParser(XMLDataInputStream stream, ISaxParserConsumer consumer) {
inputStream = stream;
spConsumer = consumer;
start = true;
alive = true;
currentCacheValue = "";
currentElementRecoder = new HashMap();
stopCurrentThread = false;
}
/**
* DOC hcw SaxParser constructor comment.
*
* @param fileName
* @param consumer
*/
public SaxParser(String fileName, ISaxParserConsumer consumer) {
this((XMLDataInputStream) null, consumer);
this.fileName = fileName;
}
/*
* (non-Javadoc)
*
* @see java.lang.Runnable#run()
*/
public void run() {
SAXParser xr;
try {
xr = new SAXParser();
xr.setFeature("http://xml.org/sax/features/validation", false);
xr.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
xr.setContentHandler(this);
xr.setErrorHandler(this);
try {
if (inputStream != null) {
this.inputStream.init();
xr.parse(new InputSource(this.inputStream));
} else {
xr.parse(new File(fileName).toURI().toString());
}
} catch (ThreadStopException tsE) {
// This exception is thrown out to stop the execution of current
// thread.
tsE.printStackTrace();
}
// this.inputStream.reStart();
isInvalidFile = false;
} catch (final Exception e) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
// MessageDialog.openError(Display.getDefault().getActiveShell(), "Invalid file", e.getMessage());
}
});
isInvalidFile = true;
// throw new RuntimeException(e.getLocalizedMessage());
} finally {
this.alive = false;
spConsumer.wakeup();
}
}
/*
* (non-Javadoc)
*
* @see org.xml.sax.ContentHandler#startDocument()
*/
@Override
public void startDocument() {
pathHolder = new XPathHolder();
}
/*
* (non-Javadoc)
*
* @see org.xml.sax.ContentHandler#endDocument()
*/
@Override
public void endDocument() {
this.alive = false;
this.cleanUp();
this.spConsumer.wakeup();
}
/*
* (non-Javadoc)
*
* @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String,
* org.xml.sax.Attributes)
*/
@Override
public void startElement(String uri, String name, String qName, Attributes atts) {
// If the current thread should be stopped and current parsing should not continue any more, then
// throw a ThreadStopException so that it can be catched later in run method to stop the current thread
// execution.
if (this.stopCurrentThread) {
throw new ThreadStopException();
}
String elementName = getElementName(uri, qName, name);
String parentPath = pathHolder.getPath();
// Record the occurance of elements
if (this.currentElementRecoder.get(parentPath + UtilConstants.XPATH_SLASH + elementName) == null) {
this.currentElementRecoder.put(parentPath + UtilConstants.XPATH_SLASH + elementName, new Integer(1));
} else {
this.currentElementRecoder.put(
parentPath + UtilConstants.XPATH_SLASH + elementName,
new Integer(((Integer) this.currentElementRecoder.get(parentPath + UtilConstants.XPATH_SLASH + elementName))
.intValue() + 1));
}
pathHolder.push(elementName + "["
+ ((Integer) this.currentElementRecoder.get(parentPath + UtilConstants.XPATH_SLASH + elementName)).intValue()
+ "]");
String prefix = null;
if (qName.contains(":")) {
prefix = qName.split(":")[0];
}
spConsumer.detectNewRow(pathHolder.getPath(), prefix, uri, true);
for (int i = 0; i < atts.getLength(); i++) {
spConsumer.manipulateData(getAttributePath(atts, i), atts.getValue(i));
spConsumer.detectNewRow(getAttributePath(atts, i), null, null, true);
}
}
/**
* Build the xpath of an attribute.
*
* @param atts
* @param i
* @return
*/
private String getAttributePath(Attributes atts, int i) {
return pathHolder.getPath() + "[@" + getElementName(atts.getURI(i), atts.getQName(i), atts.getLocalName(i)) + "]";
}
/*
* (non-Javadoc)
*
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// Manipulate the data. The currentCacheValue is trimed to delimite
// the heading and tailing junk spaces.
spConsumer.manipulateData(pathHolder.getPath(), this.currentCacheValue.trim());
this.currentCacheValue = "";
String prefix = null;
if (qName.contains(":")) {
prefix = qName.split(":")[0];
}
spConsumer.detectNewRow(pathHolder.getPath(), prefix, uri, false);
// this.currentElementRecoder.clear();
String path = pathHolder.getPath();
Object[] keys = this.currentElementRecoder.keySet().toArray();
for (int i = 0; i < keys.length && path != ""; i++) {
if (keys[i].toString().startsWith(path) && (!keys[i].toString().equals(path))) {
this.currentElementRecoder.remove(keys[i]);
}
}
pathHolder.pop();
}
/**
* Get the elementName
*
* @param uri
* @param qName
* @param name
* @return
*/
private String getElementName(String uri, String qName, String name) {
// if ( "".equals( uri ) )
return qName;
// else
// return "["+ uri.replaceAll("\\Q\\\\E","/")+ "]" + name;
}
/*
* (non-Javadoc)
*
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
@Override
public void characters(char ch[], int start, int length) {
for (int i = 0; i < length; i++) {
this.currentCacheValue = this.currentCacheValue + ch[start + i];
}
}
/**
* Set the status of current thread, might either be "started" or "suspended"
*
* @param start
*/
public void setStart(boolean start) {
this.start = start;
if (start) {
synchronized (this) {
notify();
}
} else {
synchronized (this) {
try {
spConsumer.wakeup();
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
/**
* Set the member data stopCurrentThread to "true" value so that the current thread can be stopped afterwise.
*
*/
public void stopParsing() {
this.cleanUp();
this.stopCurrentThread = true;
}
/**
* Return whether the thread that host the SaxParser is suspended.
*
* @return
*/
public boolean isSuspended() {
return !start;
}
/**
* Return whether the thread that host the SaxParser is alive or destoried.
*
* @return
*/
public boolean isAlive() {
return this.alive;
}
/**
* Prepare for the stop execution of parsing.
*
*/
private void cleanUp() {
try {
if (this.inputStream != null) {
this.inputStream.close();
}
} catch (IOException e) {
// Simply ignore this.
}
}
/**
* This class wrapps a RuntimeException. It is used to stop the execution of current thread.
*/
private class ThreadStopException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 7871277314833138093L;
ThreadStopException() {
}
}
/**
* Getter for isInvalidFile.
*
* @return the isInvalidFile
*/
public boolean isInvalidFile() {
return this.isInvalidFile;
}
}
/**
* The instance of this class is used to populate the Xpath expression of current XML path.
*
*/
class XPathHolder {
private final Vector holder;
public XPathHolder() {
holder = new Vector();
}
/**
* Get the path string according to the current status of XPathHolder instance.
*
* @return
*/
public String getPath() {
String result = "";
Iterator it = holder.iterator();
while (it.hasNext()) {
result = result + "/" + (String) it.next();
}
return result;
}
/**
* Pop a value from stack.
*
*/
public void pop() {
holder.remove(holder.size() - 1);
}
/**
* Push a value to stack.
*
* @param path
*/
public void push(String path) {
holder.add(path);
}
}

View File

@@ -0,0 +1,94 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation. All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.util;
/**
* This is a helper class used by SaxParserConsumer to generate nested xml columns related infomation.
*/
public class SaxParserComplexNestedQueryHelper implements ISaxParserConsumer {
// The table name
private String tableName;
// The RelationInformation instance which defines the table.
private RelationInformation relationInfo;
// Cache the name of nested columns
private String[] namesOfNestedColumns;
// The sax parser instance.
private SaxParser sp;
private Thread spThread;
private NestedColumnUtil nestedColumnUtil;
private SaxParserConsumer consumer;
/**
* @param rinfo
* @param fileName
* @param tName
*/
protected SaxParserComplexNestedQueryHelper(SaxParserConsumer consumer, RelationInformation rinfo, XMLDataInputStream xdis,
String tName) {
this.tableName = tName;
this.relationInfo = rinfo;
this.consumer = consumer;
this.namesOfNestedColumns = relationInfo.getTableComplexNestedXMLColumnNames(tableName);
this.nestedColumnUtil = new NestedColumnUtil(relationInfo, tableName, false);
this.sp = new SaxParser(xdis, this);
this.spThread = new Thread(sp);
this.spThread.start();
}
/**
* Return whether the SaxParserNestedQueryHelper instance is ready for provide nested xml columns information.
*
* @return
*/
public boolean isPrepared() {
return !spThread.isAlive();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.enablement.oda.xml.util.ISaxParserConsumer#manipulateData(java.lang.String,
* java.lang.String)
*/
public void manipulateData(String path, String value) {
for (int i = 0; i < this.namesOfNestedColumns.length; i++) {
this.nestedColumnUtil.update(this.namesOfNestedColumns[i], path, value);
}
}
/**
* The method would not be used in this implementation of ISaxParserConsumer.
*/
public void detectNewRow(String path, String prefix, String uri, boolean start) {
}
/**
* The method would wakeup the host SaxParserConsumer.
*/
public void wakeup() {
consumer.wakeup();
}
/**
* Return the NestedColumnUtil instance.
*
* @return
*/
NestedColumnUtil getNestedColumnUtil() {
return this.nestedColumnUtil;
}
}

View File

@@ -0,0 +1,437 @@
/*******************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation. All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.datatools.enablement.oda.xml.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.datatools.connectivity.oda.OdaException;
import org.eclipse.datatools.enablement.oda.xml.Constants;
import org.eclipse.datatools.enablement.oda.xml.impl.ResultSet;
/**
* This class is an implementation of ISaxParserConsumer. The instance of this class deligate the communication between
* ResultSet and SaxParser, and does the majority of result-set population job.
*/
public class SaxParserConsumer implements ISaxParserConsumer {
private static final int INVALID_COLUMN_INDEX = -1;
// The ResultSet this instance served for.
private ResultSet resultSet;
// The SaxParser this instance dealing with.
private SaxParser sp;
// The thread which hosts the sp.
private Thread spThread;
// The row number in cachedResultSet.
private int cachedResultSetRowNo;
// The overall rowNumber that is available currently
private int currentAvailableMaxLineNo;
// The root path of a table.
private String rootPath;
// The names of complex nested xml columns
private String[] namesOfCachedComplexNestedColumns;
// The names of simple xml columns
private String[] namesOfCachedSimpleNestedColumns;
private String[] namesOfColumns;
// The name of a table.
private String tableName;
private RelationInformation relationInfo;
// The counter which records the times of cachedResultSet being re-initialized.
private int cachedTimes;
// The array which cache the result set.
private String[][] cachedResultSet;
// The overall rowNumber that has been parsed
private int currentRowNo;
private SaxParserComplexNestedQueryHelper spNestedQueryHelper;
private NestedColumnUtil nestedColumnUtil;
private List cachedRootRows;
private Map cachedTempRows;
private List cachedOrderedTempRowRoots;
/**
*
* @param rs
* @param rinfo
* @param fileName
* @param tName
* @throws OdaException
*/
public SaxParserConsumer(ResultSet rs, RelationInformation rinfo, XMLDataInputStream is, String tName) throws OdaException {
this.resultSet = rs;
// must start from 0
cachedResultSetRowNo = 0;
// must start from -1
currentAvailableMaxLineNo = -1;
tableName = tName;
relationInfo = rinfo;
nestedColumnUtil = new NestedColumnUtil(relationInfo, tableName, true);
// must start from 0
currentRowNo = 0;
cachedTempRows = new HashMap();
cachedRootRows = new ArrayList();
cachedOrderedTempRowRoots = new ArrayList();
cachedResultSet = new String[Constants.CACHED_RESULT_SET_LENGTH][resultSet.getMetaData().getColumnCount()];
this.rootPath = relationInfo.getTableRootPath(tableName);
this.namesOfCachedComplexNestedColumns = relationInfo.getTableComplexNestedXMLColumnNames(tableName);
this.namesOfCachedSimpleNestedColumns = relationInfo.getTableSimpleNestedXMLColumnNames(tableName);
this.namesOfColumns = relationInfo.getTableColumnNames(tableName);
XMLDataInputStream xdis = is;
if (namesOfCachedComplexNestedColumns.length > 0) {
spNestedQueryHelper = new SaxParserComplexNestedQueryHelper(this, rinfo, xdis, tName);
try {
// First wait() will be ended when SaxParserComplexNestedQueryHelper
// calls wakeup().However, the thread (ref as thread A) hosts SaxParserComplexNestedQueryHelper is
// actually still running until all finish up jobs are done. The thread (ref as thread B) which host
// this class should only be started when A is completely finish. So we
// add a loop which check the status of SaxParserComplexNestedQueryHelper and
// only all the program to proceed when A is actually finished.
synchronized (this) {
wait();
}
while (!spNestedQueryHelper.isPrepared()) {
synchronized (this) {
wait(5);
}
}
} catch (InterruptedException e) {
throw new OdaException(e.getLocalizedMessage());
}
}
sp = new SaxParser(xdis, this);
spThread = new Thread(sp);
spThread.start();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.enablement.oda.xml.util.ISaxParserConsumer#manipulateData(java.lang.String,
* java.lang.String)
*/
public void manipulateData(String path, String value) {
String currentRootPath = this.cachedRootRows.size() == 0 ? null : this.cachedRootRows.get(this.cachedRootRows.size() - 1)
.toString();
if (this.cachedRootRows.size() > 0) {
for (int n = 0; n < this.cachedRootRows.size(); n++) {
String currentRoot = this.cachedRootRows.get(n).toString();
String[] os = n == 0 ? this.cachedResultSet[this.cachedResultSetRowNo] : (String[]) this.cachedTempRows
.get(currentRoot);
populateValueToResultArray(path, value, currentRoot, os);
}
} else {
populateValueToResultArray(path, value, currentRootPath, this.cachedResultSet[this.cachedResultSetRowNo]);
}
}
/**
* @param path
* @param value
* @param currentRoot
* @param os
*/
private void populateValueToResultArray(String path, String value, String currentRoot, String[] os) {
for (int i = 0; i < namesOfColumns.length; i++) {
// If the given path is same to the path of certain column
if (columnPathMatch(currentRoot, relationInfo.getTableColumnPath(tableName, namesOfColumns[i]), path,
relationInfo.getTableColumnForwardRefNumber(tableName, namesOfColumns[i]))) {
if (isSimpleNestedColumn(namesOfColumns[i])) {
this.nestedColumnUtil.update(namesOfColumns[i], path, value);
continue;
}
if (os[i] == null)
os[i] = value;
}
}
}
private boolean columnPathMatch(String rootPath, String tableColumnPath, String currentPath, int columnFowardRef) {
if (rootPath != null) {
if (rootPath.split("/").length + columnFowardRef != currentPath.split("/").length)
return false;
}
return SaxParserUtil.isSamePath(tableColumnPath, currentPath);
}
private boolean isSimpleNestedColumn(String columnName) {
for (int i = 0; i < this.namesOfCachedSimpleNestedColumns.length; i++) {
if (this.namesOfCachedSimpleNestedColumns[i].equals(columnName))
return true;
}
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.enablement.oda.xml.util.ISaxParserConsumer#detectNewRow(java.lang.String, boolean)
*/
public void detectNewRow(String path, String prefix, String uri, boolean start) {
// if the new row started.
if (SaxParserUtil.isSamePath(rootPath, path)) {
if (start) {
if (this.cachedRootRows.size() > 0) {
this.cachedOrderedTempRowRoots.add(path);
this.cachedTempRows.put(path, new String[this.namesOfColumns.length]);
}
this.cachedRootRows.add(path);
return;
} else {
populateNestedXMLDataMappingColumns(path);
this.cachedRootRows.remove(path);
if (this.cachedRootRows.size() > 0)
return;
if (!isCurrentRowValid())
return;
cachedResultSetRowNo++;
currentAvailableMaxLineNo++;
if (cachedResultSetRowNo > Constants.CACHED_RESULT_SET_LENGTH - 1) {
sp.setStart(false);
cachedResultSetRowNo = 0;
}
if (this.cachedOrderedTempRowRoots.size() > 0) {
int i = 0;
for (i = 0; i < this.cachedOrderedTempRowRoots.size(); i++) {
String[] result = (String[]) this.cachedTempRows.get(this.cachedOrderedTempRowRoots.get(i));
this.cachedTempRows.remove(this.cachedOrderedTempRowRoots.get(i));
this.cachedResultSet[this.cachedResultSetRowNo] = result;
this.cachedResultSetRowNo++;
this.currentAvailableMaxLineNo++;
if (cachedResultSetRowNo > Constants.CACHED_RESULT_SET_LENGTH - 1) {
sp.setStart(false);
cachedResultSetRowNo = 0;
}
}
List temp = new ArrayList();
for (int j = i + 1; j < this.cachedOrderedTempRowRoots.size(); j++) {
temp.add(this.cachedOrderedTempRowRoots.get(j));
}
this.cachedOrderedTempRowRoots = temp;
}
}
}
}
/**
* Populate all the columns that come from Nested XML data in certain row.
*
*/
private void populateNestedXMLDataMappingColumns(String currentRootPath) {
if (this.cachedRootRows.size() > 1) {
String currentRoot = this.cachedRootRows.get(this.cachedRootRows.size() - 1).toString();
String[] os = (String[]) this.cachedTempRows.get(currentRoot);
for (int i = 0; i < namesOfCachedComplexNestedColumns.length; i++) {
int j = getColumnIndex(namesOfCachedComplexNestedColumns[i]);
if (j != INVALID_COLUMN_INDEX)
os[j] = this.spNestedQueryHelper.getNestedColumnUtil().getNestedColumnValue(
namesOfCachedComplexNestedColumns[i], currentRootPath);
}
for (int i = 0; i < namesOfCachedSimpleNestedColumns.length; i++) {
int j = getColumnIndex(namesOfCachedSimpleNestedColumns[i]);
if (j != INVALID_COLUMN_INDEX)
os[j] = this.nestedColumnUtil.getNestedColumnValue(namesOfCachedSimpleNestedColumns[i], currentRootPath);
}
} else {
for (int i = 0; i < namesOfCachedComplexNestedColumns.length; i++) {
int j = getColumnIndex(namesOfCachedComplexNestedColumns[i]);
if (j != INVALID_COLUMN_INDEX)
cachedResultSet[cachedResultSetRowNo][j] = this.spNestedQueryHelper.getNestedColumnUtil()
.getNestedColumnValue(namesOfCachedComplexNestedColumns[i], currentRootPath);
}
for (int i = 0; i < namesOfCachedSimpleNestedColumns.length; i++) {
int j = getColumnIndex(namesOfCachedSimpleNestedColumns[i]);
if (j != INVALID_COLUMN_INDEX)
cachedResultSet[cachedResultSetRowNo][j] = this.nestedColumnUtil.getNestedColumnValue(
namesOfCachedSimpleNestedColumns[i], currentRootPath);
}
}
}
private int getColumnIndex(String columnName) {
for (int j = 0; j < namesOfColumns.length; j++) {
if (columnName.equals(namesOfColumns[j])) {
return j;
}
}
return INVALID_COLUMN_INDEX;
}
/**
* Apply the filter to current row. Return whether should current row be filtered out.
*
*/
private boolean isCurrentRowValid() {
for (int i = 0; i < cachedResultSet[cachedResultSetRowNo].length; i++) {
if (relationInfo.getTableFilter(tableName).containsKey(relationInfo.getTableColumnNames(tableName)[i])) {
if (isCurrentColumnValueNotMatchFilterValue(i))
{
for (int j = 1; j <= cachedResultSet[cachedResultSetRowNo].length; j++) {
cachedResultSet[cachedResultSetRowNo][getColumnPosition(j)] = null;
}
return false;
}
}
}
return true;
}
/**
* @param i Column Index
* @return
*/
private boolean isCurrentColumnValueNotMatchFilterValue(int i) {
return !(relationInfo.getTableFilter(tableName).get(relationInfo.getTableColumnNames(tableName)[i]) == cachedResultSet[cachedResultSetRowNo][i] || relationInfo
.getTableFilter(tableName).get(relationInfo.getTableColumnNames(tableName)[i])
.equals(cachedResultSet[cachedResultSetRowNo][i]));
}
/*
* (non-Javadoc)
*
* @see org.eclipse.datatools.enablement.oda.xml.util.ISaxParserConsumer#wakeup()
*/
public synchronized void wakeup() {
notify();
}
/**
* Transform 1-based column index to 0-based column position in the array.
*
* @param index
* @return
*/
private int getColumnPosition(int index) {
return index - 1;
}
/**
* Make the cursor forward. If the end of data reached then return false.
*
* @return
* @throws OdaException
*/
public boolean next() throws OdaException {
// If the sax parser is still alive and has not been suspended yet, then
// block the current thread. The current thread will be re-active by sax
// parser.
while (sp.isAlive() && !sp.isSuspended()) {
try {
synchronized (this) {
wait();
}
} catch (InterruptedException e) {
throw new OdaException(e.getLocalizedMessage());
}
}
// If the cursor will move to the row that is not currently available,
// then resume the sp thread so that it can proceed to fetch more data to
// result set.
if (currentRowNo > currentAvailableMaxLineNo) {
if (sp.isAlive()) {
this.resumeThread();
return next();
} else
return false;
}
currentRowNo++;
return true;
}
/**
* Resume the thread, if SaxParser is suspended then restart it.
*
* @throws OdaException
*
*/
private void resumeThread() throws OdaException {
if (sp.isSuspended()) {
cachedTimes++;
// Recache the result set.
cachedResultSetRowNo = 0;
cachedResultSet = new String[Constants.CACHED_RESULT_SET_LENGTH][resultSet.getMetaData().getColumnCount()];
sp.setStart(true);
}
}
/**
* Close the SaxParserConsumer.
*
*/
public void close() {
// TODO add comments.
if (this.sp != null)
this.sp.stopParsing();
}
/**
* Return the array that cached the result set data.
*
* @return
*/
public String[][] getResultSet() {
return this.cachedResultSet;
}
/**
* Return Current row position. The row position is the position of a row in the result set arrary rather than
* overall row number.
*
* @return
*/
public int getRowPosition() {
return currentRowNo - this.cachedTimes * Constants.CACHED_RESULT_SET_LENGTH - 1;
}
/**
* Return overall row number.
*
* @return
*/
public int getCurrentRowNo() {
return this.currentRowNo;
}
}

Some files were not shown because too many files have changed in this diff Show More