You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2022/01/19 09:59:08 UTC
[empire-db] branch version3 updated: cleanup for version3
This is an automated email from the ASF dual-hosted git repository.
doebele pushed a commit to branch version3
in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/version3 by this push:
new 136f8df cleanup for version3
136f8df is described below
commit 136f8dfd8aff7653a633e7bbc51dc36959c42679
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Wed Jan 19 10:59:06 2022 +0100
cleanup for version3
---
empire-db-dist/pom.xml | 34 -
empire-db-eclipse-codegen/.gitignore | 3 -
empire-db-eclipse-codegen/META-INF/MANIFEST.MF | 30 -
empire-db-eclipse-codegen/build.properties | 30 -
empire-db-eclipse-codegen/lib/.gitignore | 8 -
empire-db-eclipse-codegen/lib/readme.txt | 24 -
empire-db-eclipse-codegen/plugin.xml | 76 -
empire-db-eclipse-codegen/pom.xml | 86 -
.../apache/empire/db/eclipse/CodeGenConfig.java | 574 ------
.../java/org/apache/empire/db/eclipse/Plugin.java | 190 --
.../org/apache/empire/db/eclipse/PluginConsts.java | 47 -
.../db/eclipse/handler/ConfigDialogHandler.java | 48 -
.../apache/empire/db/eclipse/model/ConfigFile.java | 64 -
.../empire/db/eclipse/model/JdbcDriverClass.java | 39 -
.../db/eclipse/service/ConfigFileService.java | 38 -
.../db/eclipse/service/ConfigFileServiceImpl.java | 234 ---
.../empire/db/eclipse/service/MessageService.java | 26 -
.../db/eclipse/service/MessageServiceImpl.java | 52 -
.../empire/db/eclipse/ui/ClassParameterPage.java | 272 ---
.../empire/db/eclipse/ui/ConfigurationDialog.java | 293 ---
.../empire/db/eclipse/ui/DBTablesDialog.java | 350 ----
.../apache/empire/db/eclipse/ui/INavigator.java | 46 -
.../org/apache/empire/db/eclipse/ui/IPage.java | 30 -
.../org/apache/empire/db/eclipse/ui/MainPage.java | 305 ---
.../org/apache/empire/db/eclipse/ui/Navigator.java | 145 --
.../java/org/apache/empire/db/eclipse/ui/Page.java | 51 -
.../empire/db/eclipse/ui/SchemaOptionsPage.java | 241 ---
.../empire/db/eclipse/util/SWTResourceManager.java | 455 -----
.../src/main/resources/defaultConfig.xml | 84 -
.../src/main/resources/icons/addButton.png | Bin 366 -> 0 bytes
.../src/main/resources/icons/check_all.gif | Bin 344 -> 0 bytes
.../src/main/resources/icons/db_element.gif | Bin 959 -> 0 bytes
.../src/main/resources/icons/deleteButton.png | Bin 582 -> 0 bytes
.../src/main/resources/icons/empire-db-logo.gif | Bin 12167 -> 0 bytes
.../src/main/resources/icons/empire_db_icon.png | Bin 581 -> 0 bytes
.../src/main/resources/icons/folder.gif | Bin 219 -> 0 bytes
.../src/main/resources/icons/logo.png | Bin 5482 -> 0 bytes
.../src/main/resources/icons/save.png | Bin 550 -> 0 bytes
.../src/main/resources/icons/testConnection.gif | Bin 920 -> 0 bytes
.../src/main/resources/icons/uncheck_all.gif | Bin 148 -> 0 bytes
.../src/main/resources/lang/messages_en.properties | 141 --
.../src/main/resources/templates/BaseRecord.vm | 41 -
.../src/main/resources/templates/BaseTable.vm | 31 -
.../src/main/resources/templates/BaseView.vm | 31 -
.../src/main/resources/templates/Database.vm | 136 --
.../src/main/resources/templates/Record.vm | 66 -
.../src/main/resources/templates/Table.vm | 76 -
.../src/main/resources/templates/View.vm | 68 -
.../empire-db-example-cxf/.gitignore | 4 -
.../empire-db-example-cxf/config.xml | 67 -
.../empire-db-example-cxf/log4j.properties | 21 -
empire-db-examples/empire-db-example-cxf/pom.xml | 67 -
.../samples/cxf/wssample/client/ClientGUI.java | 298 ---
.../cxf/wssample/client/EmployeeListModel.java | 43 -
.../cxf/wssample/client/EmployeeServiceClient.java | 86 -
.../samples/cxf/wssample/client/RunClient.java | 37 -
.../samples/cxf/wssample/common/Department.java | 80 -
.../samples/cxf/wssample/common/Employee.java | 172 --
.../cxf/wssample/common/EmployeeService.java | 67 -
.../cxf/wssample/server/DocumentWriter.java | 59 -
.../cxf/wssample/server/EmployeeServiceImpl.java | 154 --
.../samples/cxf/wssample/server/RunServer.java | 55 -
.../samples/cxf/wssample/server/SampleConfig.java | 101 -
.../samples/cxf/wssample/server/ServerControl.java | 282 ---
.../samples/cxf/wssample/server/ServerGUI.java | 221 ---
.../samples/cxf/wssample/server/db/SampleDB.java | 142 --
empire-db-examples/empire-db-example-cxf/xcf.xml | 32 -
.../empire-db-example-spring/.gitignore | 4 -
.../empire-db-example-spring/pom.xml | 139 --
.../apache/empire/samples/spring/EmpireApp.java | 47 -
.../empire/samples/spring/EmpireAppImpl.java | 231 ---
.../empire/samples/spring/SampleSpringApp.java | 84 -
.../empire/samples/spring/db/SampleBean.java | 126 --
.../apache/empire/samples/spring/db/SampleDB.java | 143 --
.../samples/spring/support/EmpireDBException.java | 40 -
.../samples/spring/support/EmpireDaoSupport.java | 135 --
.../spring/support/EmpireDriverFactory.java | 101 -
.../apache/empire/spring/example1/EmpireApp.java | 47 -
.../empire/spring/example1/EmpireAppImpl.java | 336 ----
.../apache/empire/spring/example1/SampleBean.java | 126 --
.../apache/empire/spring/example1/SampleDB.java | 144 --
.../empire/spring/example1/SampleSpringApp.java | 86 -
.../apache/empire/spring/example2/Department.java | 99 -
.../apache/empire/spring/example2/Employee.java | 140 --
.../apache/empire/spring/example2/EmployeeDao.java | 47 -
.../empire/spring/example2/EmployeeDaoImpl.java | 231 ---
.../empire/spring/example2/EmployeeSpringApp.java | 227 ---
.../src/main/resources/applicationContext.xml | 74 -
.../main/resources/example1/applicationContext.xml | 92 -
.../example2/applicationContext-employee.xml | 85 -
.../src/main/resources/log4j.properties | 21 -
.../src/main/resources/settings.properties | 44 -
.../empire-db-example-struts2-cxf/.gitignore | 7 -
.../empire-db-example-struts2-cxf/pom.xml | 112 --
.../cxf/wssample/client/EmployeeServiceClient.java | 87 -
.../samples/cxf/wssample/common/Department.java | 80 -
.../samples/cxf/wssample/common/Employee.java | 172 --
.../cxf/wssample/common/EmployeeService.java | 67 -
.../empire/struts2/websample/common/Errors.java | 27 -
.../struts2/websample/web/SampleApplication.java | 107 -
.../empire/struts2/websample/web/SampleConfig.java | 84 -
.../struts2/websample/web/SampleContext.java | 41 -
.../empire/struts2/websample/web/SampleErrors.java | 26 -
.../websample/web/SampleHtmlTagDictionary.java | 91 -
.../struts2/websample/web/SampleRequest.java | 89 -
.../struts2/websample/web/SampleSession.java | 85 -
.../empire/struts2/websample/web/SampleUser.java | 56 -
.../web/actions/EmployeeDetailAction.java | 85 -
.../websample/web/actions/EmployeeListAction.java | 170 --
.../struts2/websample/web/actions/LoginAction.java | 201 --
.../web/actiontypes/BeanDetailAction.java | 222 ---
.../websample/web/actiontypes/DetailAction.java | 50 -
.../websample/web/actiontypes/SampleAction.java | 104 -
.../struts2/websample/ws/SampleBeanClass.java | 63 -
.../struts2/websample/ws/SampleBeanDomain.java | 119 --
.../empire/struts2/websample/ws/SampleRecord.java | 35 -
.../websample/ws/records/DepartmentRecord.java | 35 -
.../websample/ws/records/EmployeeRecord.java | 82 -
.../src/main/resources/log4j.dtd | 183 --
.../src/main/resources/log4j.xml | 83 -
.../src/main/resources/messages_de.properties | 93 -
.../src/main/resources/messages_en.properties | 90 -
.../src/main/resources/struts.properties | 19 -
.../src/main/resources/struts.xml | 78 -
.../src/main/webapp/WEB-INF/config.xml | 33 -
.../src/main/webapp/WEB-INF/empire-tags.tld | 2040 --------------------
.../src/main/webapp/WEB-INF/web.xml | 66 -
.../src/main/webapp/css/main.css | 96 -
.../src/main/webapp/index.html | 29 -
.../src/main/webapp/jsp/employeeDetails.jsp | 78 -
.../src/main/webapp/jsp/employeeList.jsp | 64 -
.../src/main/webapp/jsp/employeeSearch.jsp | 50 -
.../src/main/webapp/jsp/error.jsp | 37 -
.../src/main/webapp/jsp/login.jsp | 41 -
.../empire-db-example-struts2/.gitignore | 7 -
.../empire-db-example-struts2/pom.xml | 108 --
.../empire/struts2/websample/db/SampleDB.java | 137 --
.../empire/struts2/websample/db/SampleRecord.java | 36 -
.../empire/struts2/websample/db/SampleTable.java | 58 -
.../websample/db/records/DepartmentRecord.java | 36 -
.../websample/db/records/EmployeeRecord.java | 66 -
.../struts2/websample/web/SampleApplication.java | 282 ---
.../empire/struts2/websample/web/SampleConfig.java | 101 -
.../struts2/websample/web/SampleContext.java | 34 -
.../empire/struts2/websample/web/SampleErrors.java | 26 -
.../websample/web/SampleHtmlTagDictionary.java | 91 -
.../struts2/websample/web/SampleRequest.java | 117 --
.../struts2/websample/web/SampleSession.java | 85 -
.../empire/struts2/websample/web/SampleUser.java | 41 -
.../web/actions/EmployeeDetailAction.java | 110 --
.../websample/web/actions/EmployeeListAction.java | 262 ---
.../struts2/websample/web/actions/LoginAction.java | 153 --
.../struts2/websample/web/actiontypes/Action.java | 99 -
.../web/actiontypes/BeanDetailAction.java | 222 ---
.../websample/web/actiontypes/DetailAction.java | 50 -
.../src/main/resources/log4j.dtd | 183 --
.../src/main/resources/log4j.xml | 69 -
.../src/main/resources/messages_de.properties | 89 -
.../src/main/resources/messages_en.properties | 86 -
.../src/main/resources/struts.properties | 19 -
.../src/main/resources/struts.xml | 57 -
.../src/main/webapp/WEB-INF/config.xml | 67 -
.../src/main/webapp/WEB-INF/empire-tags.tld | 2040 --------------------
.../src/main/webapp/WEB-INF/web.xml | 64 -
.../src/main/webapp/css/main.css | 74 -
.../src/main/webapp/index.html | 29 -
.../src/main/webapp/jsp/employeeDetails.jsp | 84 -
.../src/main/webapp/jsp/employeeList.jsp | 84 -
.../src/main/webapp/jsp/employeeSearch.jsp | 50 -
.../src/main/webapp/jsp/error.jsp | 37 -
.../src/main/webapp/jsp/login.jsp | 39 -
empire-db-examples/pom.xml | 4 -
empire-db-spring/.gitignore | 4 -
empire-db-spring/pom.xml | 53 -
.../empire/spring/DBDatabaseFactoryBean.java | 137 --
.../apache/empire/spring/DBReaderExtractor.java | 46 -
.../empire/spring/DBRecordCallbackHandler.java | 44 -
.../org/apache/empire/spring/DBRecordMapper.java | 49 -
.../org/apache/empire/spring/DBRecordWriter.java | 28 -
.../org/apache/empire/spring/EmpireDaoSupport.java | 131 --
.../org/apache/empire/spring/EmpireTemplate.java | 846 --------
empire-db-struts2/.gitignore | 6 -
empire-db-struts2/pom.xml | 67 -
.../struts2/action/ActionAccessValidator.java | 42 -
.../empire/struts2/action/ActionErrorProvider.java | 76 -
.../empire/struts2/action/ActionItemProperty.java | 32 -
.../apache/empire/struts2/action/Disposable.java | 47 -
.../apache/empire/struts2/action/ErrorInfo.java | 46 -
.../empire/struts2/action/ExceptionAware.java | 31 -
.../empire/struts2/action/ListPagingInfo.java | 39 -
.../empire/struts2/action/ListSortingInfo.java | 34 -
.../struts2/action/RequestParamProvider.java | 33 -
.../apache/empire/struts2/action/WebAction.java | 540 ------
.../org/apache/empire/struts2/action/package.html | 27 -
.../empire/struts2/actionsupport/ActionBase.java | 329 ----
.../empire/struts2/actionsupport/ActionError.java | 146 --
.../actionsupport/ActionPropertySupport.java | 110 --
.../struts2/actionsupport/BeanActionSupport.java | 193 --
.../actionsupport/BeanListActionSupport.java | 87 -
.../struts2/actionsupport/FormActionSupport.java | 122 --
.../struts2/actionsupport/ListActionSupport.java | 178 --
.../actionsupport/ReaderListActionSupport.java | 74 -
.../struts2/actionsupport/RecordActionSupport.java | 627 ------
.../actionsupport/RecordFormActionSupport.java | 361 ----
.../struts2/actionsupport/SessionPersistence.java | 29 -
.../actionsupport/TextProviderActionSupport.java | 127 --
.../empire/struts2/actionsupport/package.html | 27 -
.../exceptions/InvalidFormDataException.java | 37 -
.../empire/struts2/exceptions/WebException.java | 38 -
.../struts2/html/DefaultHtmlTagDictionary.java | 556 ------
.../empire/struts2/html/HtmlTagDictionary.java | 177 --
.../org/apache/empire/struts2/html/HtmlWriter.java | 239 ---
.../org/apache/empire/struts2/html/package.html | 27 -
.../interceptors/ActionAccessInterceptor.java | 82 -
.../interceptors/ActionBasicsInterceptor.java | 106 -
.../struts2/interceptors/InterceptorSupport.java | 122 --
.../empire/struts2/interceptors/package.html | 27 -
.../struts2/jsp/components/AnchorComponent.java | 180 --
.../struts2/jsp/components/CalendarComponent.java | 388 ----
.../struts2/jsp/components/ControlComponent.java | 252 ---
.../struts2/jsp/components/DataValueComponent.java | 172 --
.../struts2/jsp/components/FormComponent.java | 135 --
.../jsp/components/InputControlComponent.java | 364 ----
.../struts2/jsp/components/info/CalendarInfo.java | 318 ---
.../struts2/jsp/components/info/package.html | 27 -
.../empire/struts2/jsp/components/package.html | 27 -
.../struts2/jsp/controls/CheckboxInputControl.java | 99 -
.../struts2/jsp/controls/EMailInputControl.java | 46 -
.../struts2/jsp/controls/HLinkInputControl.java | 50 -
.../empire/struts2/jsp/controls/InputControl.java | 359 ----
.../struts2/jsp/controls/InputControlManager.java | 56 -
.../struts2/jsp/controls/PasswordInputControl.java | 116 --
.../struts2/jsp/controls/PhoneInputControl.java | 199 --
.../struts2/jsp/controls/RadioInputControl.java | 185 --
.../struts2/jsp/controls/SelectInputControl.java | 94 -
.../struts2/jsp/controls/TextAreaInputControl.java | 136 --
.../struts2/jsp/controls/TextInputControl.java | 408 ----
.../empire/struts2/jsp/controls/package.html | 27 -
.../empire/struts2/jsp/tags/ActionErrorsTag.java | 168 --
.../empire/struts2/jsp/tags/ActionMessageTag.java | 87 -
.../apache/empire/struts2/jsp/tags/ButtonTag.java | 102 -
.../empire/struts2/jsp/tags/CalendarTag.java | 204 --
.../empire/struts2/jsp/tags/CheckboxTag.java | 184 --
.../empire/struts2/jsp/tags/DataValueTag.java | 226 ---
.../empire/struts2/jsp/tags/EmpireTagSupport.java | 476 -----
.../struts2/jsp/tags/EmpireValueTagSupport.java | 358 ----
.../apache/empire/struts2/jsp/tags/FlexDivTag.java | 111 --
.../empire/struts2/jsp/tags/FloatClearTag.java | 62 -
.../empire/struts2/jsp/tags/FormPartTag.java | 365 ----
.../empire/struts2/jsp/tags/FormSubmitTag.java | 223 ---
.../apache/empire/struts2/jsp/tags/FormTag.java | 177 --
.../empire/struts2/jsp/tags/InputControlTag.java | 320 ---
.../empire/struts2/jsp/tags/ItemListTag.java | 428 ----
.../apache/empire/struts2/jsp/tags/LinkTag.java | 179 --
.../empire/struts2/jsp/tags/ListPageBarTag.java | 253 ---
.../empire/struts2/jsp/tags/ListPageInfoTag.java | 118 --
.../empire/struts2/jsp/tags/MenuItemTag.java | 153 --
.../apache/empire/struts2/jsp/tags/MenuTag.java | 182 --
.../apache/empire/struts2/jsp/tags/ParamTag.java | 111 --
.../empire/struts2/jsp/tags/RadioButtonTag.java | 171 --
.../apache/empire/struts2/jsp/tags/SelectTag.java | 178 --
.../empire/struts2/jsp/tags/TableDataTag.java | 192 --
.../struts2/jsp/tags/TableHeadColumnTag.java | 368 ----
.../empire/struts2/jsp/tags/TableHeadRowTag.java | 230 ---
.../empire/struts2/jsp/tags/TableRowTag.java | 189 --
.../apache/empire/struts2/jsp/tags/TextTag.java | 119 --
.../empire/struts2/jsp/tags/flow/ElseIfTag.java | 98 -
.../empire/struts2/jsp/tags/flow/ElseTag.java | 78 -
.../apache/empire/struts2/jsp/tags/flow/IfTag.java | 91 -
.../empire/struts2/jsp/tags/flow/SetTag.java | 95 -
.../empire/struts2/jsp/tags/flow/package.html | 27 -
.../apache/empire/struts2/jsp/tags/package.html | 27 -
.../org/apache/empire/struts2/web/AppContext.java | 51 -
.../empire/struts2/web/DefaultWebRequest.java | 57 -
.../empire/struts2/web/EmpireFilterDispatcher.java | 51 -
.../struts2/web/EmpirePortletDispatcher.java | 256 ---
.../empire/struts2/web/EmpirePortletResult.java | 101 -
.../empire/struts2/web/EmpireStrutsDispatcher.java | 260 ---
.../empire/struts2/web/EmpireThreadManager.java | 59 -
.../org/apache/empire/struts2/web/FieldErrors.java | 41 -
.../apache/empire/struts2/web/RequestContext.java | 61 -
.../apache/empire/struts2/web/ResponseContext.java | 52 -
.../apache/empire/struts2/web/SessionContext.java | 44 -
.../org/apache/empire/struts2/web/UrlHelperEx.java | 232 ---
.../apache/empire/struts2/web/WebApplication.java | 27 -
.../org/apache/empire/struts2/web/WebRequest.java | 62 -
.../org/apache/empire/struts2/web/WebSession.java | 27 -
.../org/apache/empire/struts2/web/package.html | 27 -
.../struts2/web/portlet/PortletContextWrapper.java | 100 -
.../struts2/web/portlet/PortletRequestWrapper.java | 125 --
.../web/portlet/PortletResponseWrapper.java | 136 --
.../struts2/web/portlet/PortletSessionWrapper.java | 77 -
.../struts2/web/servlet/ServletContextWrapper.java | 100 -
.../struts2/web/servlet/ServletRequestWrapper.java | 124 --
.../web/servlet/ServletResponseWrapper.java | 93 -
.../struts2/web/servlet/ServletSessionWrapper.java | 79 -
.../src/main/resources/META-INF/empire-tags.tld | 2040 --------------------
.../src/main/resources/struts-empire-portlet.xml | 98 -
.../src/main/resources/struts-empire.xml | 90 -
pom.xml | 5 -
300 files changed, 40517 deletions(-)
diff --git a/empire-db-dist/pom.xml b/empire-db-dist/pom.xml
index 7fc4637..384e7b5 100644
--- a/empire-db-dist/pom.xml
+++ b/empire-db-dist/pom.xml
@@ -22,10 +22,8 @@
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>empire-db-dist</artifactId>
- <version>2.4.7</version>
<name>Apache Empire-db Distribtion</name>
<packaging>pom</packaging>
-
<build>
<finalName>apache-empire-db-${project.version}</finalName>
<pluginManagement>
@@ -72,40 +70,8 @@
</dependency>
<dependency>
<groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-struts2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
<artifactId>empire-db-jsf2</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-struts2</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-jsf2</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <classifier>javadoc</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-spring</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <classifier>javadoc</classifier>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/empire-db-eclipse-codegen/.gitignore b/empire-db-eclipse-codegen/.gitignore
deleted file mode 100644
index ddd6d6d..0000000
--- a/empire-db-eclipse-codegen/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/.settings/
-/.classpath
-/.project
diff --git a/empire-db-eclipse-codegen/META-INF/MANIFEST.MF b/empire-db-eclipse-codegen/META-INF/MANIFEST.MF
deleted file mode 100644
index 5e675bf..0000000
--- a/empire-db-eclipse-codegen/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,30 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Empire-db eclipse code generator
-Bundle-SymbolicName: org.apache.empire.db.eclipse;singleton:=true
-Bundle-Version: 2.4.4.qualifier
-Bundle-ClassPath: .,
- lib/commons-beanutils-1.8.3.jar,
- lib/commons-logging-1.1.1.jar,
- lib/commons-io-1.4.jar,
- lib/empire-db-2.4.3.jar,
- lib/empire-db-codegen-2.4.3.jar,
- lib/slf4j-api-1.6.1.jar,
- lib/slf4j-log4j12-1.6.1.jar,
- lib/log4j-1.2.16.jar
-Bundle-Activator: org.apache.empire.db.eclipse.Plugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.ui.workbench,
- org.eclipse.swt,
- org.eclipse.core.resources,
- org.apache.empire.db.eclipse
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Export-Package: icons,
- lang,
- org.apache.empire.db.eclipse,
- org.apache.empire.db.eclipse.handler,
- org.apache.empire.db.eclipse.service,
- org.apache.empire.db.eclipse.ui,
- org.apache.empire.db.eclipse.util
diff --git a/empire-db-eclipse-codegen/build.properties b/empire-db-eclipse-codegen/build.properties
deleted file mode 100644
index 3dbfcc2..0000000
--- a/empire-db-eclipse-codegen/build.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0 Unless required by
-# applicable law or agreed to in writing, software distributed under the
-# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-# CONDITIONS OF ANY KIND, either express or implied. See the License for
-# the specific language governing permissions and limitations under the
-# License.
-bin.includes = META-INF/,\
- plugin.xml,\
- .,\
- lib/commons-beanutils-1.8.3.jar,\
- lib/commons-logging-1.1.1.jar,\
- lib/commons-io-1.4.jar,\
- lib/empire-db-2.4.3.jar,\
- lib/empire-db-codegen-2.4.3.jar,\
- lib/slf4j-api-1.6.1.jar,\
- lib/slf4j-log4j12-1.6.1.jar,\
- lib/log4j-1.2.16.jar,\
- src/main/resources/
-jre.compilation.profile = JavaSE-1.6
-src.includes = lib/,\
- src/main/
-source.. = src/main/java/,\
- src/main/resources/
diff --git a/empire-db-eclipse-codegen/lib/.gitignore b/empire-db-eclipse-codegen/lib/.gitignore
deleted file mode 100644
index 156fd81..0000000
--- a/empire-db-eclipse-codegen/lib/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-/commons-beanutils-1.8.3.jar
-/commons-io-1.4.jar
-/commons-logging-1.1.1.jar
-/empire-db-2.4.3.jar
-/empire-db-codegen-2.4.3.jar
-/log4j-1.2.16.jar
-/slf4j-api-1.6.1.jar
-/slf4j-log4j12-1.6.1.jar
diff --git a/empire-db-eclipse-codegen/lib/readme.txt b/empire-db-eclipse-codegen/lib/readme.txt
deleted file mode 100644
index 558439b..0000000
--- a/empire-db-eclipse-codegen/lib/readme.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0 Unless required by
-# applicable law or agreed to in writing, software distributed under the
-# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-# CONDITIONS OF ANY KIND, either express or implied. See the License for
-# the specific language governing permissions and limitations under the
-# License.
-
-In order to compile in Eclipse please copy the following files into this folder:
-
- commons-beanutils-1.8.3.jar,
- commons-logging-1.1.1.jar,
- commons-io-1.4.jar,
- empire-db-2.4.3.jar,
- empire-db-codegen-2.4.3.jar,
- slf4j-api-1.6.1.jar,
- slf4j-log4j12-1.6.1.jar,
- log4j-1.2.16.jar
diff --git a/empire-db-eclipse-codegen/plugin.xml b/empire-db-eclipse-codegen/plugin.xml
deleted file mode 100644
index 9af512a..0000000
--- a/empire-db-eclipse-codegen/plugin.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to you under the Apache License, Version
- 2.0 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the
- License.
- -->
-<?eclipse version="3.4"?>
-<plugin id="empire-db-eclipse-plugin" version="1.0.0" name="Empire-db Eclipse Plugin">
-<extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.apache.empire.db.eclipse.handler.ConfigDialogHandler"
- commandId="codegen.commands.configDialogHandler">
- </handler>
-</extension>
-
-<extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
- <command
- commandId="codegen.commands.configDialogHandler"
- icon="src/main/resources/icons/empire_db_icon.png"
- id="org.empire.codegen.menus.packageExplorer.configCommand"
- label="EmpireDB Tool"
- tooltip="">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="or">
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
- <command
- commandId="codegen.commands.configDialogHandler"
- icon="src/main/resources/icons/empire_db_icon.png"
- id="org.empire.codegen.menus.projectExplorer.configCommand"
- label="EmpireDB Tool"
- tooltip="">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="or">
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
-</extension>
-</plugin>
diff --git a/empire-db-eclipse-codegen/pom.xml b/empire-db-eclipse-codegen/pom.xml
deleted file mode 100644
index e931e52..0000000
--- a/empire-db-eclipse-codegen/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to you under the Apache License, Version
- 2.0 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the
- License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>empire-db-parent</artifactId>
- <groupId>org.apache.empire-db</groupId>
- <version>2.5.0-SNAPSHOT</version>
- </parent>
- <artifactId>org.apache.empire.db.eclipse</artifactId>
- <name>Apache Empire-db Eclipse Code Generator</name>
- <packaging>eclipse-plugin</packaging>
-
- <properties>
- <tycho-version>0.23.1</tycho-version>
- </properties>
-
- <repositories>
- <repository>
- <id>luna</id>
- <url>http://download.eclipse.org/releases/luna</url>
- <layout>p2</layout>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-codegen</artifactId>
- </dependency>
- <!-- use log4j for logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <!-- commons -->
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.4</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!-- Eclipse -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <pde>true</pde>
- </configuration>
- </plugin>
- <!-- enable tycho build extension -->
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-maven-plugin</artifactId>
- <version>${tycho-version}</version>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/CodeGenConfig.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/CodeGenConfig.java
deleted file mode 100644
index e57a6c0..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/CodeGenConfig.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.empire.exceptions.ItemNotFoundException;
-import org.apache.empire.exceptions.ObjectNotValidException;
-import org.apache.empire.xml.XMLConfiguration;
-import org.apache.empire.xml.XMLUtil;
-import org.apache.log4j.xml.DOMConfigurator;
-import org.slf4j.Logger;
-import org.w3c.dom.Element;
-
-@XmlRootElement
-public class CodeGenConfig extends XMLConfiguration {
- private static final Logger log = org.slf4j.LoggerFactory.getLogger(CodeGenConfig.class);
-
- // the logging configuration root node name
- private final String loggingNodeName = "log4j:configuration";
-
- private String configTitle;
-
- private String jdbcType;
-
- private String jdbcClass;
-
- private String jdbcURL;
-
- private String jdbcServer;
-
- private String jdbcPort;
-
- private String jdbcSID;
-
- private String jdbcUser;
-
- private String jdbcPwd;
-
- // generation options
- /**
- * name of the database catalog (may be null)
- */
- private String dbCatalog = null;
-
- /**
- * name of the database schema (may be null)
- */
- private String dbSchema = null;
-
- /**
- * name of the table pattern (may be null)
- */
- private String dbTablePattern = null;
- /**
- * Name of the timestamp column used for optimistic locking (may be null)
- * e.g. "UPDATE_TIMESTAMP";
- */
- private String timestampColumn = null;
-
- /**
- * name of the target folder
- */
- private String targetFolder;
-
- /**
- * name of the template folder
- */
- private String templateFolder = "configuration\\org.apache.empire\\templates\\";
-
- /**
- * name of the target package
- */
- private String packageName;
-
- /**
- * name of the table target package
- */
- private String tablePackageName;
-
- /**
- * name of the record target package
- */
- private String recordPackageName;
-
- /**
- * name of the view target package
- */
- private String viewPackageName;
-
- /**
- * Target name of the generated database class. This class extends
- * DBDatabase.
- */
- private String dbClassName;
-
- /**
- * Target name of the generated table class. This class extends DBTable and
- * is the base class for all generated individual table classes.
- */
- private String tableBaseName;
-
- /**
- * Target name of the generated view class. This class extends DBView and is
- * the base class for all generated individual view classes.
- */
- private String viewBaseName;
-
- /**
- * Target name of the generated record class. This is a template class that
- * extends DBRecord as follows:<br/>
- *
- * <pre>
- * XXRecord<T extends XXTable> extends DBRecord
- * </pre>
- *
- * <br/>
- */
- private String recordBaseName;
-
- /**
- * Prefix used for table member declarations
- */
- private String tableNamePrefix = "";
-
- /**
- * Prefix used for view member declarations
- */
- private String viewNamePrefix = "";
-
- /**
- * Prefix used for column member declarations
- */
- private String columnNamePrefix = "";
-
- /**
- * Prefix used for generating table class names.<br/>
- * The Table name is appended after the prefix starting with captial letter
- * followed by lower case letters.<br/>
- * Occurrence an of underscore indicates a new word which will again start
- * with a capital letter.<br/>
- * e.g.<br/>
- * <ul>
- * <li>Table "names" -> Class "XXNames"</li>
- * <li>Table "flight_bookings" -> Class "XXFlightBookings"</li>
- * </ul>
- * Where XX is the prefix.
- */
- private String tableClassPrefix = "";
-
- /**
- * Suffix used for generating table class names.<br/>
- * The Table name is appended before the suffix starting with captial letter
- * followed by lower case letters.<br/>
- * Occurrence an of underscore indicates a new word which will again start
- * with a capital letter.<br/>
- * e.g.<br/>
- * <ul>
- * <li>Table "names" -> Class "NamesTable"</li>
- * <li>Table "flight_bookings" -> Class "FlightBookingsTable"</li>
- * </ul>
- * Where "Table" is the suffix.
- */
- private String tableClassSuffix = "";
-
- /**
- * Prefix used for generating view class names.<br/>
- * The Table name is appended after the prefix starting with captial letter
- * followed by lower case letters.<br/>
- * Occurrence an of underscore indicates a new word which will again start
- * with a capital letter.<br/>
- * See naming of table classes above.
- */
- private String viewClassPrefix = "";
-
- /**
- * Suffix used for generating view class names.<br/>
- * The View name is appended before the suffix starting with captial letter
- * followed by lower case letters.<br/>
- * Occurrence an of underscore indicates a new word which will again start
- * with a capital letter.<br/>
- * e.g.<br/>
- * <ul>
- * <li>View "names" -> Class "NamesView"</li>
- * <li>View "flight_bookings" -> Class "FlightBookingsView"</li>
- * </ul>
- * Where "View" is the suffix.
- */
- private String viewClassSuffix = "";
-
- /**
- * if TRUE table classes should be declared as inner classes of DBDatabase.
- * <br/>
- * if FALSE table classes should be declared as top level classes.
- */
- private boolean nestTables = false;
-
- /**
- * if TRUE view classes should be declared as inner classes of DBDatabase.
- * <br/>
- * if FALSE view classes should be declared as top level classes.
- */
- private boolean nestViews = false;
-
- /**
- * if TRUE record classes should have a getter and setter for each field.
- * <br/>
- * Otherwise getters / setters are omitted.
- */
- private boolean createRecordProperties;
-
- /**
- * true if names of tables and views should not be camel-cased
- */
- private boolean preserverCharacterCase = false;
-
- /**
- * true if names of foreign-key-relations should be preserved
- */
- private boolean preserveRelationNames = false;
-
- /**
- * Initialize the configuration.
- *
- * @param filename
- * the file to read
- */
- public void init(String filename) {
- // Read the properties file
- super.init(filename, false);
-
- // Init Logging
- initLogging();
-
- // Reader Provider Properties
- readProperties(this, "properties");
- }
-
- /**
- * Init logging using Log4J's DOMConfigurator
- *
- * @return
- */
- private void initLogging() {
- // Get configuration root node
- Element rootNode = getRootNode();
- if (rootNode == null) {
- throw new ObjectNotValidException(getClass().getName());
- }
- // Find log configuration node
- Element loggingNode = XMLUtil.findFirstChild(rootNode, this.loggingNodeName);
- if (loggingNode == null) { // log configuration node not found
- CodeGenConfig.log.error("Log configuration node {} has not been found. Logging has not been configured.",
- this.loggingNodeName);
- throw new ItemNotFoundException(this.loggingNodeName);
- }
- // Init Log4J
- DOMConfigurator.configure(loggingNode);
- // done
- CodeGenConfig.log.info("Logging sucessfully configured from node {}.", this.loggingNodeName);
- }
-
- public String getJdbcClass() {
- return this.jdbcClass;
- }
-
- public void setJdbcClass(String jdbcClass) {
- this.jdbcClass = jdbcClass;
- }
-
- public String getJdbcURL() {
- return this.jdbcURL;
- }
-
- public void setJdbcURL(String jdbcURL) {
- this.jdbcURL = jdbcURL;
- }
-
- public String getJdbcUser() {
- return this.jdbcUser;
- }
-
- public void setJdbcUser(String jdbcUser) {
- this.jdbcUser = jdbcUser;
- }
-
- public String getJdbcPwd() {
- return this.jdbcPwd;
- }
-
- public void setJdbcPwd(String jdbcPwd) {
- this.jdbcPwd = jdbcPwd;
- }
-
- // ------- generation options -------
-
- public String getDbCatalog() {
- if(this.dbCatalog == "") {
- this.dbCatalog = null;
- }
- return this.dbCatalog;
- }
-
- public void setDbCatalog(String dbCatalog) {
- this.dbCatalog = dbCatalog;
- }
-
- public String getDbSchema() {
- if(this.dbSchema == "") {
- this.dbSchema = null;
- }
- return this.dbSchema;
- }
-
- public void setDbSchema(String dbSchema) {
- this.dbSchema = dbSchema;
- }
-
- public String getDbTablePattern() {
- return this.dbTablePattern;
- }
-
- public void setDbTablePattern(String dbTablePattern) {
- this.dbTablePattern = dbTablePattern;
- }
-
- public String getTimestampColumn() {
- return this.timestampColumn;
- }
-
- public void setTimestampColumn(String timestampColumn) {
- this.timestampColumn = timestampColumn;
- }
-
- public String getTargetFolder() {
- return this.targetFolder;
- }
-
- public void setTargetFolder(String targetFolder) {
- this.targetFolder = targetFolder;
- }
-
- public String getTemplateFolder() {
- return this.templateFolder;
- }
-
- public void setTemplateFolder(String templateFolder) {
- this.templateFolder = templateFolder;
- }
-
- public String getPackageName() {
- return this.packageName;
- }
-
- public void setPackageName(String packageName) {
- this.packageName = packageName;
- }
-
- public String getTablePackageName() {
- return fallback(this.tablePackageName, "tables");
- }
-
- public void setTablePackageName(String tablePackageName) {
- this.tablePackageName = tablePackageName;
- }
-
- public String getRecordPackageName() {
- return fallback(this.recordPackageName, "records");
- }
-
- public void setRecordPackageName(String recordPackageName) {
- this.recordPackageName = recordPackageName;
- }
-
- public String getViewPackageName() {
- return fallback(this.viewPackageName, "views");
- }
-
- public void setViewPackageName(String viewPackageName) {
- this.viewPackageName = viewPackageName;
- }
-
- public String getDbClassName() {
- return this.dbClassName;
- }
-
- public void setDbClassName(String dbClassName) {
- this.dbClassName = dbClassName;
- }
-
- public String getTableBaseName() {
- return this.tableBaseName;
- }
-
- public void setTableBaseName(String tableBaseName) {
- this.tableBaseName = tableBaseName;
- }
-
- public String getViewBaseName() {
- return this.viewBaseName;
- }
-
- public void setViewBaseName(String viewBaseName) {
- this.viewBaseName = viewBaseName;
- }
-
- public String getRecordBaseName() {
- return this.recordBaseName;
- }
-
- public void setRecordBaseName(String recordBaseName) {
- this.recordBaseName = recordBaseName;
- }
-
- public String getTableNamePrefix() {
- return this.tableNamePrefix;
- }
-
- public void setTableNamePrefix(String tableNamePrefix) {
- this.tableNamePrefix = tableNamePrefix;
- }
-
- public String getTableClassPrefix() {
- return this.tableClassPrefix;
- }
-
- public void setTableClassPrefix(String tableClassPrefix) {
- this.tableClassPrefix = tableClassPrefix;
- }
-
- public String getTableClassSuffix() {
- return this.tableClassSuffix;
- }
-
- public void setTableClassSuffix(String tableClassSuffix) {
- this.tableClassSuffix = tableClassSuffix;
- }
-
- public String getViewNamePrefix() {
- return this.viewNamePrefix;
- }
-
- public void setViewNamePrefix(String viewNamePrefix) {
- this.viewNamePrefix = viewNamePrefix;
- }
-
- public String getViewClassPrefix() {
- return this.viewClassPrefix;
- }
-
- public void setViewClassPrefix(String viewClassPrefix) {
- this.viewClassPrefix = viewClassPrefix;
- }
-
- public String getViewClassSuffix() {
- return this.viewClassSuffix;
- }
-
- public void setViewClassSuffix(String viewClassSuffix) {
- this.viewClassSuffix = viewClassSuffix;
- }
-
- public String getColumnNamePrefix() {
- return this.columnNamePrefix;
- }
-
- public void setColumnNamePrefix(String columnNamePrefix) {
- this.columnNamePrefix = columnNamePrefix;
- }
-
- public boolean isNestTables() {
- return this.nestTables;
- }
-
- public void setNestTables(boolean nestTables) {
- this.nestTables = nestTables;
- }
-
- public boolean isNestViews() {
- return this.nestViews;
- }
-
- public void setNestViews(boolean nestViews) {
- this.nestViews = nestViews;
- }
-
- public boolean isCreateRecordProperties() {
- return this.createRecordProperties;
- }
-
- public void setCreateRecordProperties(boolean createRecordProperties) {
- this.createRecordProperties = createRecordProperties;
- }
-
- public boolean isPreserverCharacterCase() {
- return this.preserverCharacterCase;
- }
-
- public void setPreserverCharacterCase(boolean preserverCharacterCase) {
- this.preserverCharacterCase = preserverCharacterCase;
- }
-
- public boolean isPreserveRelationNames() {
- return this.preserveRelationNames;
- }
-
- public void setPreserveRelationNames(boolean preserveRelationNames) {
- this.preserveRelationNames = preserveRelationNames;
- }
-
- private String fallback(String packageName, String defaultSubpackage) {
- String pkg = packageName;
- if (pkg == null && this.packageName != null) {
- pkg = this.packageName + "." + defaultSubpackage;
- }
- return pkg;
- }
-
- public String getConfigTitle() {
- return this.configTitle;
- }
-
- public void setConfigTitle(String configTitle) {
- this.configTitle = configTitle;
- }
-
- public String getJdbcType() {
- return this.jdbcType;
- }
-
- public void setJdbcType(String jdbcType) {
- this.jdbcType = jdbcType;
- }
-
- public String getJdbcServer() {
- return this.jdbcServer;
- }
-
- public void setJdbcServer(String jdbcServer) {
- this.jdbcServer = jdbcServer;
- }
-
- public String getJdbcPort() {
- return this.jdbcPort;
- }
-
- public void setJdbcPort(String jdbcPort) {
- this.jdbcPort = jdbcPort;
- }
-
- public String getJdbcSID() {
- return this.jdbcSID;
- }
-
- public void setJdbcSID(String jdbcSID) {
- this.jdbcSID = jdbcSID;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/Plugin.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/Plugin.java
deleted file mode 100644
index 905cfef..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/Plugin.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.empire.db.eclipse.model.JdbcDriverClass;
-import org.apache.empire.db.eclipse.service.ConfigFileService;
-import org.apache.empire.db.eclipse.service.ConfigFileServiceImpl;
-import org.apache.empire.db.eclipse.service.MessageService;
-import org.apache.empire.db.eclipse.service.MessageServiceImpl;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Plugin extends AbstractUIPlugin
-{
- private static final Logger log = LoggerFactory.getLogger(Plugin.class);
- // The shared instance
- private static Plugin plugin;
-
- private final MessageService messageService;
-
- private final ConfigFileService configFileService;
-
- private final Map<String, JdbcDriverClass> driverClasses;
-
- /**
- * The constructor
- */
- public Plugin()
- {
- this.messageService = new MessageServiceImpl(Locale.ENGLISH);
- // check config dir
- File checkConfigDir = new File(PluginConsts.CONFIG_DIR_PATH, PluginConsts.CONFIG_DIR);
- if (!checkConfigDir.exists())
- {
- checkConfigDir.mkdirs();
- }
- // check default config file
- checkConfigFile(PluginConsts.DEFAULT_CONFIG_FILE);
- // check database generation templates
- checkConfigFile(PluginConsts.TEMPLATE_BASE_RECORD);
- checkConfigFile(PluginConsts.TEMPLATE_BASE_TABLE);
- checkConfigFile(PluginConsts.TEMPLATE_BASE_VIEW);
- checkConfigFile(PluginConsts.TEMPLATE_DATABASE);
- checkConfigFile(PluginConsts.TEMPLATE_RECORD);
- checkConfigFile(PluginConsts.TEMPLATE_TABLE);
- checkConfigFile(PluginConsts.TEMPLATE_VIEW);
-
- this.configFileService = new ConfigFileServiceImpl(checkConfigDir);
- this.driverClasses = new HashMap<String, JdbcDriverClass>();
- this.driverClasses.put("Oracle", new JdbcDriverClass("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@%s:%s:%s"));
- this.driverClasses.put("Microsoft SQL Server", new JdbcDriverClass("com.microsoft.sqlserver.jdbc.SQLServerDriver",
- "jdbc:sqlserver://%s:%s;databaseName=%s"));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context)
- throws Exception
- {
- Plugin.log.debug("Start empire-db-codegen plugin");
- super.start(context);
- Plugin.plugin = this;
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context)
- throws Exception
- {
- Plugin.log.debug("Stop empire-db-codegen plugin");
- Plugin.plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Plugin getInstance()
- {
- return Plugin.plugin;
- }
-
- public MessageService getMessageService()
- {
- return this.messageService;
- }
-
- public ConfigFileService getConfigFileService()
- {
- return this.configFileService;
- }
-
- public Map<String, JdbcDriverClass> getDriverClasses()
- {
- return this.driverClasses;
- }
-
- public String[] getDriverClassNames()
- {
- String[] driverClassNames = new String[this.driverClasses.size() + 1];
- driverClassNames[0] = " ";
- int i = 1;
- for (String key : this.driverClasses.keySet())
- {
- driverClassNames[i] = key;
- i++;
- }
- return driverClassNames;
- }
-
- public Connection getJDBCConnection(String connectionType, String jdbcServer, String jdbcPort, String jdbcDatabase, String jdbcUser,
- String jdbcPwd)
- throws SQLException
- {
- JdbcDriverClass jdbcDriverClass = this.driverClasses.get(connectionType);
- String jdbcClass = jdbcDriverClass.getJdbcClass();
- String jdbcURL = String.format(jdbcDriverClass.getJdbcUrl(), jdbcServer, jdbcPort, jdbcDatabase);
- Plugin.log.info("Connecting to Database'" + jdbcURL + "' / User=" + jdbcUser);
- Connection conn = null;
- try
- {
- Class.forName(jdbcClass).newInstance();
- }
- catch (Exception ex)
- {
- throw new SQLException("Could not load database driver: " + jdbcClass);
- }
- conn = DriverManager.getConnection(jdbcURL, jdbcUser, jdbcPwd);
- Plugin.log.info("Connected successfully");
- return conn;
- }
-
- private void checkConfigFile(String filename)
- {
- File configFile = new File(PluginConsts.CONFIG_DIR_PATH, filename);
- if (!configFile.exists())
- {
- URL inputUrl = Plugin.class.getClassLoader().getResource(filename);
- try
- {
- FileUtils.copyURLToFile(inputUrl, configFile);
- }
- catch (IOException e)
- {
- Plugin.log.error("Could not copy resoucres file in configuration directory! %s", e.getMessage());
- }
- }
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/PluginConsts.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/PluginConsts.java
deleted file mode 100644
index 479cbc5..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/PluginConsts.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse;
-
-public class PluginConsts
-{
- // The plug-in ID
- public static final String PLUGIN_ID = "empire-db-eclipse-codegen";
-
- public static int BUTTON_NEXT_ID = 2;
-
- public static int BUTTON_PREVIOUS_ID = 3;
-
- public static int BUTTON_OK = 4;
-
- public static int BUTTON_CANCEL = 5;
-
- public static final String CONFIG_DIR_PATH = "configuration/org.apache.empire";
-
- public static final String CONFIG_DIR = "config";
-
- public static final String DEFAULT_CONFIG_FILE = "defaultConfig.xml";
-
- public static final String TEMPLATE_BASE_RECORD = "templates/BaseRecord.vm";
- public static final String TEMPLATE_BASE_TABLE = "templates/BaseTable.vm";
- public static final String TEMPLATE_BASE_VIEW = "templates/BaseView.vm";
- public static final String TEMPLATE_DATABASE = "templates/Database.vm";
- public static final String TEMPLATE_RECORD = "templates/Record.vm";
- public static final String TEMPLATE_TABLE = "templates/Table.vm";
- public static final String TEMPLATE_VIEW = "templates/View.vm";
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/handler/ConfigDialogHandler.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/handler/ConfigDialogHandler.java
deleted file mode 100644
index da36e1d..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/handler/ConfigDialogHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.handler;
-
-import org.apache.empire.db.codegen.CodeGenerator;
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.ui.ConfigurationDialog;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-public class ConfigDialogHandler extends AbstractHandler
-{
- public Object execute(ExecutionEvent event)
- throws ExecutionException
- {
- // loads the configurations
- Plugin.getInstance().getConfigFileService().refreshConfigList();
- // create new window
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- ConfigurationDialog dialog = new ConfigurationDialog(window.getShell());
- if (dialog.open() == Window.OK)
- {
- // start the class cration
- CodeGenerator.main(new String[] { dialog.getConfigFileAbsolutPath() });
- }
- return null;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/model/ConfigFile.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/model/ConfigFile.java
deleted file mode 100644
index a810733..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/model/ConfigFile.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.model;
-
-import org.apache.empire.db.eclipse.CodeGenConfig;
-
-public class ConfigFile {
-
- private String uuid;
-
- private String filename;
-
- private CodeGenConfig codeGenConfig;
-
- public ConfigFile(CodeGenConfig codeGenConfig) {
- this.codeGenConfig = codeGenConfig;
- }
-
- public ConfigFile(String filename, String uuid, CodeGenConfig pluginCodeGenConfig) {
- this.filename = filename;
- this.uuid = uuid;
- this.codeGenConfig = pluginCodeGenConfig;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public CodeGenConfig getCodeGenConfig() {
- return codeGenConfig;
- }
-
- public void setCodeGenConfig(CodeGenConfig codeGenConfig) {
- this.codeGenConfig = codeGenConfig;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/model/JdbcDriverClass.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/model/JdbcDriverClass.java
deleted file mode 100644
index 52451a0..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/model/JdbcDriverClass.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.model;
-
-public class JdbcDriverClass {
-
- private final String jdbcClass;
-
- private final String jdbcUrl;
-
- public JdbcDriverClass(String jdbcClass, String jdbcUrl) {
- this.jdbcClass = jdbcClass;
- this.jdbcUrl = jdbcUrl;
- }
-
- public String getJdbcClass() {
- return jdbcClass;
- }
-
- public String getJdbcUrl() {
- return jdbcUrl;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/ConfigFileService.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/ConfigFileService.java
deleted file mode 100644
index 11ccea4..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/ConfigFileService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.service;
-
-import org.apache.empire.db.eclipse.model.ConfigFile;
-
-public interface ConfigFileService
-{
- public boolean saveConfig(ConfigFile config);
-
- public ConfigFile getConfig(String configTitle);
-
- public boolean deleteConfig(String uuid);
-
- public void refreshConfigList();
-
- public String[] getConfigTitles();
-
- public ConfigFile getDefaultConfig();
-
- public String getConfigFilePath(String uuid);
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/ConfigFileServiceImpl.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/ConfigFileServiceImpl.java
deleted file mode 100644
index bbc8b7f..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/ConfigFileServiceImpl.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.service;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.empire.commons.StringUtils;
-import org.apache.empire.db.eclipse.CodeGenConfig;
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.PluginConsts;
-import org.apache.empire.db.eclipse.model.ConfigFile;
-import org.apache.empire.db.eclipse.model.JdbcDriverClass;
-import org.apache.empire.xml.XMLWriter;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class ConfigFileServiceImpl implements ConfigFileService
-{
- private Map<String, ConfigFile> configurationgs;
-
- private final File directory;
-
- public ConfigFileServiceImpl(File configDir)
- {
- this.directory = configDir;
- }
-
- public boolean saveConfig(ConfigFile config)
- {
- ConfigFile configFile = this.configurationgs.get(config.getUuid());
- if (configFile == null)
- {
- configFile = config;
- configFile.setFilename(config.getCodeGenConfig().getConfigTitle() + "_" + Calendar.getInstance().getTimeInMillis()
- + ".xml");
- configFile.setUuid(UUID.randomUUID().toString());
- this.configurationgs.put(configFile.getUuid(), configFile);
- }
- else
- {
- configFile.setCodeGenConfig(config.getCodeGenConfig());
- }
- try
- {
- File file = new File(this.directory, configFile.getFilename());
- if (!file.exists())
- {
- file.createNewFile();
- }
- // build url string
- CodeGenConfig pluginConfig = configFile.getCodeGenConfig();
- if (!StringUtils.isEmpty(pluginConfig.getJdbcType()))
- {
- JdbcDriverClass driver = Plugin.getInstance().getDriverClasses().get(pluginConfig.getJdbcType());
- pluginConfig.setJdbcURL(String.format(driver.getJdbcUrl(), pluginConfig.getJdbcServer(), pluginConfig.getJdbcPort(),
- pluginConfig.getJdbcSID()));
- pluginConfig.setJdbcClass(driver.getJdbcClass());
- }
- else
- {
- pluginConfig.setJdbcURL("");
- }
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.newDocument();
- Element configElement = document.createElement("config");
- document.appendChild(configElement);
- // Marshal the Object to a Document
- JAXBContext jc = JAXBContext.newInstance(CodeGenConfig.class);
- Marshaller marshaller = jc.createMarshaller();
- marshaller.marshal(pluginConfig, configElement);
- document.renameNode(configElement.getFirstChild(), configElement.getFirstChild().getNamespaceURI(), "properties");
- configElement.appendChild(createLogginNode(document));
- XMLWriter writer = new XMLWriter(new FileOutputStream(file));
- writer.print(document);
- }
- catch (Exception e)
- {
- return false;
- }
- return true;
- }
-
- private Element createLogginNode(Document document)
- {
- Element log4j = document.createElement("log4j:configuration");
- log4j.setAttribute("xmlns:log4j", "http://jakarta.apache.org/log4j/");
- Element appender = document.createElement("appender");
- appender.setAttribute("name", "default");
- appender.setAttribute("class", "org.apache.log4j.ConsoleAppender");
- Element layout = document.createElement("layout");
- layout.setAttribute("class", "org.apache.log4j.PatternLayout");
- Element param = document.createElement("param");
- param.setAttribute("name", "ConversionPattern");
- param.setAttribute("value", "%-5p [%d{yyyy/MM/dd HH:mm}]: %m at %l %n");
- layout.appendChild(param);
- appender.appendChild(layout);
- log4j.appendChild(appender);
-
- Element logger = document.createElement("logger");
- logger.setAttribute("name", "org.apache.empire.commons");
- logger.setAttribute("additivity", "false");
- Element level = document.createElement("level");
- level.setAttribute("value", "warn");
- Element loggerAppender = document.createElement("appender-ref");
- loggerAppender.setAttribute("ref", "default");
- logger.appendChild(level);
- logger.appendChild(loggerAppender);
- log4j.appendChild(logger);
-
- Element root = document.createElement("root");
- Element priority = document.createElement("priority");
- priority.setAttribute("value", "info");
- Element rootAppender = document.createElement("appender-ref");
- rootAppender.setAttribute("ref", "default");
- root.appendChild(priority);
- root.appendChild(rootAppender);
- log4j.appendChild(root);
-
- return log4j;
- }
-
- public ConfigFile getConfig(String configTitle)
- {
- for (ConfigFile configFile : this.configurationgs.values())
- {
- if (configFile.getCodeGenConfig().getConfigTitle().equals(configTitle))
- {
- return configFile;
- }
- }
- return null;
- }
-
- public boolean deleteConfig(String uuid)
- {
- ConfigFile configFile = this.configurationgs.get(uuid);
- if (configFile == null)
- {
- return false;
- }
- File file = new File(this.directory, configFile.getFilename());
- boolean deleted = file.delete();
- if (deleted)
- {
- this.configurationgs.remove(configFile);
- }
- return deleted;
- }
-
- public void refreshConfigList()
- {
- File[] files = this.directory.listFiles();
- this.configurationgs = new HashMap<String, ConfigFile>();
- if (files != null)
- {
- for (File file : files)
- {
- if (file.isFile())
- {
- CodeGenConfig config = new CodeGenConfig();
- try
- {
- config.init(file.getAbsolutePath());
- }
- catch (Exception e)
- {
- continue;
- }
- String uuid = UUID.randomUUID().toString();
- this.configurationgs.put(uuid, new ConfigFile(file.getName(), uuid, config));
- }
- }
- }
- }
-
- public String[] getConfigTitles()
- {
- List<String> configTitles = new ArrayList<String>();
- for (ConfigFile configFile : this.configurationgs.values())
- {
- configTitles.add(configFile.getCodeGenConfig().getConfigTitle());
- }
- Collections.sort(configTitles);
- return configTitles.toArray(new String[configTitles.size()]);
- }
-
- public ConfigFile getDefaultConfig()
- {
- CodeGenConfig defaultConfig = new CodeGenConfig();
- File file = new File(PluginConsts.CONFIG_DIR_PATH, PluginConsts.DEFAULT_CONFIG_FILE);
- defaultConfig.init(file.getAbsolutePath());
- return new ConfigFile(defaultConfig);
- }
-
- public String getConfigFilePath(String uuid)
- {
- ConfigFile config = this.configurationgs.get(uuid);
- if (config == null)
- {
- return null;
- }
- return new File(new File(PluginConsts.CONFIG_DIR_PATH, PluginConsts.CONFIG_DIR), config.getFilename()).getAbsolutePath();
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/MessageService.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/MessageService.java
deleted file mode 100644
index b76fb2f..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/MessageService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.service;
-
-public interface MessageService
-{
- String resolveMessageKey(String key);
-
- String resolveMessageKey(String key, Object... params);
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/MessageServiceImpl.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/MessageServiceImpl.java
deleted file mode 100644
index 1cc4dc8..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/service/MessageServiceImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.service;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-public class MessageServiceImpl implements MessageService
-{
- private final Locale locale;
-
- public static List<Locale> supportedLocales = new ArrayList<Locale>();
-
- static
- {
- MessageServiceImpl.supportedLocales.add(Locale.ENGLISH);
- }
-
- public MessageServiceImpl(Locale locale)
- {
- this.locale = locale;
- }
-
- public String resolveMessageKey(String key)
- {
- return ResourceBundle.getBundle("lang.messages", this.locale).getString(key);
- }
-
- public String resolveMessageKey(String key, Object... params)
- {
- return MessageFormat.format(resolveMessageKey(key), params);
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/ClassParameterPage.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/ClassParameterPage.java
deleted file mode 100644
index 1660b62..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/ClassParameterPage.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import org.apache.empire.db.eclipse.CodeGenConfig;
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.util.SWTResourceManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class ClassParameterPage extends Page
-{
- private final Text ctlDbClassName;
- private final Text ctlTableBaseName;
- private final Text ctlViewBaseName;
- private final Text ctlRecordBaseName;
- private final Text ctlTableNamePrefix;
- private final Text ctlTableClassPrefix;
- private final Text ctlTableClassSuffix;
- private final Text ctlViewNamePrefix;
- private final Text ctlViewClassPrefix;
- private final Text ctlViewClassSuffix;
- private final Text ctlColumnNamePrefix;
- private final Label lblClassParameter;
- private final Label lblTableBaseName;
- private final Label lblViewBaseName;
- private final Label lblRecordBaseName;
- private final Label lblDbClassName;
-
- private final Button ctlNestTables;
- private final Button ctlNestViews;
- private final Button ctlCreateRecordProperties;
- private final Button ctlPreserverCharCase;
- private final Button ctlPreserveRelationNames;
-
- public ClassParameterPage(Composite parent, int style)
- {
- super(parent, style);
-
- this.lblDbClassName = new Label(this, SWT.NONE);
- this.lblDbClassName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbClassName"));
- this.lblDbClassName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbClassName"));
- this.lblDbClassName.setBounds(15, 50, 145, 17);
-
- this.ctlDbClassName = new Text(this, SWT.BORDER);
- this.ctlDbClassName.setBounds(185, 47, 250, 21);
- this.ctlDbClassName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbClassName"));
-
- this.lblClassParameter = new Label(this, SWT.NONE);
- this.lblClassParameter.setAlignment(SWT.CENTER);
- this.lblClassParameter.setText(Plugin.getInstance().getMessageService().resolveMessageKey("classParameter"));
- this.lblClassParameter.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.BOLD));
- this.lblClassParameter.setBounds(0, 10, 418, 21);
-
- this.lblTableBaseName = new Label(this, SWT.NONE);
- this.lblTableBaseName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("tableBaseName"));
- this.lblTableBaseName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableBaseName"));
- this.lblTableBaseName.setBounds(15, 76, 145, 17);
-
- this.ctlTableBaseName = new Text(this, SWT.BORDER);
- this.ctlTableBaseName.setBounds(185, 73, 250, 21);
- this.ctlTableBaseName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableBaseName"));
-
- this.lblViewBaseName = new Label(this, SWT.NONE);
- this.lblViewBaseName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("viewBaseName"));
- this.lblViewBaseName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewBaseName"));
- this.lblViewBaseName.setBounds(15, 102, 145, 17);
-
- this.ctlViewBaseName = new Text(this, SWT.BORDER);
- this.ctlViewBaseName.setBounds(185, 99, 250, 21);
- this.ctlViewBaseName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewBaseName"));
-
- this.lblRecordBaseName = new Label(this, SWT.NONE);
- this.lblRecordBaseName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("recordBaseName"));
- this.lblRecordBaseName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.recordBaseName"));
- this.lblRecordBaseName.setBounds(15, 128, 145, 17);
-
- this.ctlRecordBaseName = new Text(this, SWT.BORDER);
- this.ctlRecordBaseName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.recordBaseName"));
- this.ctlRecordBaseName.setBounds(185, 125, 250, 21);
-
- Label lblTableNamePrefix = new Label(this, SWT.NONE);
- lblTableNamePrefix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("tableNamePrefix"));
- lblTableNamePrefix.setBounds(15, 154, 145, 17);
- lblTableNamePrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableNamePrefix"));
-
- this.ctlTableNamePrefix = new Text(this, SWT.BORDER);
- this.ctlTableNamePrefix.setBounds(185, 151, 250, 21);
- this.ctlTableNamePrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableNamePrefix"));
-
- Label lblTableClassPrefix = new Label(this, SWT.NONE);
- lblTableClassPrefix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("tableClassPrefix"));
- lblTableClassPrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableClassPrefix"));
- lblTableClassPrefix.setBounds(15, 180, 145, 17);
-
- this.ctlTableClassPrefix = new Text(this, SWT.BORDER);
- this.ctlTableClassPrefix.setBounds(185, 177, 250, 21);
- this.ctlTableClassPrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableClassPrefix"));
-
- Label lblTableClassSuffix = new Label(this, SWT.NONE);
- lblTableClassSuffix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("tableClassSuffix"));
- lblTableClassSuffix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableClassSuffix"));
- lblTableClassSuffix.setBounds(15, 206, 145, 17);
-
- this.ctlTableClassSuffix = new Text(this, SWT.BORDER);
- this.ctlTableClassSuffix.setBounds(185, 203, 250, 21);
- this.ctlTableClassSuffix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tableClassSuffix"));
-
- Label lblViewNamePrefix = new Label(this, SWT.NONE);
- lblViewNamePrefix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("viewNamePrefix"));
- lblViewNamePrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewNamePrefix"));
- lblViewNamePrefix.setBounds(15, 232, 145, 17);
-
- this.ctlViewNamePrefix = new Text(this, SWT.BORDER);
- this.ctlViewNamePrefix.setBounds(185, 229, 250, 21);
- this.ctlViewNamePrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewNamePrefix"));
-
- Label lblViewClassPrefix = new Label(this, SWT.NONE);
- lblViewClassPrefix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("viewClassPrefix"));
- lblViewClassPrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewClassPrefix"));
- lblViewClassPrefix.setBounds(15, 258, 145, 17);
-
- this.ctlViewClassPrefix = new Text(this, SWT.BORDER);
- this.ctlViewClassPrefix.setBounds(185, 255, 250, 21);
- this.ctlViewClassPrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewClassPrefix"));
-
- Label lblViewClassSuffix = new Label(this, SWT.NONE);
- lblViewClassSuffix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("viewClassSuffix"));
- lblViewClassSuffix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewClassSuffix"));
- lblViewClassSuffix.setBounds(15, 285, 145, 17);
-
- this.ctlViewClassSuffix = new Text(this, SWT.BORDER);
- this.ctlViewClassSuffix.setBounds(185, 282, 250, 21);
- this.ctlViewClassSuffix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewClassSuffix"));
-
- Label lblColumnNamePrefix = new Label(this, SWT.NONE);
- lblColumnNamePrefix.setText(Plugin.getInstance().getMessageService().resolveMessageKey("columnNamePrefix"));
- lblColumnNamePrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.columnNamePrefix"));
- lblColumnNamePrefix.setBounds(15, 312, 145, 17);
-
- this.ctlColumnNamePrefix = new Text(this, SWT.BORDER);
- this.ctlColumnNamePrefix.setBounds(185, 309, 250, 21);
- this.ctlColumnNamePrefix.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.columnNamePrefix"));
-
- Group grpFlag = new Group(this, SWT.NONE);
- grpFlag.setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
- grpFlag.setText(Plugin.getInstance().getMessageService().resolveMessageKey("flagGroup"));
- grpFlag.setBounds(5, 335, 440, 144);
-
- this.ctlNestTables = new Button(grpFlag, SWT.CHECK);
- this.ctlNestTables.setBounds(180, 22, 93, 16);
-
- Label lblNestTables = new Label(grpFlag, SWT.NONE);
- lblNestTables.setBounds(10, 23, 156, 15);
- lblNestTables.setText(Plugin.getInstance().getMessageService().resolveMessageKey("nestTables"));
-
- Label lblNestViews = new Label(grpFlag, SWT.NONE);
- lblNestViews.setText(Plugin.getInstance().getMessageService().resolveMessageKey("nestViews"));
- lblNestViews.setBounds(10, 45, 156, 15);
-
- this.ctlNestViews = new Button(grpFlag, SWT.CHECK);
- this.ctlNestViews.setBounds(180, 44, 93, 16);
-
- Label lblCreateRecordProperties = new Label(grpFlag, SWT.NONE);
- lblCreateRecordProperties.setText(Plugin.getInstance().getMessageService().resolveMessageKey("createRecordProperties"));
- lblCreateRecordProperties.setBounds(10, 67, 156, 15);
-
- this.ctlCreateRecordProperties = new Button(grpFlag, SWT.CHECK);
- this.ctlCreateRecordProperties.setBounds(180, 66, 93, 16);
-
- Label lblPreserverCharCase = new Label(grpFlag, SWT.NONE);
- lblPreserverCharCase.setText(Plugin.getInstance().getMessageService().resolveMessageKey("preserverCharCase"));
- lblPreserverCharCase.setBounds(10, 89, 156, 15);
-
- this.ctlPreserverCharCase = new Button(grpFlag, SWT.CHECK);
- this.ctlPreserverCharCase.setBounds(180, 88, 93, 16);
-
- Label lblPreserveRelationNames = new Label(grpFlag, SWT.NONE);
- lblPreserveRelationNames.setText(Plugin.getInstance().getMessageService().resolveMessageKey("preserveRelationNames"));
- lblPreserveRelationNames.setBounds(10, 111, 156, 15);
-
- this.ctlPreserveRelationNames = new Button(grpFlag, SWT.CHECK);
- this.ctlPreserveRelationNames.setBounds(180, 110, 93, 16);
- }
-
- public void save(CodeGenConfig config)
- {
- config.setDbClassName(this.ctlDbClassName.getText());
- config.setTableBaseName(this.ctlTableBaseName.getText());
- config.setViewBaseName(this.ctlViewBaseName.getText());
- config.setRecordBaseName(this.ctlRecordBaseName.getText());
- config.setTableNamePrefix(this.ctlTableNamePrefix.getText());
- config.setTableClassPrefix(this.ctlTableClassPrefix.getText());
- config.setTableClassSuffix(this.ctlTableClassSuffix.getText());
- config.setViewClassPrefix(this.ctlViewClassPrefix.getText());
- config.setViewClassSuffix(this.ctlViewClassSuffix.getText());
- config.setColumnNamePrefix(this.ctlColumnNamePrefix.getText());
- config.setNestTables(this.ctlNestTables.getSelection());
- config.setNestViews(this.ctlNestViews.getSelection());
- config.setCreateRecordProperties(this.ctlCreateRecordProperties.getSelection());
- config.setPreserverCharacterCase(this.ctlPreserverCharCase.getSelection());
- config.setPreserveRelationNames(this.ctlPreserveRelationNames.getSelection());
- }
-
- public void load(CodeGenConfig config)
- {
- setControlText(this.ctlDbClassName, config.getDbClassName());
- setControlText(this.ctlTableBaseName, config.getTableBaseName());
- setControlText(this.ctlViewBaseName, config.getViewBaseName());
- setControlText(this.ctlRecordBaseName, config.getRecordBaseName());
- setControlText(this.ctlTableNamePrefix, config.getTableNamePrefix());
- setControlText(this.ctlTableClassPrefix, config.getTableClassPrefix());
- setControlText(this.ctlTableClassSuffix, config.getTableClassSuffix());
- setControlText(this.ctlViewClassPrefix, config.getViewClassPrefix());
- setControlText(this.ctlViewClassSuffix, config.getViewClassSuffix());
- setControlText(this.ctlColumnNamePrefix, config.getColumnNamePrefix());
- this.ctlNestTables.setSelection(config.isNestTables());
- this.ctlNestViews.setSelection(config.isNestViews());
- this.ctlCreateRecordProperties.setSelection(config.isCreateRecordProperties());
- this.ctlPreserverCharCase.setSelection(config.isPreserverCharacterCase());
- this.ctlPreserveRelationNames.setSelection(config.isPreserveRelationNames());
- }
-
- @Override
- public void setEnabled(boolean enabled)
- {
- this.ctlDbClassName.setEnabled(enabled);
- this.ctlTableBaseName.setEnabled(enabled);
- this.ctlViewBaseName.setEnabled(enabled);
- this.ctlRecordBaseName.setEnabled(enabled);
- this.ctlTableNamePrefix.setEnabled(enabled);
- this.ctlTableClassPrefix.setEnabled(enabled);
- this.ctlTableClassSuffix.setEnabled(enabled);
- this.ctlViewNamePrefix.setEnabled(enabled);
- this.ctlViewClassPrefix.setEnabled(enabled);
- this.ctlViewClassSuffix.setEnabled(enabled);
- this.ctlColumnNamePrefix.setEnabled(enabled);
- this.ctlNestTables.setEnabled(enabled);
- this.ctlNestViews.setEnabled(enabled);
- this.ctlCreateRecordProperties.setEnabled(enabled);
- this.ctlPreserverCharCase.setEnabled(enabled);
- this.ctlPreserveRelationNames.setEnabled(enabled);
- }
-
- public boolean checkRequiredFields()
- {
- return checkControlFilled(this.ctlDbClassName, this.lblDbClassName.getText())
- && checkControlFilled(this.ctlTableBaseName, this.lblTableBaseName.getText())
- && checkControlFilled(this.ctlViewBaseName, this.lblViewBaseName.getText())
- && this.checkControlFilled(this.ctlRecordBaseName, this.lblRecordBaseName.getText());
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/ConfigurationDialog.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/ConfigurationDialog.java
deleted file mode 100644
index 8670e51..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/ConfigurationDialog.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.PluginConsts;
-import org.apache.empire.db.eclipse.model.ConfigFile;
-import org.apache.empire.db.eclipse.util.SWTResourceManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-public class ConfigurationDialog extends TitleAreaDialog
-{
- private Navigator navigator;
-
- private Page visiblePage;
-
- private Button btnNextPage;
-
- private Button btnPreviousPage;
-
- private Button btnOk;
-
- private Button btnCancel;
-
- public ConfigurationDialog(Shell shell)
- {
- super(shell);
- }
-
- @Override
- public void create()
- {
- super.create();
- UpdateControls();
- }
-
- // overriding this methods allows you to set the
- // title of the custom dialog
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dialog.title"));
- }
-
- @Override
- protected Point getInitialSize()
- {
- return new Point(470, 685);
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent)
- {
- parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- this.btnPreviousPage = createButton(parent, PluginConsts.BUTTON_PREVIOUS_ID, Plugin.getInstance().getMessageService()
- .resolveMessageKey("dialog.back"), true);
- this.btnPreviousPage.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent e)
- {
- ConfigurationDialog.this.navigator.showPreviousPage();
- UpdateControls();
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
- });
- this.btnNextPage = createButton(parent, PluginConsts.BUTTON_NEXT_ID,
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.next"), true);
- this.btnNextPage.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent e)
- {
- ConfigurationDialog.this.navigator.showNextPage();
- UpdateControls();
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
- });
-
- this.btnOk = createButton(parent, PluginConsts.BUTTON_OK, Plugin.getInstance().getMessageService().resolveMessageKey("dialog.ok"),
- false);
- this.btnOk.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- if (checkRequiredFields())
- {
- saveAction();
- setReturnCode(Window.OK);
- close();
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- this.btnCancel = createButton(parent, PluginConsts.BUTTON_CANCEL,
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.close"), false);
- this.btnCancel.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- save();
- setReturnCode(Window.CANCEL);
- close();
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- setTitleImage(SWTResourceManager.getImage(ConfigurationDialog.class, "/icons/empire-db-logo.gif"));
- Composite area = (Composite) super.createDialogArea(parent);
- area.setLayout(null);
- final MainPage mainPage = new MainPage(area, SWT.NONE);
- mainPage.addExistingConfigsListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent event)
- {
- if (event.widget instanceof Combo)
- {
- Combo combo = (Combo) event.widget;
- save();
- load(Plugin.getInstance().getConfigFileService().getConfig(combo.getText()));
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
-
- mainPage.addBtnAddListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- save();
- load(Plugin.getInstance().getConfigFileService().getDefaultConfig());
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
-
- }
- });
- mainPage.addBtnSaveListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- saveAction();
- mainPage.setConfigTitleList(Plugin.getInstance().getConfigFileService().getConfigTitles());
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- mainPage.addBtnDeleteListener(new SelectionListener()
- {
-
- public void widgetSelected(SelectionEvent arg0)
- {
- if (MessageDialog.openConfirm(getShell(), Plugin.getInstance().getMessageService().resolveMessageKey("dialog.delete"),
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.delete.msg")))
- {
- deleteConfig();
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- this.visiblePage = mainPage;
- this.navigator = new Navigator();
- this.navigator.addPage(this.visiblePage);
- final SchemaOptionsPage schemaOptions = new SchemaOptionsPage(area, SWT.NONE);
- schemaOptions.addBtnTableDialogListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- ConfigurationDialog.this.navigator.save();
- DBTablesDialog dbTablesDialog = new DBTablesDialog(getShell(), ConfigurationDialog.this.navigator.getCurrentConfig()
- .getCodeGenConfig());
- if (dbTablesDialog.open() == Window.OK)
- {
- schemaOptions.getCtlDbTablePattern().setText(dbTablesDialog.getSelectedTables());
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- this.navigator.addPage(schemaOptions);
- ClassParameterPage classParameterPage = new ClassParameterPage(area, SWT.NONE);
- this.navigator.addPage(classParameterPage);
- this.navigator.setPagesEnabled(false);
-
- setHelpAvailable(false);
- return area;
- }
-
- private void UpdateControls()
- {
- this.btnPreviousPage.setVisible(this.navigator.hasPreviousPage());
- this.btnNextPage.setVisible(this.navigator.hasNextPage());
- }
-
- public void save()
- {
- if (ConfigurationDialog.this.navigator.getCurrentConfig() != null
- && MessageDialog.openQuestion(getShell(), Plugin.getInstance().getMessageService().resolveMessageKey("dialog.save"),
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.save.msg")))
- {
- saveAction();
- }
- }
-
- public void saveAction()
- {
- ConfigFile configFile = this.navigator.save();
- if (configFile != null)
- {
- Plugin.getInstance().getConfigFileService().saveConfig(configFile);
- }
- }
-
- public void load(ConfigFile config)
- {
- this.navigator.load(config);
- }
-
- public void deleteConfig()
- {
- Plugin.getInstance().getConfigFileService().deleteConfig(this.navigator.getCurrentConfig().getUuid());
- this.navigator.load(null);
- }
-
- public boolean hasConfig()
- {
- return this.navigator.getCurrentConfig() != null;
- }
-
- public String getConfigFileAbsolutPath()
- {
- return Plugin.getInstance().getConfigFileService().getConfigFilePath(this.navigator.getCurrentConfig().getUuid());
- }
-
- private boolean checkRequiredFields()
- {
- return this.navigator.checkRequiredFields();
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/DBTablesDialog.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/DBTablesDialog.java
deleted file mode 100644
index 585f1d9..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/DBTablesDialog.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-
-import org.apache.empire.db.codegen.util.DBUtil;
-import org.apache.empire.db.eclipse.CodeGenConfig;
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.PluginConsts;
-import org.apache.empire.db.eclipse.util.SWTResourceManager;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DBTablesDialog extends TitleAreaDialog
-{
- private CheckboxTableViewer checkboxTableViewer;
- private Button btnConnect;
-
- private final CodeGenConfig config;
- private Label lblConnection;
- private Button btnOk;
- private Button btnSpaceholder;
-
- private String selectedTables;
-
- public DBTablesDialog(Shell parentShell, CodeGenConfig config)
- {
- super(parentShell);
- this.config = config;
- }
-
- @Override
- public void create()
- {
- super.create();
- setTitle(Plugin.getInstance().getMessageService().resolveMessageKey("dialog.tables.discription"));
- }
-
- @Override
- protected Point getInitialSize()
- {
- return new Point(343, 473);
- }
-
- // overriding this methods allows you to set the
- // title of the custom dialog
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dialog.tables.title"));
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent)
- {
- parent.setLayoutData(new GridData(SWT.FILL, SWT.RIGHT, true, true));
-
- this.btnSpaceholder = createButton(parent, PluginConsts.BUTTON_PREVIOUS_ID, " ", true);
- this.btnSpaceholder.setText("################");
- this.btnSpaceholder.setVisible(false);
-
- // Update layout of the parent composite to count the spacer
- GridLayout layout = (GridLayout) parent.getLayout();
- layout.makeColumnsEqualWidth = false;
-
- this.btnOk = createButton(parent, PluginConsts.BUTTON_OK,
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.tables.finish"), false);
- this.btnOk.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- StringBuilder sb = new StringBuilder();
- Object[] tables = DBTablesDialog.this.checkboxTableViewer.getCheckedElements();
- for (Object table : tables)
- {
- sb.append(table).append(",");
- }
- DBTablesDialog.this.selectedTables = sb.toString().substring(0, sb.length() - 1);
- setReturnCode(Window.OK);
- close();
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- createButton(parent, Window.CANCEL, Plugin.getInstance().getMessageService().resolveMessageKey("dialog.close"), false);
-
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- setTitleImage(SWTResourceManager.getImage(ConfigurationDialog.class, "/icons/logo.png"));
- Composite composite = (Composite) super.createDialogArea(parent);
- composite.setLayout(null);
-
- this.btnConnect = new Button(composite, SWT.NONE);
- this.btnConnect.setBounds(5, 5, 145, 25);
- this.btnConnect.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dialog.tables.connect"));
- this.btnConnect.setImage(SWTResourceManager.getImage(ConfigurationDialog.class, "/icons/testConnection.gif"));
- this.btnConnect.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- try
- {
- Connection con = Plugin.getInstance().getJDBCConnection(DBTablesDialog.this.config.getJdbcType(),
- DBTablesDialog.this.config.getJdbcServer(),
- DBTablesDialog.this.config.getJdbcPort(),
- DBTablesDialog.this.config.getJdbcSID(),
- DBTablesDialog.this.config.getJdbcUser(),
- DBTablesDialog.this.config.getJdbcPwd());
- if (con != null)
- {
- DBTablesDialog.this.lblConnection.setText(Plugin.getInstance().getMessageService()
- .resolveMessageKey("connectionSuccess"));
- DBTablesDialog.this.lblConnection.setForeground(new Color(getShell().getDisplay(), 0, 255, 0));
- DBTablesDialog.this.checkboxTableViewer.setInput(con);
- if (DBTablesDialog.this.config.getDbTablePattern() != null)
- {
- String[] tablePatterns = DBTablesDialog.this.config.getDbTablePattern().split(",");
- for (String pattern : tablePatterns)
- {
- DBTablesDialog.this.checkboxTableViewer.setChecked(pattern, true);
- }
- }
- }
- con.close();
- }
- catch (Exception e)
- {
- DBTablesDialog.this.lblConnection.setText(Plugin.getInstance().getMessageService()
- .resolveMessageKey("connectionFailed"));
- DBTablesDialog.this.lblConnection.setForeground(new Color(getShell().getDisplay(), 255, 0, 0));
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
-
- this.checkboxTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- final Table table = this.checkboxTableViewer.getTable();
- table.setBounds(5, 35, 290, 231);
- table.setLinesVisible(true);
-
- final Button btnCheckAll = new Button(composite, SWT.NONE);
- btnCheckAll.setBounds(301, 35, 26, 26);
- btnCheckAll.setImage(SWTResourceManager.getImage(ConfigurationDialog.class, "/icons/check_all.gif"));
- btnCheckAll.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- Table table = DBTablesDialog.this.checkboxTableViewer.getTable();
- for (int i = 0; i < table.getItemCount(); i++)
- {
- table.getItem(i).setChecked(true);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
-
- final Button btnUncheckAll = new Button(composite, SWT.NONE);
- btnUncheckAll.setBounds(301, 67, 26, 26);
- btnUncheckAll.setImage(SWTResourceManager.getImage(ConfigurationDialog.class, "/icons/uncheck_all.gif"));
- btnUncheckAll.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- Table table = DBTablesDialog.this.checkboxTableViewer.getTable();
- for (int i = 0; i < table.getItemCount(); i++)
- {
- table.getItem(i).setChecked(false);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
-
- this.lblConnection = new Label(composite, SWT.NONE);
- this.lblConnection.setBounds(156, 10, 139, 15);
- this.checkboxTableViewer.setContentProvider(new DBTablesContentProvider(this.config));
- this.checkboxTableViewer.setLabelProvider(new DBTablesLabelProvider());
-
- setHelpAvailable(false);
- return composite;
- }
-
- public String getSelectedTables()
- {
- return this.selectedTables;
- }
-
- public void setSelectedTables(String selectedTables)
- {
- this.selectedTables = selectedTables;
- }
-}
-
-class DBTablesContentProvider implements IStructuredContentProvider
-{
- private static final Logger log = LoggerFactory.getLogger(DBTablesContentProvider.class);
-
- private static final Object[] EMPTY = new Object[] {};
-
- private final CodeGenConfig config;
-
- public DBTablesContentProvider(CodeGenConfig config)
- {
- this.config = config;
- }
-
- public Object[] getElements(Object arg0)
- {
- Connection con = (Connection) arg0;
- ResultSet tables = null;
- ArrayList<String> tableNames = new ArrayList<String>();
- try
- {
- DatabaseMetaData dbMeta = con.getMetaData();
- // Get table metadata
- tables = dbMeta.getTables(this.config.getDbCatalog(), this.config.getDbSchema(), "%", new String[] { "TABLE", "VIEW" });
- // Add all tables and views
- while (tables.next())
- {
- String tableName = tables.getString("TABLE_NAME");
- String tableType = tables.getString("TABLE_TYPE");
- // Ignore system tables containing a '$' symbol (required for
- // Oracle!)
- if (tableName.indexOf('$') >= 0)
- {
- DBTablesContentProvider.log.info("Ignoring system table " + tableName);
- continue;
- }
- DBTablesContentProvider.log.info(tableType + ": " + tableName);
- tableNames.add(tableName);
- }
- return tableNames.toArray();
- }
- catch (SQLException e)
- {
- DBTablesContentProvider.log.info("Error loading meta data: " + e.getMessage());
- }
- finally
- {
- DBUtil.close(tables, DBTablesContentProvider.log);
- }
- return DBTablesContentProvider.EMPTY;
- }
-
- public void dispose()
- {
- // Nothing to dispose
- }
-
- public void inputChanged(Viewer arg0, Object arg1, Object arg2)
- {
- // Nothing to do
- }
-}
-
-class DBTablesLabelProvider implements ILabelProvider
-{
- public Image getImage(Object arg0)
- {
- return null;
- }
-
- /**
- * Returns the name of the file
- *
- * @param arg0
- * the name of the file
- * @return String
- */
- public String getText(Object arg0)
- {
- return (String) arg0;
- }
-
- public void addListener(ILabelProviderListener arg0)
- {
- // Throw it away
- }
-
- public void dispose()
- {
- // Nothing to dispose
- }
-
- public boolean isLabelProperty(Object arg0, String arg1)
- {
- return false;
- }
-
- public void removeListener(ILabelProviderListener arg0)
- {
- // Ignore
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/INavigator.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/INavigator.java
deleted file mode 100644
index ca366a2..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/INavigator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import org.apache.empire.db.eclipse.model.ConfigFile;
-
-public interface INavigator
-{
- public void addPage(Page page);
-
- public boolean removePage(Page page);
-
- public boolean showNextPage();
-
- public boolean showPreviousPage();
-
- public boolean hasNextPage();
-
- public boolean hasPreviousPage();
-
- public ConfigFile save();
-
- public void load(ConfigFile config);
-
- public ConfigFile getCurrentConfig();
-
- public void setPagesEnabled(boolean enabled);
-
- public boolean checkRequiredFields();
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/IPage.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/IPage.java
deleted file mode 100644
index 550d675..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/IPage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import org.apache.empire.db.eclipse.CodeGenConfig;
-
-public interface IPage
-{
- public void save(CodeGenConfig config);
-
- public void load(CodeGenConfig config);
-
- public boolean checkRequiredFields();
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/MainPage.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/MainPage.java
deleted file mode 100644
index 7edeefb..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/MainPage.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import java.sql.Connection;
-
-import org.apache.empire.commons.StringUtils;
-import org.apache.empire.db.eclipse.CodeGenConfig;
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.util.SWTResourceManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class MainPage extends Page
-{
- private final Text ctlConfigTitle;
- private final Text ctlServerUrl;
- private final Text ctlServerPort;
- private final Text ctlUser;
- private final Text ctlPassword;
- private final Text ctlPasswordConfirm;
- private final Text ctlSID;
-
- private final Combo ctlExistingConfigs;
- private final Combo ctlDatabaseType;
-
- private final Group groupJdbc;
-
- private final Button btnAdd;
- private final Button btnSave;
- private final Button btnDelete;
- private final Label lblDatabaseType;
- private final Label lblServerAddress;
- private final Label lblServerPort;
- private final Label lblUser;
- private final Label lblPassword;
- private final Label lblPasswordConfirm;
- private final Label lblSid;
- private final Label lblConfigurationTitle;
- private final Button btnTestConnection;
- private final Label lblTestConResult;
-
- /**
- * Create the composite.
- *
- * @param parent
- * @param style
- */
- public MainPage(Composite parent, int style)
- {
- super(parent, style);
- setLayout(null);
-
- Label lblExistingConfigurations = new Label(this, SWT.NONE);
- lblExistingConfigurations.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
- lblExistingConfigurations.setBounds(6, 31, 154, 15);
- lblExistingConfigurations.setText(Plugin.getInstance().getMessageService().resolveMessageKey("existingConfigs"));
-
- this.ctlExistingConfigs = new Combo(this, SWT.READ_ONLY);
- this.ctlExistingConfigs.setItems(Plugin.getInstance().getConfigFileService().getConfigTitles());
- this.ctlExistingConfigs.setBounds(165, 27, 248, 23);
- this.btnAdd = new Button(this, SWT.NONE);
- this.btnAdd.setBounds(419, 25, 26, 26);
- this.btnAdd.setImage(SWTResourceManager.getImage(MainPage.class, "/icons/addButton.png"));
-
- this.lblConfigurationTitle = new Label(this, SWT.NONE);
- this.lblConfigurationTitle.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
- this.lblConfigurationTitle.setBounds(6, 62, 154, 15);
- this.lblConfigurationTitle.setText(Plugin.getInstance().getMessageService().resolveMessageKey("configTitle"));
-
- this.ctlConfigTitle = new Text(this, SWT.BORDER);
- this.ctlConfigTitle.setBounds(165, 59, 216, 21);
-
- this.btnSave = new Button(this, SWT.NONE);
- this.btnSave.setImage(SWTResourceManager.getImage(MainPage.class, "/icons/save.png"));
- this.btnSave.setBounds(387, 56, 26, 26);
-
- this.btnDelete = new Button(this, SWT.NONE);
- this.btnDelete.setBounds(419, 56, 26, 26);
- this.btnDelete.setImage(SWTResourceManager.getImage(MainPage.class, "/icons/deleteButton.png"));
-
- this.groupJdbc = new Group(this, SWT.NONE);
- this.groupJdbc.setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
- this.groupJdbc.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbConnection"));
- this.groupJdbc.setBounds(5, 110, 440, 243);
-
- this.lblDatabaseType = new Label(this.groupJdbc, SWT.NONE);
- this.lblDatabaseType.setBounds(10, 21, 154, 15);
- this.lblDatabaseType.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbConnectionType"));
-
- this.ctlDatabaseType = new Combo(this.groupJdbc, SWT.READ_ONLY);
- this.ctlDatabaseType.setBounds(180, 18, 250, 23);
- this.ctlDatabaseType.setItems(Plugin.getInstance().getDriverClassNames());
-
- this.lblServerAddress = new Label(this.groupJdbc, SWT.NONE);
- this.lblServerAddress.setBounds(10, 49, 154, 17);
- this.lblServerAddress.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbServer"));
-
- this.ctlServerUrl = new Text(this.groupJdbc, SWT.BORDER);
- this.ctlServerUrl.setBounds(180, 46, 250, 21);
-
- this.lblServerPort = new Label(this.groupJdbc, SWT.NONE);
- this.lblServerPort.setBounds(10, 75, 154, 15);
- this.lblServerPort.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbPort"));
-
- this.ctlServerPort = new Text(this.groupJdbc, SWT.BORDER);
- this.ctlServerPort.setBounds(180, 72, 78, 21);
-
- this.ctlSID = new Text(this.groupJdbc, SWT.BORDER);
- this.ctlSID.setBounds(180, 99, 250, 21);
-
- this.lblSid = new Label(this.groupJdbc, SWT.NONE);
- this.lblSid.setBounds(10, 102, 154, 15);
- this.lblSid.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbSid"));
-
- this.lblUser = new Label(this.groupJdbc, SWT.NONE);
- this.lblUser.setBounds(10, 129, 154, 15);
- this.lblUser.setText(Plugin.getInstance().getMessageService().resolveMessageKey("jdbcUser"));
-
- this.ctlUser = new Text(this.groupJdbc, SWT.BORDER);
- this.ctlUser.setBounds(180, 126, 250, 21);
-
- this.lblPassword = new Label(this.groupJdbc, SWT.NONE);
- this.lblPassword.setBounds(10, 156, 154, 15);
- this.lblPassword.setText(Plugin.getInstance().getMessageService().resolveMessageKey("jdbcPassword"));
-
- this.ctlPassword = new Text(this.groupJdbc, SWT.BORDER | SWT.PASSWORD);
- this.ctlPassword.setBounds(180, 153, 250, 21);
-
- this.lblPasswordConfirm = new Label(this.groupJdbc, SWT.NONE);
- this.lblPasswordConfirm.setBounds(10, 183, 154, 15);
- this.lblPasswordConfirm.setText(Plugin.getInstance().getMessageService().resolveMessageKey("jdbcPasswordConfirm"));
-
- this.ctlPasswordConfirm = new Text(this.groupJdbc, SWT.BORDER | SWT.PASSWORD);
- this.ctlPasswordConfirm.setBounds(180, 180, 250, 21);
-
- this.btnTestConnection = new Button(this.groupJdbc, SWT.NONE);
- this.btnTestConnection.setImage(SWTResourceManager.getImage(MainPage.class, "/icons/testConnection.gif"));
- this.btnTestConnection.setText(Plugin.getInstance().getMessageService().resolveMessageKey("testConnection"));
- this.btnTestConnection.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.testConnection"));
- this.btnTestConnection.setBounds(10, 207, 166, 26);
-
- this.lblTestConResult = new Label(this.groupJdbc, SWT.NONE);
- this.lblTestConResult.setBounds(180, 213, 250, 15);
- this.btnTestConnection.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- try
- {
- if (!MainPage.this.ctlPassword.getText().equals(MainPage.this.ctlPasswordConfirm.getText()))
- {
- MessageDialog.openError(getShell(),
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.passwordMismatch"),
- Plugin.getInstance().getMessageService()
- .resolveMessageKey("dialog.passwordMismatch.msg"));
- return;
- }
- Connection con = Plugin.getInstance().getJDBCConnection(MainPage.this.ctlDatabaseType.getText(),
- MainPage.this.ctlServerUrl.getText(),
- MainPage.this.ctlServerPort.getText(),
- MainPage.this.ctlSID.getText(),
- MainPage.this.ctlUser.getText(),
- MainPage.this.ctlPassword.getText());
- if (con != null && !con.isClosed())
- {
- MainPage.this.lblTestConResult.setText(Plugin.getInstance().getMessageService()
- .resolveMessageKey("connectionSuccess"));
- MainPage.this.lblTestConResult.setForeground(new Color(getDisplay(), 0, 255, 0));
- }
- else
- {
- MainPage.this.lblTestConResult.setText(Plugin.getInstance().getMessageService()
- .resolveMessageKey("connectionFailed"));
- MainPage.this.lblTestConResult.setForeground(new Color(getDisplay(), 255, 0, 0));
- }
- if (con != null)
- {
- con.close();
- }
- }
- catch (Exception e)
- {
- MainPage.this.lblTestConResult.setText(Plugin.getInstance().getMessageService()
- .resolveMessageKey("connectionFailed"));
- MainPage.this.lblTestConResult.setForeground(new Color(getDisplay(), 255, 0, 0));
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
- }
-
- public void save(CodeGenConfig config)
- {
- config.setConfigTitle(this.ctlConfigTitle.getText());
- config.setJdbcServer(this.ctlServerUrl.getText());
- config.setJdbcPort(this.ctlServerPort.getText());
- config.setJdbcSID(this.ctlSID.getText());
- config.setJdbcUser(this.ctlUser.getText());
- config.setJdbcPwd(this.ctlPassword.getText());
- config.setJdbcType(this.ctlDatabaseType.getText());
- }
-
- public void load(CodeGenConfig config)
- {
- setControlText(this.ctlConfigTitle, config.getConfigTitle());
- setControlText(this.ctlServerUrl, config.getJdbcServer());
- setControlText(this.ctlServerPort, config.getJdbcPort());
- setControlText(this.ctlSID, config.getJdbcSID());
- setControlText(this.ctlUser, config.getJdbcUser());
- setControlText(this.ctlPassword, config.getJdbcPwd());
- this.ctlDatabaseType.setText(!StringUtils.isEmpty(config.getJdbcType()) ? config.getJdbcType() : " ");
- this.lblTestConResult.setText(" ");
- }
-
- @Override
- public void setEnabled(boolean enabled)
- {
- this.ctlConfigTitle.setEnabled(enabled);
- this.ctlServerUrl.setEnabled(enabled);
- this.ctlServerPort.setEnabled(enabled);
- this.ctlUser.setEnabled(enabled);
- this.ctlPassword.setEnabled(enabled);
- this.ctlPasswordConfirm.setEnabled(enabled);
- this.ctlSID.setEnabled(enabled);
- this.ctlDatabaseType.setEnabled(enabled);
- this.btnTestConnection.setEnabled(enabled);
- }
-
- public boolean checkRequiredFields()
- {
- if (!this.ctlPassword.getText().equals(this.ctlPasswordConfirm.getText()))
- {
- MessageDialog.openError(getShell(), Plugin.getInstance().getMessageService().resolveMessageKey("dialog.passwordMismatch"),
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.passwordMismatch.msg"));
- return false;
- }
- return checkControlFilled(this.ctlConfigTitle, this.lblConfigurationTitle.getText())
- && checkControlFilled(this.ctlServerUrl, this.lblServerAddress.getText())
- && checkControlFilled(this.ctlServerPort, this.lblServerPort.getText())
- && checkControlFilled(this.ctlUser, this.lblUser.getText())
- && checkControlFilled(this.ctlPassword, this.lblPassword.getText())
- && checkControlFilled(this.ctlPasswordConfirm, this.lblPasswordConfirm.getText())
- && checkControlFilled(this.ctlSID, this.lblSid.getText());
- }
-
- public void addExistingConfigsListener(SelectionListener listener)
- {
- this.ctlExistingConfigs.addSelectionListener(listener);
- }
-
- public void addBtnAddListener(SelectionListener listener)
- {
- this.btnAdd.addSelectionListener(listener);
- }
-
- public void addBtnSaveListener(SelectionListener listener)
- {
- this.btnSave.addSelectionListener(listener);
- }
-
- public void addBtnDeleteListener(SelectionListener listener)
- {
- this.btnDelete.addSelectionListener(listener);
- }
-
- public void setConfigTitleList(String[] configTitleList)
- {
- this.ctlExistingConfigs.setItems(configTitleList);
- }
-
- @Override
- protected void checkSubclass()
- {
- // Disable the check that prevents subclassing of SWT components
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/Navigator.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/Navigator.java
deleted file mode 100644
index 28534d7..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/Navigator.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.empire.db.eclipse.CodeGenConfig;
-import org.apache.empire.db.eclipse.model.ConfigFile;
-
-public class Navigator implements INavigator
-{
- private final List<Page> pages;
-
- private int currentPage;
-
- private ConfigFile currentConfig;
-
- public Navigator()
- {
- this.pages = new ArrayList<Page>();
- this.currentPage = 0;
- }
-
- public void addPage(Page page)
- {
- if (this.pages.size() > 0)
- {
- page.setVisible(false);
- }
- this.pages.add(page);
- }
-
- public boolean removePage(Page page)
- {
- if (!this.pages.contains(page))
- {
- return false;
- }
- return this.pages.remove(page);
- }
-
- public boolean showNextPage()
- {
- if (!hasNextPage())
- {
- return false;
- }
- this.pages.get(this.currentPage).setVisible(false);
- this.currentPage++;
- this.pages.get(this.currentPage).setVisible(true);
- return true;
- }
-
- public boolean showPreviousPage()
- {
- if (!hasPreviousPage())
- {
- return false;
- }
- this.pages.get(this.currentPage).setVisible(false);
- this.currentPage--;
- this.pages.get(this.currentPage).setVisible(true);
- return true;
- }
-
- public boolean hasNextPage()
- {
- return this.currentPage < this.pages.size() - 1;
- }
-
- public boolean hasPreviousPage()
- {
- return this.currentPage > 0;
- }
-
- public ConfigFile save()
- {
- if (this.currentConfig == null)
- {
- return null;
- }
- for (Page page : this.pages)
- {
- page.save(this.currentConfig.getCodeGenConfig());
- }
- return this.currentConfig;
- }
-
- public void load(ConfigFile config)
- {
- setCurrentConfig(config);
- for (Page page : this.pages)
- {
- page.load(config != null ? config.getCodeGenConfig() : new CodeGenConfig());
- }
- }
-
- public ConfigFile getCurrentConfig()
- {
- return this.currentConfig;
- }
-
- private void setCurrentConfig(ConfigFile currentConfig)
- {
- setPagesEnabled(currentConfig != null);
- this.currentConfig = currentConfig;
- }
-
- public void setPagesEnabled(boolean enabled)
- {
- for (Page page : this.pages)
- {
- page.setEnabled(enabled);
- }
- }
-
- public boolean checkRequiredFields()
- {
- for (Page page : this.pages)
- {
- if (!page.checkRequiredFields())
- {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/Page.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/Page.java
deleted file mode 100644
index badca1a..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/Page.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import org.apache.empire.commons.StringUtils;
-import org.apache.empire.db.eclipse.Plugin;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-public abstract class Page extends Composite implements IPage
-{
- public Page(Composite parent, int style)
- {
- super(parent, style);
- this.setSize(450, 500);
- this.setBounds(10, 0, 450, 500);
- }
-
- protected void setControlText(Text ctlText, String value)
- {
- ctlText.setText(value != null ? value : "");
- }
-
- protected boolean checkControlFilled(Text ctlText, String field)
- {
- if (StringUtils.isNotEmpty(ctlText.getText()))
- {
- return true;
- }
- MessageDialog.openError(getShell(), Plugin.getInstance().getMessageService().resolveMessageKey("dialog.errorFieldRequired"),
- Plugin.getInstance().getMessageService().resolveMessageKey("dialog.errorFieldRequired.msg", field));
- return false;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/SchemaOptionsPage.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/SchemaOptionsPage.java
deleted file mode 100644
index 69ce3c3..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/ui/SchemaOptionsPage.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.ui;
-
-import org.apache.empire.db.eclipse.CodeGenConfig;
-import org.apache.empire.db.eclipse.Plugin;
-import org.apache.empire.db.eclipse.util.SWTResourceManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class SchemaOptionsPage extends Page
-{
- private final Text ctlDbCatalog;
- private final Text ctlDbSchema;
- private final Text ctlTimestampCol;
- private final Text ctlDbTablePattern;
-
- private final Text ctlTargetFolder;
- private final Text ctlPackageName;
- private final Text ctlTablePackageName;
- private final Text ctlViewPackageName;
- private final Text ctlRecordPackageName;
-
- private final Group groupRequired;
-
- private final Label lblTargetFolder;
- private final Label lblPackageName;
- private final Label lblTablePackageName;
- private final Label lblViewPackageName;
- private final Label lblRecordPackageName;
- private final Button btnDirectoryDialog;
- private final Button btnOpenTableDialog;
-
- public SchemaOptionsPage(Composite parent, int style)
- {
- super(parent, style);
- setLayout(null);
-
- Group grpSchemaOptions = new Group(this, SWT.NONE);
- grpSchemaOptions.setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
- grpSchemaOptions.setText(Plugin.getInstance().getMessageService().resolveMessageKey("schemaOptions"));
- grpSchemaOptions.setBounds(5, 30, 440, 128);
-
- Label lblDbCatalog = new Label(grpSchemaOptions, SWT.NONE);
- lblDbCatalog.setBounds(10, 23, 154, 17);
- lblDbCatalog.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbCatalog"));
- lblDbCatalog.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbCatalog"));
-
- this.ctlDbCatalog = new Text(grpSchemaOptions, SWT.BORDER);
- this.ctlDbCatalog.setBounds(180, 20, 250, 21);
- this.ctlDbCatalog.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbCatalog"));
-
- Label lblDbSchema = new Label(grpSchemaOptions, SWT.NONE);
- lblDbSchema.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbSchema"));
- lblDbSchema.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbSchema"));
- lblDbSchema.setBounds(10, 49, 154, 17);
-
- this.ctlDbSchema = new Text(grpSchemaOptions, SWT.BORDER);
- this.ctlDbSchema.setBounds(180, 46, 250, 21);
- this.ctlDbSchema.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbSchema"));
-
- Label lblDbTablePattern = new Label(grpSchemaOptions, SWT.NONE);
- lblDbTablePattern.setText(Plugin.getInstance().getMessageService().resolveMessageKey("dbTablePattern"));
- lblDbTablePattern.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbTablePattern"));
- lblDbTablePattern.setBounds(10, 75, 154, 17);
-
- this.ctlDbTablePattern = new Text(grpSchemaOptions, SWT.BORDER);
- this.ctlDbTablePattern.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.dbTablePattern"));
- this.getCtlDbTablePattern().setBounds(180, 72, 218, 21);
-
- Label lblTimestampCol = new Label(grpSchemaOptions, SWT.NONE);
- lblTimestampCol.setText(Plugin.getInstance().getMessageService().resolveMessageKey("timestampColumn"));
- lblTimestampCol.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.timestampColumn"));
- lblTimestampCol.setBounds(10, 98, 154, 17);
-
- this.ctlTimestampCol = new Text(grpSchemaOptions, SWT.BORDER);
- this.ctlTimestampCol.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.timestampColumn"));
- this.ctlTimestampCol.setBounds(180, 98, 250, 21);
-
- this.btnOpenTableDialog = new Button(grpSchemaOptions, SWT.NONE);
- this.btnOpenTableDialog.setBounds(404, 69, 26, 26);
- this.btnOpenTableDialog.setImage(SWTResourceManager.getImage(SchemaOptionsPage.class, "/icons/db_element.gif"));
-
- this.groupRequired = new Group(this, SWT.NONE);
- this.groupRequired.setText(Plugin.getInstance().getMessageService().resolveMessageKey("requiredParams"));
- this.groupRequired.setFont(SWTResourceManager.getFont("Segoe UI", 10, SWT.BOLD));
- this.groupRequired.setBounds(5, 180, 440, 149);
-
- this.lblTargetFolder = new Label(this.groupRequired, SWT.NONE);
- this.lblTargetFolder.setBounds(10, 18, 154, 15);
- this.lblTargetFolder.setText(Plugin.getInstance().getMessageService().resolveMessageKey("targetFolder"));
- this.lblTargetFolder.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.targetFolder"));
-
- this.ctlTargetFolder = new Text(this.groupRequired, SWT.BORDER);
- this.ctlTargetFolder.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.targetFolder"));
- this.ctlTargetFolder.setBounds(180, 15, 218, 21);
-
-
- this.btnDirectoryDialog = new Button(this.groupRequired, SWT.NONE);
- this.btnDirectoryDialog.setImage(SWTResourceManager.getImage(SchemaOptionsPage.class, "/icons/folder.gif"));
- this.btnDirectoryDialog.setBounds(404, 12, 26, 26);
- this.btnDirectoryDialog.addSelectionListener(new SelectionListener()
- {
- public void widgetSelected(SelectionEvent arg0)
- {
- DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
- directoryDialog.setFilterPath(SchemaOptionsPage.this.ctlTargetFolder.getText());
- String path = directoryDialog.open();
- if (path != null)
- {
- SchemaOptionsPage.this.ctlTargetFolder.setText(path);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0)
- {
- }
- });
-
- this.lblPackageName = new Label(this.groupRequired, SWT.NONE);
- this.lblPackageName.setBounds(10, 45, 154, 15);
- this.lblPackageName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("packageName"));
- this.lblPackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.packageName"));
-
- this.ctlPackageName = new Text(this.groupRequired, SWT.BORDER);
- this.ctlPackageName.setBounds(180, 42, 250, 21);
- this.ctlPackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.packageName"));
-
- this.lblTablePackageName = new Label(this.groupRequired, SWT.NONE);
- this.lblTablePackageName.setBounds(10, 72, 154, 15);
- this.lblTablePackageName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("tablePackageName"));
- this.lblTablePackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tablePackageName"));
-
- this.ctlTablePackageName = new Text(this.groupRequired, SWT.BORDER);
- this.ctlTablePackageName.setBounds(180, 69, 250, 21);
- this.ctlTablePackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.tablePackageName"));
-
- this.lblViewPackageName = new Label(this.groupRequired, SWT.NONE);
- this.lblViewPackageName.setBounds(10, 99, 154, 15);
- this.lblViewPackageName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("viewPackageName"));
- this.lblViewPackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewPackageName"));
-
- this.ctlViewPackageName = new Text(this.groupRequired, SWT.BORDER);
- this.ctlViewPackageName.setBounds(180, 96, 250, 21);
- this.ctlViewPackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.viewPackageName"));
-
- this.lblRecordPackageName = new Label(this.groupRequired, SWT.NONE);
- this.lblRecordPackageName.setBounds(10, 126, 154, 15);
- this.lblRecordPackageName.setText(Plugin.getInstance().getMessageService().resolveMessageKey("recordPackageName"));
- this.lblRecordPackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.recordPackageName"));
-
- this.ctlRecordPackageName = new Text(this.groupRequired, SWT.BORDER);
- this.ctlRecordPackageName.setBounds(180, 123, 250, 21);
- this.ctlRecordPackageName.setToolTipText(Plugin.getInstance().getMessageService().resolveMessageKey("tooltip.recordPackageName"));
- }
-
- public void save(CodeGenConfig config)
- {
- config.setDbCatalog(this.ctlDbCatalog.getText());
- config.setDbSchema(this.ctlDbSchema.getText());
- config.setTimestampColumn(this.ctlTimestampCol.getText());
- config.setDbTablePattern(this.getCtlDbTablePattern().getText());
- config.setTargetFolder(this.ctlTargetFolder.getText());
- config.setPackageName(this.ctlPackageName.getText());
- config.setTablePackageName(this.ctlTablePackageName.getText());
- config.setViewPackageName(this.ctlViewPackageName.getText());
- config.setRecordPackageName(this.ctlRecordPackageName.getText());
- }
-
- public void load(CodeGenConfig config)
- {
- setControlText(this.ctlDbCatalog, config.getDbCatalog());
- setControlText(this.ctlDbSchema, config.getDbSchema());
- setControlText(this.ctlTimestampCol, config.getTimestampColumn());
- setControlText(this.getCtlDbTablePattern(), config.getDbTablePattern());
- setControlText(this.ctlTargetFolder, config.getTargetFolder());
- setControlText(this.ctlPackageName, config.getPackageName());
- setControlText(this.ctlTablePackageName, config.getTablePackageName());
- setControlText(this.ctlViewPackageName, config.getViewPackageName());
- setControlText(this.ctlRecordPackageName, config.getRecordPackageName());
-
- }
-
- @Override
- public void setEnabled(boolean enabled)
- {
- this.ctlDbCatalog.setEnabled(enabled);
- this.ctlDbSchema.setEnabled(enabled);
- this.ctlTimestampCol.setEnabled(enabled);
- this.getCtlDbTablePattern().setEnabled(enabled);
- this.ctlTargetFolder.setEnabled(enabled);
- this.ctlPackageName.setEnabled(enabled);
- this.ctlTablePackageName.setEnabled(enabled);
- this.ctlViewPackageName.setEnabled(enabled);
- this.ctlRecordPackageName.setEnabled(enabled);
- this.btnDirectoryDialog.setEnabled(enabled);
- this.btnOpenTableDialog.setEnabled(enabled);
- }
-
- public boolean checkRequiredFields()
- {
- return checkControlFilled(this.ctlTargetFolder, this.lblTargetFolder.getText())
- && checkControlFilled(this.ctlPackageName, this.lblPackageName.getText())
- && checkControlFilled(this.ctlTablePackageName, this.lblTablePackageName.getText())
- && checkControlFilled(this.ctlViewPackageName, this.lblViewPackageName.getText())
- && checkControlFilled(this.ctlRecordPackageName, this.lblRecordPackageName.getText());
- }
-
- public void addBtnTableDialogListener(SelectionListener selectionListener)
- {
- this.btnOpenTableDialog.addSelectionListener(selectionListener);
- }
-
- public Text getCtlDbTablePattern()
- {
- return this.ctlDbTablePattern;
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/util/SWTResourceManager.java b/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/util/SWTResourceManager.java
deleted file mode 100644
index 8217af2..0000000
--- a/empire-db-eclipse-codegen/src/main/java/org/apache/empire/db/eclipse/util/SWTResourceManager.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.db.eclipse.util;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
- * <p>
- * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
- * operating system resources managed by cached objects when those objects and OS resources are no longer
- * needed (e.g. on application shutdown)
- * <p>
- * This class may be freely distributed as part of any application or plugin.
- * <p>
- * @author scheglov_ke
- * @author Dan Rubel
- */
-public class SWTResourceManager {
- ////////////////////////////////////////////////////////////////////////////
- //
- // Color
- //
- ////////////////////////////////////////////////////////////////////////////
- private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>();
- /**
- * Returns the system {@link Color} matching the specific ID.
- *
- * @param systemColorID
- * the ID value for the color
- * @return the system {@link Color} matching the specific ID
- */
- public static Color getColor(int systemColorID) {
- Display display = Display.getCurrent();
- return display.getSystemColor(systemColorID);
- }
- /**
- * Returns a {@link Color} given its red, green and blue component values.
- *
- * @param r
- * the red component of the color
- * @param g
- * the green component of the color
- * @param b
- * the blue component of the color
- * @return the {@link Color} matching the given red, green and blue component values
- */
- public static Color getColor(int r, int g, int b) {
- return getColor(new RGB(r, g, b));
- }
- /**
- * Returns a {@link Color} given its RGB value.
- *
- * @param rgb
- * the {@link RGB} value of the color
- * @return the {@link Color} matching the RGB value
- */
- public static Color getColor(RGB rgb) {
- Color color = m_colorMap.get(rgb);
- if (color == null) {
- Display display = Display.getCurrent();
- color = new Color(display, rgb);
- m_colorMap.put(rgb, color);
- }
- return color;
- }
- /**
- * Dispose of all the cached {@link Color}'s.
- */
- public static void disposeColors() {
- for (Color color : m_colorMap.values()) {
- color.dispose();
- }
- m_colorMap.clear();
- }
- ////////////////////////////////////////////////////////////////////////////
- //
- // Image
- //
- ////////////////////////////////////////////////////////////////////////////
- /**
- * Maps image paths to images.
- */
- private static Map<String, Image> m_imageMap = new HashMap<String, Image>();
- /**
- * Returns an {@link Image} encoded by the specified {@link InputStream}.
- *
- * @param stream
- * the {@link InputStream} encoding the image data
- * @return the {@link Image} encoded by the specified input stream
- */
- protected static Image getImage(InputStream stream) throws IOException {
- try {
- Display display = Display.getCurrent();
- ImageData data = new ImageData(stream);
- if (data.transparentPixel > 0) {
- return new Image(display, data, data.getTransparencyMask());
- }
- return new Image(display, data);
- } finally {
- stream.close();
- }
- }
- /**
- * Returns an {@link Image} stored in the file at the specified path.
- *
- * @param path
- * the path to the image file
- * @return the {@link Image} stored in the file at the specified path
- */
- public static Image getImage(String path) {
- Image image = m_imageMap.get(path);
- if (image == null) {
- try {
- image = getImage(new FileInputStream(path));
- m_imageMap.put(path, image);
- } catch (Exception e) {
- image = getMissingImage();
- m_imageMap.put(path, image);
- }
- }
- return image;
- }
- /**
- * Returns an {@link Image} stored in the file at the specified path relative to the specified class.
- *
- * @param clazz
- * the {@link Class} relative to which to find the image
- * @param path
- * the path to the image file, if starts with <code>'/'</code>
- * @return the {@link Image} stored in the file at the specified path
- */
- public static Image getImage(Class<?> clazz, String path) {
- String key = clazz.getName() + '|' + path;
- Image image = m_imageMap.get(key);
- if (image == null) {
- try {
- image = getImage(clazz.getResourceAsStream(path));
- m_imageMap.put(key, image);
- } catch (Exception e) {
- image = getMissingImage();
- m_imageMap.put(key, image);
- }
- }
- return image;
- }
- private static final int MISSING_IMAGE_SIZE = 10;
- /**
- * @return the small {@link Image} that can be used as placeholder for missing image.
- */
- private static Image getMissingImage() {
- Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
- //
- GC gc = new GC(image);
- gc.setBackground(getColor(SWT.COLOR_RED));
- gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
- gc.dispose();
- //
- return image;
- }
- /**
- * Style constant for placing decorator image in top left corner of base image.
- */
- public static final int TOP_LEFT = 1;
- /**
- * Style constant for placing decorator image in top right corner of base image.
- */
- public static final int TOP_RIGHT = 2;
- /**
- * Style constant for placing decorator image in bottom left corner of base image.
- */
- public static final int BOTTOM_LEFT = 3;
- /**
- * Style constant for placing decorator image in bottom right corner of base image.
- */
- public static final int BOTTOM_RIGHT = 4;
- /**
- * Internal value.
- */
- protected static final int LAST_CORNER_KEY = 5;
- /**
- * Maps images to decorated images.
- */
- @SuppressWarnings("unchecked")
- private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
- /**
- * Returns an {@link Image} composed of a base image decorated by another image.
- *
- * @param baseImage
- * the base {@link Image} that should be decorated
- * @param decorator
- * the {@link Image} to decorate the base image
- * @return {@link Image} The resulting decorated image
- */
- public static Image decorateImage(Image baseImage, Image decorator) {
- return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
- }
- /**
- * Returns an {@link Image} composed of a base image decorated by another image.
- *
- * @param baseImage
- * the base {@link Image} that should be decorated
- * @param decorator
- * the {@link Image} to decorate the base image
- * @param corner
- * the corner to place decorator image
- * @return the resulting decorated {@link Image}
- */
- public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
- if (corner <= 0 || corner >= LAST_CORNER_KEY) {
- throw new IllegalArgumentException("Wrong decorate corner");
- }
- Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
- if (cornerDecoratedImageMap == null) {
- cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
- m_decoratedImageMap[corner] = cornerDecoratedImageMap;
- }
- Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
- if (decoratedMap == null) {
- decoratedMap = new HashMap<Image, Image>();
- cornerDecoratedImageMap.put(baseImage, decoratedMap);
- }
- //
- Image result = decoratedMap.get(decorator);
- if (result == null) {
- Rectangle bib = baseImage.getBounds();
- Rectangle dib = decorator.getBounds();
- //
- result = new Image(Display.getCurrent(), bib.width, bib.height);
- //
- GC gc = new GC(result);
- gc.drawImage(baseImage, 0, 0);
- if (corner == TOP_LEFT) {
- gc.drawImage(decorator, 0, 0);
- } else if (corner == TOP_RIGHT) {
- gc.drawImage(decorator, bib.width - dib.width, 0);
- } else if (corner == BOTTOM_LEFT) {
- gc.drawImage(decorator, 0, bib.height - dib.height);
- } else if (corner == BOTTOM_RIGHT) {
- gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height);
- }
- gc.dispose();
- //
- decoratedMap.put(decorator, result);
- }
- return result;
- }
- /**
- * Dispose all of the cached {@link Image}'s.
- */
- public static void disposeImages() {
- // dispose loaded images
- {
- for (Image image : m_imageMap.values()) {
- image.dispose();
- }
- m_imageMap.clear();
- }
- // dispose decorated images
- for (int i = 0; i < m_decoratedImageMap.length; i++) {
- Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
- if (cornerDecoratedImageMap != null) {
- for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
- for (Image image : decoratedMap.values()) {
- image.dispose();
- }
- decoratedMap.clear();
- }
- cornerDecoratedImageMap.clear();
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////
- //
- // Font
- //
- ////////////////////////////////////////////////////////////////////////////
- /**
- * Maps font names to fonts.
- */
- private static Map<String, Font> m_fontMap = new HashMap<String, Font>();
- /**
- * Maps fonts to their bold versions.
- */
- private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>();
- /**
- * Returns a {@link Font} based on its name, height and style.
- *
- * @param name
- * the name of the font
- * @param height
- * the height of the font
- * @param style
- * the style of the font
- * @return {@link Font} The font matching the name, height and style
- */
- public static Font getFont(String name, int height, int style) {
- return getFont(name, height, style, false, false);
- }
- /**
- * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline
- * flags are also supported.
- *
- * @param name
- * the name of the font
- * @param size
- * the size of the font
- * @param style
- * the style of the font
- * @param strikeout
- * the strikeout flag (warning: Windows only)
- * @param underline
- * the underline flag (warning: Windows only)
- * @return {@link Font} The font matching the name, height, style, strikeout and underline
- */
- public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
- String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
- Font font = m_fontMap.get(fontName);
- if (font == null) {
- FontData fontData = new FontData(name, size, style);
- if (strikeout || underline) {
- try {
- Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
- Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
- if (logFont != null && logFontClass != null) {
- if (strikeout) {
- logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
- }
- if (underline) {
- logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
- }
- }
- } catch (Throwable e) {
- System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- font = new Font(Display.getCurrent(), fontData);
- m_fontMap.put(fontName, font);
- }
- return font;
- }
- /**
- * Returns a bold version of the given {@link Font}.
- *
- * @param baseFont
- * the {@link Font} for which a bold version is desired
- * @return the bold version of the given {@link Font}
- */
- public static Font getBoldFont(Font baseFont) {
- Font font = m_fontToBoldFontMap.get(baseFont);
- if (font == null) {
- FontData fontDatas[] = baseFont.getFontData();
- FontData data = fontDatas[0];
- font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
- m_fontToBoldFontMap.put(baseFont, font);
- }
- return font;
- }
- /**
- * Dispose all of the cached {@link Font}'s.
- */
- public static void disposeFonts() {
- // clear fonts
- for (Font font : m_fontMap.values()) {
- font.dispose();
- }
- m_fontMap.clear();
- // clear bold fonts
- for (Font font : m_fontToBoldFontMap.values()) {
- font.dispose();
- }
- m_fontToBoldFontMap.clear();
- }
- ////////////////////////////////////////////////////////////////////////////
- //
- // Cursor
- //
- ////////////////////////////////////////////////////////////////////////////
- /**
- * Maps IDs to cursors.
- */
- private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>();
- /**
- * Returns the system cursor matching the specific ID.
- *
- * @param id
- * int The ID value for the cursor
- * @return Cursor The system cursor matching the specific ID
- */
- public static Cursor getCursor(int id) {
- Integer key = Integer.valueOf(id);
- Cursor cursor = m_idToCursorMap.get(key);
- if (cursor == null) {
- cursor = new Cursor(Display.getDefault(), id);
- m_idToCursorMap.put(key, cursor);
- }
- return cursor;
- }
- /**
- * Dispose all of the cached cursors.
- */
- public static void disposeCursors() {
- for (Cursor cursor : m_idToCursorMap.values()) {
- cursor.dispose();
- }
- m_idToCursorMap.clear();
- }
- ////////////////////////////////////////////////////////////////////////////
- //
- // General
- //
- ////////////////////////////////////////////////////////////////////////////
- /**
- * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
- * objects are no longer needed (e.g. on application shutdown).
- */
- public static void dispose() {
- disposeColors();
- disposeImages();
- disposeFonts();
- disposeCursors();
- }
-}
\ No newline at end of file
diff --git a/empire-db-eclipse-codegen/src/main/resources/defaultConfig.xml b/empire-db-eclipse-codegen/src/main/resources/defaultConfig.xml
deleted file mode 100644
index 33c77bf..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/defaultConfig.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<config>
- <properties>
- <!-- provider name must match the property-section containing the connection data -->
- <jdbcClass></jdbcClass>
- <jdbcURL></jdbcURL>
- <jdbcServer></jdbcServer>
- <jdbcPort></jdbcPort>
- <jdbcSID></jdbcSID>
- <jdbcUser></jdbcUser>
- <jdbcPwd></jdbcPwd>
-
- <!-- Schema options -->
- <dbCatalog></dbCatalog>
- <dbSchema></dbSchema>
- <dbTablePattern></dbTablePattern>
- <timestampColumn>CREATIONDATE</timestampColumn>
-
- <!-- generation options -->
- <targetFolder></targetFolder>
- <packageName>org.apache.empire.db</packageName>
- <tablePackageName>org.apache.empire.db.table</tablePackageName>
- <viewPackageName>org.apache.empire.db.view</viewPackageName>
- <recordPackageName>org.apache.empire.db.record</recordPackageName>
- <dbClassName>EmpireDB</dbClassName>
- <tableBaseName>BaseTable</tableBaseName>
- <viewBaseName>BaseView</viewBaseName>
- <recordBaseName>BaseRecord</recordBaseName>
- <tableNamePrefix></tableNamePrefix>
- <tableClassPrefix>T_</tableClassPrefix>
- <tableClassSuffix></tableClassSuffix>
- <viewNamePrefix></viewNamePrefix>
- <viewClassPrefix>V_</viewClassPrefix>
- <viewClassSuffix></viewClassSuffix>
- <columnNamePrefix></columnNamePrefix>
- <nestTables>true</nestTables>
- <nestViews>false</nestViews>
- <createRecordProperties>true</createRecordProperties>
- <preserverCharacterCase>false</preserverCharacterCase>
- <preserveRelationNames>false</preserveRelationNames>
- </properties>
-
- <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="default" class="org.apache.log4j.ConsoleAppender">
- <!-- layout class="org.apache.log4j.TTCCLayout"/ -->
- <layout class="org.apache.log4j.PatternLayout">
- <!-- param name="ConversionPattern" value="NSB(%c) %-5p %m at %l%n"/ -->
- <param name="ConversionPattern" value="%-5p [%d{yyyy/MM/dd HH:mm}]: %m at %l %n"/>
- </layout>
- </appender>
-
- <!-- log detail configuration -->
- <logger name="org.apache.empire.commons" additivity="false">
- <level value="warn"/>
- <appender-ref ref="default"/>
- </logger>
-
- <root>
- <priority value="info"/>
- <appender-ref ref="default"/>
- </root>
-
- </log4j:configuration>
-
-</config>
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/addButton.png b/empire-db-eclipse-codegen/src/main/resources/icons/addButton.png
deleted file mode 100644
index c6aeae4..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/addButton.png and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/check_all.gif b/empire-db-eclipse-codegen/src/main/resources/icons/check_all.gif
deleted file mode 100644
index 4370bf1..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/check_all.gif and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/db_element.gif b/empire-db-eclipse-codegen/src/main/resources/icons/db_element.gif
deleted file mode 100644
index 1d459ce..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/db_element.gif and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/deleteButton.png b/empire-db-eclipse-codegen/src/main/resources/icons/deleteButton.png
deleted file mode 100644
index 5f00385..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/deleteButton.png and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/empire-db-logo.gif b/empire-db-eclipse-codegen/src/main/resources/icons/empire-db-logo.gif
deleted file mode 100644
index 3d60d76..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/empire-db-logo.gif and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/empire_db_icon.png b/empire-db-eclipse-codegen/src/main/resources/icons/empire_db_icon.png
deleted file mode 100644
index 30ac6e9..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/empire_db_icon.png and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/folder.gif b/empire-db-eclipse-codegen/src/main/resources/icons/folder.gif
deleted file mode 100644
index 42e027c..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/folder.gif and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/logo.png b/empire-db-eclipse-codegen/src/main/resources/icons/logo.png
deleted file mode 100644
index 5be2395..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/logo.png and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/save.png b/empire-db-eclipse-codegen/src/main/resources/icons/save.png
deleted file mode 100644
index 3f7664f..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/save.png and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/testConnection.gif b/empire-db-eclipse-codegen/src/main/resources/icons/testConnection.gif
deleted file mode 100644
index 864034f..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/testConnection.gif and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/icons/uncheck_all.gif b/empire-db-eclipse-codegen/src/main/resources/icons/uncheck_all.gif
deleted file mode 100644
index f6b9f8a..0000000
Binary files a/empire-db-eclipse-codegen/src/main/resources/icons/uncheck_all.gif and /dev/null differ
diff --git a/empire-db-eclipse-codegen/src/main/resources/lang/messages_en.properties b/empire-db-eclipse-codegen/src/main/resources/lang/messages_en.properties
deleted file mode 100644
index b4ffc89..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/lang/messages_en.properties
+++ /dev/null
@@ -1,141 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-dialog.title=Empire db tool
-dialog.ok=Create entities
-dialog.next=Next
-dialog.back=Back
-dialog.close=Close
-dialog.errorFieldRequired=Field required
-dialog.errorFieldRequired.msg=Field {0} is required. Please fill it out.
-dialog.delete=Delete configuration
-dialog.delete.msg=Do you really want to delete this configuration?
-dialog.save=Save configuration
-dialog.save.msg=Do you want to save the current configuration?
-dialog.passwordMismatch=Password mismatch
-dialog.passwordMismatch.msg=The password does not match!
-dialog.tables.title=Table selection
-dialog.tables.discription=Select the tables to create
-dialog.tables.connect=Connect database
-dialog.tables.finish=OK
-
-existingConfigs=Existing configurations
-configTitle=Config title
-dbConnection=Database connection:
-dbConnectionType=Connection Type
-testConnection=Test connection
-dbServer=Database server
-dbPort=Database port
-dbSid=Database name
-jdbcUser=Database username
-jdbcPassword=Database password
-jdbcPasswordConfirm=Confirm password
-connectionFailed=Connection failed!
-connectionSuccess=Connection success!
-dbTablePattern=Table pattern
-targetFolder=Target folder
-packageName=Package name
-tablePackageName=Table package name
-viewPackageName=View package name
-recordPackageName=Record package name
-dbClassName=Database class name
-tableBaseName=Table base name
-viewBaseName=View base name
-recordBaseName=Record base name
-tableNamePrefix=Table prefix
-requiredParams=Package parameter:
-targetFolder=Target folder
-packageName=Package name
-tablePackageName=Table package name
-viewPackageName=View package name
-recordPackageName=Record package name
-
-# class name config
-classParameter=Class name configuration:
-dbClassName=Database class name
-tableBaseName=Table base name
-viewBaseName=View base name
-recordBaseName=Record base name
-tableNamePrefix=Table name prefix
-tableClassPrefix=Table class prefix
-tableClassSuffix=Table class suffix
-viewNamePrefix=View name prefix
-viewClassPrefix=View class prefix
-viewClassSuffix=View class suffix
-columnNamePrefix=Column name prefix
-
-# schema options
-schemaOptions=Schema options:
-dbCatalog=Catalog name
-dbSchema=Schema
-timestampColumn=Timestamp Column name
-flagGroup=Misc
-nestTables=Nest tables
-nestViews=Nest views
-createRecordProperties=Create Record Properties
-preserverCharCase=Preserver char case
-preserveRelationNames=Preserve relation names
-##############################################
-# tool tips
-##############################################
-tooltip.testConnection=Test your current connection configuration
-tooltip.dbConnectionType=
-tooltip.dbServer=
-tooltip.dbPort=
-tooltip.dbSid=
-tooltip.jdbcUser=
-tooltip.jdbcPassword=
-tooltip.jdbcPasswordConfirm=
-tooltip.dbTablePattern=
-tooltip.targetFolder=
-tooltip.packageName=
-tooltip.tablePackageName=
-tooltip.viewPackageName=
-tooltip.recordPackageName=
-tooltip.dbClassName=
-tooltip.tableBaseName=
-tooltip.viewBaseName=
-tooltip.recordBaseName=
-tooltip.tableNamePrefix=
-tooltip.targetFolder=
-tooltip.packageName=
-tooltip.tablePackageName=
-tooltip.viewPackageName=
-tooltip.recordPackageName=
-
-# class name config
-tooltip.dbClassName=Name of the generated database class. This class extends DBDatabase.
-tooltip.tableBaseName=Target name of the generated table class. This class extends DBTable and is the base class for all generated individual table classes.
-tooltip.viewBaseName=Target name of the generated view class. This class extends DBView and is the base class for all generated individual view classes.
-tooltip.recordBaseName=
-tooltip.tableNamePrefix=
-tooltip.tableClassPrefix=
-tooltip.tableClassSuffix=
-tooltip.viewNamePrefix=
-tooltip.viewClassPrefix=
-tooltip.viewClassSuffix=
-tooltip.columnNamePrefix=
-
-# schema options
-tooltip.dbCatalog=name of the database catalog.
-tooltip.dbSchema=name of the database schema.
-tooltip.timestampColumn=name of the table pattern.
-tooltip.nestTables=if TRUE table classes should be declared as inner classes of DBDatabase.\r\n if FALSE table classes should be declared as top level classes.
-tooltip.nestViews=if TRUE view classes should be declared as inner classes of DBDatabase.<br/>if FALSE view classes should be declared as top level classes.
-tooltip.createRecordProperties=if TRUE record classes should have a getter and setter for each field.<br/>Otherwise getters / setters are omitted.
-tooltip.preserverCharCase=
-tooltip.preserveRelationNames=
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/BaseRecord.vm b/empire-db-eclipse-codegen/src/main/resources/templates/BaseRecord.vm
deleted file mode 100644
index 06b0563..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/BaseRecord.vm
+++ /dev/null
@@ -1,41 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-package ${recordPackageName};
-
-import org.apache.empire.db.DBRecord;
-import ${tablePackageName}.${baseTableClassName};
-
-
-public abstract class ${baseRecordClassName}<T extends ${baseTableClassName}> extends DBRecord {
-
- private static final long serialVersionUID = 1L;
-
- public ${baseRecordClassName}(T table) {
- super(table);
- }
-
- /**
- * Returns the table this record is based upon.
- * @return The table this record is based upon.
- */
- @SuppressWarnings("unchecked")
- public T getTable() {
- return (T)super.getRowSet();
- }
-}
\ No newline at end of file
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/BaseTable.vm b/empire-db-eclipse-codegen/src/main/resources/templates/BaseTable.vm
deleted file mode 100644
index 83e090c..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/BaseTable.vm
+++ /dev/null
@@ -1,31 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-package $tablePackageName;
-
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBTable;
-
-public class ${baseTableClassName} extends DBTable {
-
- private static final long serialVersionUID = 1L;
-
- public ${baseTableClassName}(String name, DBDatabase db) {
- super(name, db);
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/BaseView.vm b/empire-db-eclipse-codegen/src/main/resources/templates/BaseView.vm
deleted file mode 100644
index c6c934f..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/BaseView.vm
+++ /dev/null
@@ -1,31 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-package $viewPackageName;
-
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBView;
-
-public abstract class ${baseViewClassName} extends DBView {
-
- private static final long serialVersionUID = 1L;
-
- public ${baseViewClassName}(String name, DBDatabase db) {
- super(name, db);
- }
-}
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/Database.vm b/empire-db-eclipse-codegen/src/main/resources/templates/Database.vm
deleted file mode 100644
index 69590a3..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/Database.vm
+++ /dev/null
@@ -1,136 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-package $basePackageName;
-
-#if($nestTables == true || $nestViews == true)
-import org.apache.empire.data.DataType;
-#end
-#if($nestViews == true)
-import org.apache.empire.db.DBCommandExpr;
-#end
-import org.apache.empire.db.DBDatabase;
-#if($preserveRelationNames == true)
-import org.apache.empire.db.DBRelation;
-#end
-#if($nestTables == true)
-import org.apache.empire.db.DBTableColumn;
-#end
-#if($nestViews == true)
-import org.apache.empire.exceptions.NotImplementedException;
-#end
-
-#if($nestTables==false || !($tablePackageName.equalsIgnoreCase($basePackageName)))
-import $tablePackageName.*;
-// $tablePackageName vs $basePackageName
-#end
-#if($nestViews==false || ($viewPackageName!=$basePackageName))
-import $viewPackageName.*;
-#end
-
-public class $dbClassName extends DBDatabase {
-
- private static $dbClassName instance;
- private static final long serialVersionUID = 1L;
-
-#foreach($table in $database.tables)
- #set($tblClass=$parser.getTableClassName($table.name))
- public final $tblClass $parser.getTableName($table) = new $tblClass(this);
-#end
-
-#foreach($view in $database.views)
- #set($viewClass=$parser.getViewClassName($view.name))
- public final $viewClass $parser.getViewName($view) = new $viewClass(this);
-#end
-
- /**
- * Returns the instance of the database.
- * @return
- */
- public static $dbClassName get() {
- if (instance == null) {
- instance = new ${dbClassName}();
- }
- return instance;
- }
-
- /**
- * Default constructor for the $dbClassName.
- */
- private ${dbClassName}() {
-
- #if($preserveRelationNames == true)
- // Define foreign key relations
-#foreach ($relation in $database.relations)
- addRelation("$relation.name", new DBRelation.DBReference[] {
-#foreach ($reference in $relation.references)
-#if($foreach.isLast())
- ${parser.getRowsetName($reference.sourceColumn.rowSet)}.${parser.getColumnName($reference.sourceColumn)}.referenceOn(${parser.getRowsetName($reference.targetColumn.rowSet)}.${parser.getColumnName($reference.targetColumn)}) });
-#else
- ${parser.getRowsetName($reference.sourceColumn.rowSet)}.${parser.getColumnName($reference.sourceColumn)}.referenceOn(${parser.getRowsetName($reference.targetColumn.rowSet)}.${parser.getColumnName($reference.targetColumn)}),
-#end
-#end
-#end
- // foreign key relations done
- }
- #else
- // Define foreign key relations
-#foreach ($relation in $database.relations)
-#if($relation.references.size()==1)
-#foreach ($reference in $relation.references)
- addRelation( ${parser.getRowsetName($reference.sourceColumn.rowSet)}.${parser.getColumnName($reference.sourceColumn)}.referenceOn(${parser.getRowsetName($reference.targetColumn.rowSet)}.${parser.getColumnName($reference.targetColumn)}));
-#end
-#else
-#foreach ($reference in $relation.references)
-#if($foreach.isFirst())
- addRelation( ${parser.getRowsetName($reference.sourceColumn.rowSet)}.${parser.getColumnName($reference.sourceColumn)}.referenceOn(${parser.getRowsetName($reference.targetColumn.rowSet)}.$parser.getColumnName($reference.targetColumn)),
-#else
-#if($foreach.isLast())
- ${parser.getRowsetName($reference.sourceColumn.rowSet)}.${parser.getColumnName($reference.sourceColumn)}.referenceOn(${parser.getRowsetName($reference.targetColumn.rowSet)}.$parser.getColumnName($reference.targetColumn)));
-#else
- ${parser.getRowsetName($reference.sourceColumn.rowSet)}.${parser.getColumnName($reference.sourceColumn)}.referenceOn(${parser.getRowsetName($reference.targetColumn.rowSet)}.$parser.getColumnName($reference.targetColumn)),
-#end
-#end
-#end
-#end
-#end
- // foreign key relations done
- }
-#end
-
- #if($nestTables == true)
- #foreach ($table in $database.tables)
- #if ($templateFolder)
- #parse( "$templateFolder/Table.vm" )
- #else
- #parse( "Table.vm" )
- #end
- #end
- #end
-
- #if($nestViews == true)
- #foreach ($view in $database.views)
- #if ($templateFolder)
- #parse( "$templateFolder/View.vm" )
- #else
- #parse( "View.vm" )
- #end
- #end
- #end
-
-}
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/Record.vm b/empire-db-eclipse-codegen/src/main/resources/templates/Record.vm
deleted file mode 100644
index a559404..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/Record.vm
+++ /dev/null
@@ -1,66 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-package ${recordPackageName};
-
-#if ($parser.hasBigDecimalField($table))
-import java.math.BigDecimal;
-#end
-
-#if ($parser.hasDateField($table))
-import java.util.Date;
-#end
-
-import ${basePackageName}.${dbClassName};
-import ${recordPackageName}.${baseRecordClassName};
-import ${tablePackageName}.$parser.getTableClassName($table.name);
-
-/**
- * Auto-generated class that represents one record (or row) of data from a
- * database table. One of these is generated for each table or view in the
- * database. The interface defines getters for auto-generated data (e.g.
- * primary key, time stamp field for optimistic locking). It generates both
- * getter and setter method for all other columns in the table, with the
- * exception of foreign key references.
- *
- * This class provides protected method that subclasses should use to provide
- * access to related records.
- */
-public class $parser.getRecordClassName($table.name) extends ${baseRecordClassName}<$parser.getTableClassName($table.name)> {
-
- private static final long serialVersionUID = 1L;
-
- public $parser.getRecordClassName($table.name)() {
- super(${dbClassName}.get().$parser.getTableName($table));
- }
-
-#if($createRecordProperties == true)
- // Access methods for all columns
-#foreach($col in $table.columns)
-
- public $parser.getJavaType($col).getCanonicalName() $parser.getAccessorName($col)() {
- return ($parser.getJavaType($col).getCanonicalName())super.getValue(getTable().${parser.getColumnName($col)});
- }
- public void $parser.getMutatorName($col)($parser.getJavaType($col).getCanonicalName() val) {
- super.setValue(getTable().${parser.getColumnName($col)}, val);
- }
-#end
-#end
-
-
-}
\ No newline at end of file
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/Table.vm b/empire-db-eclipse-codegen/src/main/resources/templates/Table.vm
deleted file mode 100644
index 1193fe8..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/Table.vm
+++ /dev/null
@@ -1,76 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-#if($nestTables == false)
-package $tablePackageName;
-
-import org.apache.empire.data.DataType;
-import org.apache.empire.db.DBTableColumn;
-import $basePackageName.${dbClassName};
-#end
-
-#if($nestTables == true)
- public static class $parser.getTableClassName($table.name) extends ${baseTableClassName} {
-#else
-public class $parser.getTableClassName($table.name) extends ${baseTableClassName} {
-#end
-
- private static final long serialVersionUID = 1L;
-
- // define columns
-#foreach ($col in $table.columns)
- public final DBTableColumn ${parser.getColumnName($col)};
-#end
-
- public $parser.getTableClassName($table.name)(${dbClassName} db) {
- super("$table.name", db);
-
- // create columns
-#foreach ($col in $table.columns)
- ${parser.getColumnName($col)} = addColumn("${col.name}", DataType.${parser.getDataType($col)}, ${col.size}, ${col.isRequired()}, ${parser.getDefaultValue($col)});
-#end
-
- // configure key columns (primary key)
-#if($table.keyColumns.size()>0)
-#if($table.keyColumns.size()==1)
- setPrimaryKey(${parser.getColumnName($table.keyColumns[0])});
-#else
- DBTableColumn[] keyColumns = new DBTableColumn[] {
-#foreach ($col in $table.keyColumns)
-#if($foreach.isLast()==false)
- ${parser.getColumnName($col)},
-#else
- ${parser.getColumnName($col)} };
- setPrimaryKey(keyColumns);
-#end
-#end
-#end
-
- // Optimistic locking column
-#if($parser.hasLockingColumn($table) == true)
- setTimestampColumn(${parser.getColumnName($table.getTimestampColumn())});
-#else
- /*no locking column specified*/
-#end
-#end
- }
-#if($nestTables == true)
- }
-#else
-}
-#end
\ No newline at end of file
diff --git a/empire-db-eclipse-codegen/src/main/resources/templates/View.vm b/empire-db-eclipse-codegen/src/main/resources/templates/View.vm
deleted file mode 100644
index 0c875b9..0000000
--- a/empire-db-eclipse-codegen/src/main/resources/templates/View.vm
+++ /dev/null
@@ -1,68 +0,0 @@
-#*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *#
-
-#if($nestViews == false)
-package $viewPackageName;
-
-import org.apache.empire.data.DataType;
-import org.apache.empire.db.DBCommandExpr;
-import org.apache.empire.exceptions.NotImplementedException;
-
-import $basePackageName.${dbClassName};
-
-#end
-
-#if($nestViews == true)
- public static class $parser.getViewClassName($view.name) extends ${baseViewClassName} {
-#else
-public class $parser.getViewClassName($view.name) extends ${baseViewClassName} {
-#end
-
- private static final long serialVersionUID = 1L;
-
- // define columns
-#foreach ($col in $view.columns)
- public final DBViewColumn ${parser.getColumnName($col)};
-#end
-
- public $parser.getViewClassName($view.name)(${dbClassName} db) {
- super("$view.name", db);
-
- // create all columns
-#foreach ($col in $view.columns)
- ${parser.getColumnName($col)} = super.addColumn("${col.name}", DataType.${col.getDataType()});
-#end
- }
-
- @Override
- public DBCommandExpr createCommand()
- {
- /*
- Supply a command for the creation of this view here
- or return null to skip view creation
- */
- throw new NotImplementedException(this, "createCommand");
- }
-
-#if($nestViews == true)
- }
-#else
-}
-#end
-
diff --git a/empire-db-examples/empire-db-example-cxf/.gitignore b/empire-db-examples/empire-db-example-cxf/.gitignore
deleted file mode 100644
index 8bd3a05..0000000
--- a/empire-db-examples/empire-db-example-cxf/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/target/
-/.settings/
-/.classpath
-/.project
diff --git a/empire-db-examples/empire-db-example-cxf/config.xml b/empire-db-examples/empire-db-example-cxf/config.xml
deleted file mode 100644
index c6f5b1c..0000000
--- a/empire-db-examples/empire-db-example-cxf/config.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<config>
-
- <properties>
- <!-- provider name must match the property-section containing the connection data -->
- <databaseProvider>hsqldb</databaseProvider>
- </properties>
-
- <properties-hsqldb>
- <!-- JDBC properties for a HSQLDB Database connection -->
- <!-- Required jar file: hsqldb.jar -->
- <jdbcClass>org.hsqldb.jdbc.JDBCDriver</jdbcClass>
- <jdbcURL>jdbc:hsqldb:file:hsqldb/sample;shutdown=true</jdbcURL>
- <jdbcUser>sa</jdbcUser>
- <jdbcPwd></jdbcPwd>
- <schemaName>DBSAMPLE</schemaName>
- </properties-hsqldb>
-
- <properties-mysql>
- <!-- JDBC properties for a MySQL Database connection -->
- <!-- Required jar file: mysql-connector-java-5.1.6-bin.jar -->
- <jdbcClass>com.mysql.jdbc.Driver</jdbcClass>
- <jdbcURL>jdbc:mysql://localhost</jdbcURL>
- <jdbcUser>root</jdbcUser>
- <jdbcPwd>empire-db</jdbcPwd>
- <schemaName>DBSAMPLE</schemaName>
- </properties-mysql>
-
- <properties-oracle>
- <!-- JDBC properties for an Oracle Database connection -->
- <!-- Required jar file: ojdbc14.jar -->
- <jdbcClass>oracle.jdbc.driver.OracleDriver</jdbcClass>
- <jdbcURL>jdbc:oracle:thin:@192.168.0.2:1521:ora10</jdbcURL>
- <jdbcUser>DBSAMPLE</jdbcUser>
- <jdbcPwd>DBSAMPLE</jdbcPwd>
- <schemaName>DBSAMPLE</schemaName>
- </properties-oracle>
-
- <properties-sqlserver>
- <!-- JDBC properties for a Microsoft SQL-Server Database connection -->
- <!-- Required jar file: sqljdbc.jar -->
- <jdbcClass>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbcClass>
- <jdbcURL>jdbc:sqlserver://192.168.0.2:1433</jdbcURL>
- <jdbcUser>sa</jdbcUser>
- <jdbcPwd>empire-db</jdbcPwd>
- <schemaName>DBSAMPLE</schemaName>
- </properties-sqlserver>
-
-</config>
diff --git a/empire-db-examples/empire-db-example-cxf/log4j.properties b/empire-db-examples/empire-db-example-cxf/log4j.properties
deleted file mode 100644
index 031ae65..0000000
--- a/empire-db-examples/empire-db-example-cxf/log4j.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-log4j.rootCategory=FATAL, console
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.conversionPattern = %d{ISO8601} %-5p [%c] - %m%n
diff --git a/empire-db-examples/empire-db-example-cxf/pom.xml b/empire-db-examples/empire-db-example-cxf/pom.xml
deleted file mode 100644
index 84563ea..0000000
--- a/empire-db-examples/empire-db-example-cxf/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version
- 2.0 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the
- License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>empire-db-examples</artifactId>
- <groupId>org.apache.empire-db</groupId>
- <version>3.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>empire-db-example-cxf</artifactId>
- <name>Apache Empire-db CXF Example</name>
- <description>Example showing the use of empire-db wrapped in a webservice</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db</artifactId>
- </dependency>
- <!-- use log4j for logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <!--
- This dependency should be declared as runtime but the exec plugin is
- broken atm...
- -->
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <!-- <scope>runtime</scope> -->
- </dependency>
-
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxws</artifactId>
- <version>2.1.4</version>
- </dependency>
-
- <!-- Jetty is needed if you're are not using the CXFServlet -->
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http-jetty</artifactId>
- <version>2.1.4</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/ClientGUI.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/ClientGUI.java
deleted file mode 100644
index 28207c5..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/ClientGUI.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.client;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.apache.empire.samples.cxf.wssample.common.Department;
-import org.apache.empire.samples.cxf.wssample.common.Employee;
-
-public class ClientGUI extends JFrame {
-
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JButton _btnSearch = null;
- private JTextField _txtSearchValue = null;
- private EmployeeServiceClient proxy = null;
- private JList _searchResult = null;
- private EmployeeListModel _employeeListModel = null;
- private ClientGUI me;
- private JPanel _actionPanel = null;
- private JPanel _pnlContent = null;
- private JButton _btnAdd = null;
- private JTextField _txtName = null;
- private JTextField _txtLastname = null;
- private JLabel _lblName = null;
- private JLabel lblLastname = null;
- private JComboBox _cbxDepartment = null;
- private JLabel _lblDepartment = null;
- private List<Department> _departments = new ArrayList<Department>();
-
- /**
- * This method initializes _actionPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel get_actionPanel() {
- if (_actionPanel == null) {
- _actionPanel = new JPanel();
- _actionPanel.setLayout(new BorderLayout());
- _actionPanel.add(get_btnSearch(), BorderLayout.EAST);
- _actionPanel.add(get_txtSearchValue(), BorderLayout.CENTER);
- }
- return _actionPanel;
- }
-
- /**
- * This method initializes _pnlContent
- *
- * @return javax.swing.JPanel
- */
- private JPanel get_pnlContent() {
- if (_pnlContent == null) {
- _lblDepartment = new JLabel();
- _lblDepartment.setText("department");
- _lblDepartment.setSize(new Dimension(100, 20));
- _lblDepartment.setLocation(new Point(10, 200));
- _lblDepartment.setPreferredSize(new Dimension(100, 20));
- lblLastname = new JLabel();
- lblLastname.setPreferredSize(new Dimension(100, 20));
- lblLastname.setLocation(new Point(280, 200));
- lblLastname.setSize(new Dimension(100, 20));
- lblLastname.setText("last Name");
- _lblName = new JLabel();
- _lblName.setText("first Name");
- _lblName.setSize(new Dimension(100, 20));
- _lblName.setPreferredSize(new Dimension(100, 20));
- _lblName.setLocation(new Point(120, 200));
- _pnlContent = new JPanel();
- _pnlContent.setLayout(null);
- _pnlContent.add(get_searchResult(), null);
- _pnlContent.add(get_btnAdd(), null);
- _pnlContent.add(get_txtName(), null);
- _pnlContent.add(get_txtLastname(), null);
- _pnlContent.add(_lblName, null);
- _pnlContent.add(lblLastname, null);
- _pnlContent.add(get_cbxDepartment(), null);
- _pnlContent.add(_lblDepartment, null);
- }
- return _pnlContent;
- }
-
- /**
- * This method initializes _btnAdd
- *
- * @return javax.swing.JButton
- */
- private JButton get_btnAdd() {
- if (_btnAdd == null) {
- _btnAdd = new JButton();
- _btnAdd.setLocation(new Point(434, 225));
- _btnAdd.setText("add");
- _btnAdd.setPreferredSize(new Dimension(75, 20));
- _btnAdd.setSize(new Dimension(75, 20));
- _btnAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- try {
- Employee emp = proxy.createEmmployee();
- emp.setFirstname(_txtName.getText());
- emp.setLastname(_txtLastname.getText());
- emp.setDepartmentId(_departments.get(
- _cbxDepartment.getSelectedIndex())
- .getDepartmentId());
- proxy.saveEmployee(emp);
- } catch (Exception ex) {
- JOptionPane.showMessageDialog(me, ex.getMessage());
- }
- }
- });
- }
- return _btnAdd;
- }
-
- /**
- * This method initializes _txtName
- *
- * @return javax.swing.JTextField
- */
- private JTextField get_txtName() {
- if (_txtName == null) {
- _txtName = new JTextField();
- _txtName.setLocation(new Point(120, 225));
- _txtName.setPreferredSize(new Dimension(150, 20));
- _txtName.setSize(new Dimension(150, 20));
- }
- return _txtName;
- }
-
- /**
- * This method initializes _txtLastname
- *
- * @return javax.swing.JTextField
- */
- private JTextField get_txtLastname() {
- if (_txtLastname == null) {
- _txtLastname = new JTextField();
- _txtLastname.setLocation(new Point(280, 225));
- _txtLastname.setPreferredSize(new Dimension(150, 20));
- _txtLastname.setSize(new Dimension(150, 20));
- }
- return _txtLastname;
- }
-
- /**
- * This method initializes _cbxDepartment
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox get_cbxDepartment() {
- if (_cbxDepartment == null) {
- _cbxDepartment = new JComboBox(_departments.toArray());
- _cbxDepartment.setLocation(new Point(10, 225));
- _cbxDepartment.setPreferredSize(new Dimension(100, 20));
- _cbxDepartment.setSize(new Dimension(100, 20));
- }
- return _cbxDepartment;
- }
-
- /**
- * This is the default constructor
- *
- * @param prxy the proxy
- */
- public ClientGUI(EmployeeServiceClient prxy) {
- super();
- proxy = prxy;
- try {
- _departments = proxy.getDepartments();
- } catch (Exception ex) {
- JOptionPane.showMessageDialog(me, ex.getMessage());
- }
- initialize();
- me = this;
- setVisible(true);
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize() {
- this.setSize(529, 299);
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.setTitle("Employee Management Client");
- this.setLocationRelativeTo(null);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(get_actionPanel(), BorderLayout.NORTH);
- jContentPane.add(get_pnlContent(), BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes _btnSearch
- *
- * @return javax.swing.JButton
- */
- private JButton get_btnSearch() {
- if (_btnSearch == null) {
- _btnSearch = new JButton();
- _btnSearch.setText("search");
- _btnSearch.setPreferredSize(new Dimension(80, 20));
- _btnSearch.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- search();
- }
- });
- }
- return _btnSearch;
- }
-
- /**
- * This method initializes _txtSearchValue
- *
- * @return javax.swing.JTextField
- */
- private JTextField get_txtSearchValue() {
- if (_txtSearchValue == null) {
- _txtSearchValue = new JTextField();
- _txtSearchValue
- .addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- search();
- }
-
- });
- }
- return _txtSearchValue;
- }
-
- private void search() {
- try {
- List<Employee> list = null;
- // Search for Employees with the given information
- list = proxy.searchEmployee(null,_txtSearchValue.getText(),"",null);
- _employeeListModel.setListData(list);
-
- } catch (Exception ex) {
- JOptionPane.showMessageDialog(me, ex.getMessage());
- }
- }
-
- /**
- * This method initializes _searchResult
- *
- * @return javax.swing.JList
- */
- private JList get_searchResult() {
- if (_searchResult == null) {
- _employeeListModel = new EmployeeListModel();
- _searchResult = new JList(_employeeListModel);
- _searchResult.setSize(new Dimension(500, 180));
- _searchResult.setLocation(new Point(10, 10));
- }
- return _searchResult;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeListModel.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeListModel.java
deleted file mode 100644
index 5bd34ec..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeListModel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.client;
-
-import java.util.List;
-
-import javax.swing.DefaultListModel;
-
-import org.apache.empire.samples.cxf.wssample.common.Employee;
-
-// A very simple ListModel to display emloyees in a listview.
-public class EmployeeListModel extends DefaultListModel {
-
- private static final long serialVersionUID = 1L;
-
- public void setListData(List<Employee> data) {
- this.removeAllElements();
-
- if (data != null) {
- for (Employee e : data) {
- this.addElement(e);
- }
- }
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java
deleted file mode 100644
index 15c6f69..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.client;
-
-import java.util.List;
-
-import javax.xml.ws.Holder;
-
-import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
-import org.apache.empire.samples.cxf.wssample.common.Department;
-import org.apache.empire.samples.cxf.wssample.common.Employee;
-import org.apache.empire.samples.cxf.wssample.common.EmployeeService;
-
-// The access to WebService.
-public class EmployeeServiceClient
-{
- private EmployeeService service = null;
-
- public EmployeeServiceClient(String serviceAddress)
- {
- JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
- factory.getInInterceptors().add(new LoggingInInterceptor());
- factory.getOutInterceptors().add(new LoggingOutInterceptor());
- factory.setServiceClass(EmployeeService.class);
- factory.setAddress(serviceAddress);
- this.service = (EmployeeService) factory.create();
- }
-
- public Employee createEmmployee()
- {
- return service.createEmmployee();
- }
-
- public List<Department> getDepartments()
- {
- return service.getDepartments();
- }
-
- public Employee getEmmployee(int id)
- {
- return service.getEmmployee(id);
- }
-
- public void saveEmployee(Employee e)
- {
- // Employee is here a INOUT parameter, and therfore has to be placed in a Holder.
- Holder<Employee> holder = new Holder<Employee>(e);
- service.saveEmmployee(holder);
- // In order to retrieve changes made by the webservice we copy the content to our local variable.
- e.set(holder.value);
- }
-
- public void deleteEmployee(int id)
- {
- service.deleteEmmployee(id);
- }
-
- public List<Employee> searchEmployee(Integer id, String firstName, String lastName, Integer department)
- {
- return service.searchEmmployee(id, firstName, lastName, department);
- }
-
- public boolean ping()
- {
- return service.ping();
- }
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/RunClient.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/RunClient.java
deleted file mode 100644
index 0825271..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/RunClient.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.client;
-
-import javax.swing.SwingUtilities;
-
-import org.apache.empire.samples.cxf.wssample.server.ServerControl;
-
-public class RunClient {
-
- public static void main(String[] args) {
- final EmployeeServiceClient proxy = new EmployeeServiceClient(ServerControl.serviceAddress);
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run() {
- new ClientGUI(proxy);
- }
- });
- }
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java
deleted file mode 100644
index 8413ca7..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.common;
-
-import java.util.Date;
-
-
-// Holds all the data represented by a department-record from the database
-public class Department {
-
- private long departmentId = 0;
- private String name = "";
- private String head = "";
- private String businessUnit = "";
- private Date updateTimestamp = null;
-
- public void setDepartmentId(long id) {
- departmentId = id;
- }
-
- public long getDepartmentId() {
- return departmentId;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setHead(String head) {
- this.head = head;
- }
-
- public String getHead() {
- return head;
- }
-
- public void setBusinessUnit(String businessUnit) {
- this.businessUnit = businessUnit;
- }
-
- public String getBusinessUnit() {
- return businessUnit;
- }
-
- public void setUpdateTimestamp(Date d) {
- this.updateTimestamp = d;
- }
-
- public Date getUpdateTimestamp() {
- return updateTimestamp;
- }
-
- @Override
- public String toString()
- {
- return name;
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java
deleted file mode 100644
index 1926f57..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.common;
-
-import java.util.Date;
-
-//Holds all the data represented by a employee-record from the database
-public class Employee {
-
- private long employeeId = -1;
- private String salutation = "";
- private String firstname = "";
- private String lastname = "";
- private Date dateOfBirth = null;
- private long departmentId = -1;
- private String gender = "";
- private String phoneNumber = "";
- private String email = "";
- private double salary = -1;
- private boolean retired = false;
- private Date updateTimestamp = null;
- private boolean isNew = false;
-
- public void set(Employee e) {
- employeeId = e.getDepartmentId();
- salutation = e.getSalutation();
- firstname = e.getFirstname();
- lastname = e.getLastname();
- dateOfBirth = e.getDateOfBirth();
- departmentId = e.getDepartmentId();
- gender = e.getGender();
- phoneNumber = e.getPhoneNumber();
- email = e.getEmail();
- salary = e.getSalary();
- retired = e.isRetired();
- updateTimestamp = e.getUpdateTimestamp();
- isNew = e.isNew();
- }
-
- public void setEmployeeId(long id) {
- employeeId = id;
- }
-
- public long getEmployeeId() {
- return employeeId;
- }
-
- public void setSalutation(String salutation) {
- this.salutation = salutation;
- }
-
- public String getSalutation() {
- return salutation;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public String getFirstname() {
- return firstname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setDateOfBirth(Date dateOfBirth) {
- this.dateOfBirth = dateOfBirth;
- }
-
- public Date getDateOfBirth() {
- return dateOfBirth;
- }
-
- public void setDepartmentId(long departmentId) {
- this.departmentId = departmentId;
- }
-
- public long getDepartmentId() {
- return departmentId;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setPhoneNumber(String phone) {
- this.phoneNumber = phone;
- }
-
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setRetired(boolean retired) {
- this.retired = retired;
- }
-
- public boolean isRetired() {
- return retired;
- }
-
- public void setUpdateTimestamp(Date d) {
- this.updateTimestamp = d;
- }
-
- public Date getUpdateTimestamp() {
- return updateTimestamp;
- }
-
- public void setSalary(double salary) {
- this.salary = salary;
- }
-
- public double getSalary() {
- return salary;
- }
-
- @Override
- public String toString() {
- String str = "";
- str += getEmployeeId() + ": ";
- str += getSalutation() + " ";
- str += getFirstname() + " ";
- str += getLastname();
-
- return str;
- }
-
- public void setNew(boolean isNew) {
- this.isNew = isNew;
- }
-
- public boolean isNew() {
- return isNew;
- }
-
-}
\ No newline at end of file
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java
deleted file mode 100644
index 4e5023f..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.common;
-
-import java.util.List;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebParam.Mode;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.xml.ws.Holder;
-
-//specifies the the attribute wsdl:portType
-@WebService(name = "employeeService")
-
-public interface EmployeeService
-{
- @WebMethod(operationName = "searchEmmployee")
- @WebResult(name = "searchResponse")
- public List<Employee> searchEmmployee(@WebParam(name = "id", mode = Mode.IN) Integer id,
- @WebParam(name = "firstName", mode = Mode.IN) String firstName,
- @WebParam(name = "lastName", mode = Mode.IN) String lastName,
- @WebParam(name = "department", mode = Mode.IN) Integer department);
-
- @WebMethod(operationName = "getEmmployee")
- @WebResult(name = "employee")
- public Employee getEmmployee(@WebParam(name = "id", mode = Mode.IN) int id);
-
- @WebMethod(operationName = "createEmmployee")
- @WebResult(name = "newEmployee")
- public Employee createEmmployee();
-
- @WebMethod(operationName = "saveEmmployee")
- @WebResult(name = "saveResponse")
- public void saveEmmployee(@WebParam(name = "employee", mode = Mode.INOUT) Holder<Employee> e);
-
- @WebMethod(operationName = "deleteEmmployee")
- @WebResult(name = "deleteResponse")
- public void deleteEmmployee(@WebParam(name = "id", mode = Mode.IN) int id);
-
- @WebMethod(operationName = "getDepartments")
- @WebResult(name = "allDepartments")
- public List<Department> getDepartments();
-
- @WebMethod(operationName = "ping")
- @WebResult(name = "pingResponse")
- public boolean ping();
-
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/DocumentWriter.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/DocumentWriter.java
deleted file mode 100644
index d4b90c6..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/DocumentWriter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.server;
-
-import java.io.StringWriter;
-
-import javax.swing.text.Style;
-import javax.swing.text.StyledDocument;
-
-public class DocumentWriter extends StringWriter
-{
-
- private StyledDocument _doc;
- private Style _style;
- public DocumentWriter(StyledDocument d, Style style)
- {
- this._doc=d;
- this._style=style;
- }
-
- @Override
- public void write(String str)
- {
- try{
- _doc.insertString(_doc.getLength(), str, _style);
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
-
- @Override
- public void write(String str, int off, int len)
- {
- try{
- _doc.insertString(_doc.getLength(), str, _style);
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java
deleted file mode 100644
index c591b7f..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.server;
-
-import java.sql.Connection;
-import java.util.List;
-
-import javax.jws.WebService;
-
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBReader;
-import org.apache.empire.db.DBRecord;
-import org.apache.empire.db.expr.compare.DBCompareExpr;
-import org.apache.empire.samples.cxf.wssample.common.Department;
-import org.apache.empire.samples.cxf.wssample.common.Employee;
-import org.apache.empire.samples.cxf.wssample.common.EmployeeService;
-import org.apache.empire.samples.cxf.wssample.server.db.SampleDB;
-import org.apache.empire.samples.cxf.wssample.server.db.SampleDB.Departments;
-import org.apache.empire.samples.cxf.wssample.server.db.SampleDB.Employees;
-
-@WebService(endpointInterface = "org.apache.empire.samples.cxf.wssample.common.EmployeeService",
- portName = "EmployeeServicePort",
- serviceName = "EmployeeService")
-
-public class EmployeeServiceImpl implements EmployeeService
-{
-
- private SampleDB db = null;
- private Departments T_DEP = null;
- private Employees T_EMP = null;
- private Connection conn = null;
-
- public EmployeeServiceImpl(SampleDB db, Connection conn)
- {
- this.conn = conn;
- this.db = db;
- T_DEP = db.DEPARTMENTS;
- T_EMP = db.EMPLOYEES;
- }
-
- public void saveEmmployee(javax.xml.ws.Holder<Employee> empHolder)
- {
- DBRecord r = new DBRecord();
- Employee emp = empHolder.value;
- boolean init;
- if (emp.isNew())
- r.create(T_EMP, conn);
- else
- r.read(T_EMP, emp.getEmployeeId(), conn);
-
- r.setRecordValues(emp);
- r.update(conn);
-
-
- r.setBeanProperties(emp);
- emp.setNew(false);
- }
-
- public List<Employee> searchEmmployee(Integer id, String firstName, String lastName, Integer department)
- {
- DBCommand cmd = db.createCommand();
- cmd.select(T_EMP.getColumns());
-
- DBCompareExpr comp;
-
- if (id != null)
- comp = T_EMP.EMPLOYEE_ID.is(id);
- else
- comp = T_EMP.EMPLOYEE_ID.isNot(null);
-
- if (firstName != null && !firstName.equals(""))
- {
- comp = comp.and(T_EMP.FIRSTNAME.like(firstName));
- }
-
- if (lastName != null && !lastName.equals(""))
- {
- comp = comp.and(T_EMP.LASTNAME.like(lastName));
- }
-
- if (department != null)
- {
- comp = comp.and(T_EMP.DEPARTMENT_ID.is(department));
- }
-
- cmd.where(comp);
-
- DBReader reader = new DBReader();
- reader.open(cmd, conn);
- List<Employee> lst = reader.getBeanList(Employee.class);
- return lst;
- }
-
- public List<Department> getDepartments()
- {
- DBCommand cmd = db.createCommand();
- cmd.select(T_DEP.getColumns());
-
- DBReader reader = new DBReader();
- reader.open(cmd, conn);
- return reader.getBeanList(Department.class);
- }
-
- public Employee createEmmployee()
- {
- DBRecord r = new DBRecord();
- Employee emp = new Employee();
-
- // null, so that no IDs are wasted.
- r.create(T_EMP, null);
- r.setBeanProperties(emp);
-
- emp.setNew(true);
-
- return emp;
- }
-
- public void deleteEmmployee(int id)
- {
- T_EMP.deleteRecord(id, conn);
- }
-
- public Employee getEmmployee(int id)
- {
- DBRecord r = new DBRecord();
- Employee emp = new Employee();
-
- r.read(T_EMP, id, conn);
- r.setBeanProperties(emp);
- return emp;
- }
-
- public boolean ping()
- {
- return true;
- }
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/RunServer.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/RunServer.java
deleted file mode 100644
index 1e3a8a2..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/RunServer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.server;
-
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class RunServer
-{
-
- private static final Log log = LogFactory.getLog(RunServer.class);
-
- public static void main(String[] args)
- {
- try
- {
- final ServerControl control = new ServerControl();
- SwingUtilities.invokeAndWait(new Runnable()
- {
- public void run()
- {
- ServerGUI gui = new ServerGUI(control);
- gui.setVisible(true);
- }
- });
- control.start();
- } catch (Throwable t)
- {
- t.printStackTrace();
- log.error(t);
- JOptionPane.showMessageDialog(null, "Please have a look at the logfile.", "A Error occurred!",
- JOptionPane.ERROR_MESSAGE);
- }
- }
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java
deleted file mode 100644
index 3da9710..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.cxf.wssample.server;
-
-import org.apache.empire.xml.XMLConfiguration;
-
-public class SampleConfig extends XMLConfiguration {
-
- private String databaseProvider = "oracle";
-
- private String jdbcClass = "oracle.jdbc.driver.OracleDriver";
-
- private String jdbcURL = "jdbc:oracle:thin:@192.168.0.2:1521:ora10";
-
- private String jdbcUser = "DBSAMPLE";
-
- private String jdbcPwd = "DBSAMPLE";
-
- private String schemaName = "DBSAMPLE";
-
- /**
- * Initialize the configuration
- *
- * @param filename the file
- */
- public void init(String filename) {
- // Read the properties file
- super.init(filename, false);
- // Done
- readProperties(this, "properties");
- // Reader Provider Properties
- readProperties(this, "properties-" + databaseProvider);
- }
-
- public String getDatabaseProvider() {
- return databaseProvider;
- }
-
- public String getJdbcClass() {
- return jdbcClass;
- }
-
- public void setJdbcClass(String jdbcClass) {
- this.jdbcClass = jdbcClass;
- }
-
- public String getJdbcPwd() {
- return jdbcPwd;
- }
-
- public void setJdbcPwd(String jdbcPwd) {
- this.jdbcPwd = jdbcPwd;
- }
-
- public String getJdbcURL() {
- return jdbcURL;
- }
-
- public String getSchemaName() {
- return schemaName;
- }
-
- // ------- Setters -------
-
- public void setDatabaseProvider(String databaseProvider) {
- this.databaseProvider = databaseProvider;
- }
-
- public void setJdbcURL(String jdbcURL) {
- this.jdbcURL = jdbcURL;
- }
-
- public String getJdbcUser() {
- return jdbcUser;
- }
-
- public void setJdbcUser(String jdbcUser) {
- this.jdbcUser = jdbcUser;
- }
-
- public void setSchemaName(String schemaName) {
- this.schemaName = schemaName;
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java
deleted file mode 100644
index 4de5933..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.server;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBDatabaseDriver;
-import org.apache.empire.db.DBRecord;
-import org.apache.empire.db.DBSQLScript;
-import org.apache.empire.db.hsql.DBDatabaseDriverHSql;
-import org.apache.empire.db.mysql.DBDatabaseDriverMySQL;
-import org.apache.empire.db.oracle.DBDatabaseDriverOracle;
-import org.apache.empire.db.sqlserver.DBDatabaseDriverMSSQL;
-import org.apache.empire.samples.cxf.wssample.common.EmployeeService;
-import org.apache.empire.samples.cxf.wssample.server.db.SampleDB;
-
-public class ServerControl
-{
- private static final Log log = LogFactory.getLog(EmployeeServiceImpl.class);
-
- public static final String serviceName = "employeeService";
- public static final String serviceAddress = "http://localhost:8081/" + serviceName;
-
- private SampleDB db = null;
- private Connection conn = null;
- private SampleConfig config = null;
- private DBDatabaseDriver driver = null;
-
-
- private String configPath = "config.xml";
- private org.apache.cxf.endpoint.Server endpoint = null;
- private JaxWsServerFactoryBean svrFactory = null;
-
- public ServerControl()
- {
- init();
- }
-
- // stops the service
- public void stop()
- {
- db.commit(conn);
- log.info("[stop] commit to database");
- db.close(conn);
- log.info("[stop] close database connection");
- endpoint.stop();
- log.info("[stop] stopped werbservice endpoint");
- }
-
- // starts the service
- public void start()
- {
- // create the server
- endpoint = svrFactory.create();
-
- // service is now created and may be started
- log.info("[init] " + serviceName + " successfully created ...");
-
- if (endpoint != null)
- {
- db.open(driver, conn);
- endpoint.start();
- log.info("[start] " + serviceName + " successfully started!");
- } else
- {
- log.error("[start] The webservice seems not to be initialized correctly!");
- }
- }
-
- public void appendLogger(LoggingOutInterceptor out, LoggingInInterceptor in)
- {
- svrFactory.getOutInterceptors().add(out);
- svrFactory.getInInterceptors().add(in);
- }
-
- private void init()
- {
- initDB();
- initWS();
- }
-
- /*
- * init database, create tables if necessary ...
- */
- private void initDB()
- {
- config = new SampleConfig();
- db = new SampleDB();
-
- config.init(configPath);
- driver = getDatabaseDriver(config.getDatabaseProvider());
- conn = getJDBCConnection();
-
- // Open Database (and create if not existing)
- log.info("*** open database ***");
- db.open(driver, conn);
- if (!databaseExists(conn))
- {
- // STEP 4: Create Database
- log.info("*** create Database ***");
- createSampleDatabase(driver, conn);
- }
-
- log.info("[init] Database successfully initialized!");
- }
-
- /*
- * init webservice, create implemantion, connect to server ...
- */
-
-
- private void initWS()
- {
- // create new instance of the service implmentation
- EmployeeService impl = new EmployeeServiceImpl(db, conn);
-
- // construct/configure factory to create our specific service
- svrFactory = new JaxWsServerFactoryBean();
- //svrFactory.getInInterceptors().add(new LoggingInInterceptor());
- //svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
- // specify our implementation class
- svrFactory.setServiceClass(EmployeeService.class);
- // specify the address
- svrFactory.setAddress(serviceAddress);
- // set the instance to be used
- svrFactory.setServiceBean(impl);
- }
-
- private Connection getJDBCConnection()
- {
- // Establish a new database connection
- Connection conn = null;
- String jdbcURL = config.getJdbcURL();
-
- // Connect
- log.info("Connecting to Database'" + jdbcURL + "' / User=" + config.getJdbcUser());
- try
- { // Connect to the databse
- Class.forName(config.getJdbcClass()).newInstance();
- conn = DriverManager.getConnection(jdbcURL, config.getJdbcUser(), config.getJdbcPwd());
- log.info("Connected successfully");
- // Set the AutoCommit to false this session.
- // You must commit explicitly now.
- conn.setAutoCommit(false);
- log.info("AutoCommit is " + conn.getAutoCommit());
-
- } catch (Exception e)
- {
- log.error("Failed to connect directly to '" + config.getJdbcURL() + "' / User=" + config.getJdbcUser());
- log.error(e.toString());
- throw new RuntimeException(e);
- }
- return conn;
- }
-
- private DBDatabaseDriver getDatabaseDriver(String provider)
- {
- if (provider.equalsIgnoreCase("mysql"))
- {
- DBDatabaseDriverMySQL driver = new DBDatabaseDriverMySQL();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(config.getSchemaName());
- return driver;
- } else if (provider.equalsIgnoreCase("oracle"))
- {
- DBDatabaseDriverOracle driver = new DBDatabaseDriverOracle();
- // Set Driver specific properties (if any)
- return driver;
- } else if (provider.equalsIgnoreCase("sqlserver"))
- {
- DBDatabaseDriverMSSQL driver = new DBDatabaseDriverMSSQL();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(config.getSchemaName());
- return driver;
- } else if (provider.equalsIgnoreCase("hsqldb"))
- {
- DBDatabaseDriverHSql driver = new DBDatabaseDriverHSql();
- // Set Driver specific properties (if any)
- return driver;
- } else
- { // Unknown Provider
- throw new RuntimeException("Unknown Database Provider " + provider);
- }
- }
-
- private boolean databaseExists(Connection conn)
- {
- // Check wether DB exists
- DBCommand cmd = db.createCommand();
- cmd.select(db.DEPARTMENTS.count());
- int deps = db.querySingleInt(cmd, -1, conn);
- return (deps >= 0);
- }
-
- /*
- * creates a DDL Script for the entire SampleDB Database then checks if the department table exists by running
- * "select count(*) from DEPARTMENTS" if the department tables does not exist, the entire dll-script is executed line by
- * line
- */
- private void createSampleDatabase(DBDatabaseDriver driver, Connection conn)
- {
- // create DLL for Database Definition
- DBSQLScript script = new DBSQLScript();
- db.getCreateDDLScript(driver, script);
- // Show DLL Statements
- System.out.println(script.toString());
- // Execute Script
- script.executeAll(driver, conn, false);
- db.commit(conn);
- // Open again
- if (!db.isOpen()){
- db.open(driver, conn);
- }
- // Insert Sample Departments
- int idDevDep = insertDepartmentSampleRecord(conn, "Development", "ITTK");
- int idSalDep = insertDepartmentSampleRecord(conn, "Sales", "ITTK");
- // Insert Sample Employees
- insertEmployeeSampleRecord(conn, "Mr.", "Eugen", "Miller", "M", idDevDep);
- insertEmployeeSampleRecord(conn, "Mr.", "Max", "Mc. Callahan", "M", idDevDep);
- insertEmployeeSampleRecord(conn, "Mrs.", "Anna", "Smith", "F", idSalDep);
- // Commit
- db.commit(conn);
- }
-
- /*
- * Insert a department
- */
- private int insertDepartmentSampleRecord(Connection conn, String department_name, String businessUnit)
- {
- // Insert a Department
- DBRecord rec = new DBRecord();
- rec.create(db.DEPARTMENTS);
- rec.setValue(db.DEPARTMENTS.NAME, department_name);
- rec.setValue(db.DEPARTMENTS.BUSINESS_UNIT, businessUnit);
- rec.update(conn);
- // Return Department ID
- return rec.getInt(db.DEPARTMENTS.DEPARTMENT_ID);
- }
-
- /*
- * Insert a person
- */
- private int insertEmployeeSampleRecord(Connection conn, String salutation, String firstName, String lastName,
- String gender, int depID)
- {
- // Insert an Employee
- DBRecord rec = new DBRecord();
- rec.create(db.EMPLOYEES);
- rec.setValue(db.EMPLOYEES.SALUTATION, salutation);
- rec.setValue(db.EMPLOYEES.FIRSTNAME, firstName);
- rec.setValue(db.EMPLOYEES.LASTNAME, lastName);
- rec.setValue(db.EMPLOYEES.GENDER, gender);
- rec.setValue(db.EMPLOYEES.DEPARTMENT_ID, depID);
- rec.update(conn);
- // Return Employee ID
- return rec.getInt(db.EMPLOYEES.EMPLOYEE_ID);
- }
-}
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerGUI.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerGUI.java
deleted file mode 100644
index c5e7024..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerGUI.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.empire.samples.cxf.wssample.server;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.io.PrintWriter;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextPane;
-import javax.swing.text.Style;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.StyleContext;
-import javax.swing.text.StyledDocument;
-
-import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
-
-public class ServerGUI extends JFrame
-{
-
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,10"
- private JButton _btnShutdown = null;
- private ServerControl _sControl;
- private JPanel pnlButtons = null;
- private JButton btnClear = null;
- private JTextPane txtLog = null;
- private JScrollPane scroller = null;
-
- /**
- * This is the default constructor
- * @param sControl the server control
- */
- public ServerGUI(ServerControl sControl)
- {
- super();
- _sControl = sControl;
- initialize();
- initTextAreaLogger();
- }
-
- private void initTextAreaLogger()
- {
- Style def = StyleContext.getDefaultStyleContext().
- getStyle(StyleContext.DEFAULT_STYLE);
-
- StyledDocument doc = txtLog.getStyledDocument();
-
- Style inStyle = doc.addStyle("bold", def);
- StyleConstants.setBold(inStyle, true);
-
- Style outStyle = doc.addStyle("bold", def);
- StyleConstants.setItalic(outStyle, true);
-
- PrintWriter pwIN = new PrintWriter(new DocumentWriter(txtLog.getStyledDocument(),inStyle));
- PrintWriter pwOUT = new PrintWriter(new DocumentWriter(txtLog.getStyledDocument(),outStyle));
- LoggingOutInterceptor out = new LoggingOutInterceptor(pwIN);
- LoggingInInterceptor in = new LoggingInInterceptor(pwOUT);
-
- this._sControl.appendLogger(out, in);
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize()
- {
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.setTitle("Employee Management Server Control");
- this.pack();
- this.setLocationRelativeTo(null);
- this.addWindowListener(new java.awt.event.WindowAdapter() {
- @Override
- public void windowClosing(java.awt.event.WindowEvent e) {
- _sControl.stop();
- }
- });
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane()
- {
- if (jContentPane == null)
- {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getPnlButtons(), BorderLayout.SOUTH);
- jContentPane.add(getScroller(), BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes _btnShutdown
- *
- * @return javax.swing.JButton
- */
- private JButton get_btnShutdown()
- {
- if (_btnShutdown == null)
- {
- _btnShutdown = new JButton();
- _btnShutdown.setText("Shutdown!");
- _btnShutdown.setEnabled(true);
- _btnShutdown.addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(java.awt.event.ActionEvent e)
- {
- _sControl.stop();
- System.exit(0);
- }
- });
- }
- return _btnShutdown;
- }
-
- /**
- * This method initializes pnlButtons
- *
- * @return javax.swing.JPanel
- */
- private JPanel getPnlButtons()
- {
- if (pnlButtons == null)
- {
- pnlButtons = new JPanel();
- pnlButtons.setLayout(new BorderLayout());
- pnlButtons.add(get_btnShutdown(), BorderLayout.WEST);
- pnlButtons.add(getBtnClear(), BorderLayout.EAST);
- }
- return pnlButtons;
- }
-
- /**
- * This method initializes btnClear
- *
- * @return javax.swing.JButton
- */
- private JButton getBtnClear()
- {
- if (btnClear == null)
- {
- btnClear = new JButton();
- btnClear.setText("clear Log");
- btnClear.addActionListener(new java.awt.event.ActionListener()
- {
- public void actionPerformed(java.awt.event.ActionEvent e)
- {
- txtLog.setText("");
- }
- });
-
- }
- return btnClear;
- }
-
- /**
- * This method initializes jEditorPane
- *
- * @return javax.swing.JEditorPane
- */
- private JTextPane getJEditorPane()
- {
- if (txtLog == null)
- {
- txtLog = new JTextPane();
- StyledDocument doc = txtLog.getStyledDocument();
-
- Style def = StyleContext.getDefaultStyleContext().
- getStyle(StyleContext.DEFAULT_STYLE);
-
- Style b = doc.addStyle("bold", def);
- StyleConstants.setBold(b, true);
-
- }
- return txtLog;
- }
-
- /**
- * This method initializes scroller
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getScroller()
- {
- if (scroller == null)
- {
- scroller = new JScrollPane();
- scroller.setPreferredSize(new Dimension(500, 250));
- scroller.setViewportView(getJEditorPane());
- }
- return scroller;
- }
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/db/SampleDB.java b/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/db/SampleDB.java
deleted file mode 100644
index 7701120..0000000
--- a/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/db/SampleDB.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.cxf.wssample.server.db;
-
-import org.apache.empire.commons.Options;
-import org.apache.empire.data.DataType;
-import org.apache.empire.db.DBColumn;
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.db.DBTableColumn;
-
-/**
- * <PRE>
- * This file contains the definition of the data model in Java.
- * The SampleDB data model consists of two tables and a foreign key relation.
- * The tables are defined as nested classes here, but you may put the in separate files if you want.
- *
- * PLEASE NOTE THE NAMING CONVENTION:
- * Since all tables, views and columns are declared as "final" constants they are all in upper case.
- * We recommend using a prefix of T_ for tables and C_ for columns in order to keep them togehter
- * when listed in your IDE's code completition.
- * There is no need to stick to this convention but it makes life just another little bit easier.
- *
- * You may declare other database tables or views in the same way.
- * </PRE>
- */
-public class SampleDB extends DBDatabase
-{
- private final static long serialVersionUID = 1L;
-
- /**
- * This class represents the definition of the Departments table.
- */
- public static class Departments extends DBTable
- {
- private final static long serialVersionUID = 1L;
-
- public final DBTableColumn DEPARTMENT_ID;
- public final DBTableColumn NAME;
- public final DBTableColumn HEAD;
- public final DBTableColumn BUSINESS_UNIT;
- public final DBTableColumn UPDATE_TIMESTAMP;
-
- public Departments(DBDatabase db)
- {
- super("DEPARTMENTS", db);
- // ID
- DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, true, "DEP_ID_SEQUENCE");
- NAME = addColumn("NAME", DataType.VARCHAR, 80, true);
- HEAD = addColumn("HEAD", DataType.VARCHAR, 80, false);
- BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.VARCHAR, 4, true, "ITTK");
- UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP, 0, true);
-
- // Primary Key
- setPrimaryKey(DEPARTMENT_ID);
- // Set other Indexes
- addIndex("DEARTMENT_NAME_IDX", true, new DBColumn[] { NAME });
- }
- }
-
- /**
- * This class represents the definition of the Employees table.
- */
- public static class Employees extends DBTable
- {
- private final static long serialVersionUID = 1L;
-
- public final DBTableColumn EMPLOYEE_ID;
- public final DBTableColumn SALUTATION;
- public final DBTableColumn FIRSTNAME;
- public final DBTableColumn LASTNAME;
- public final DBTableColumn DATE_OF_BIRTH;
- public final DBTableColumn DEPARTMENT_ID;
- public final DBTableColumn GENDER;
- public final DBTableColumn PHONE_NUMBER;
- public final DBTableColumn EMAIL;
- public final DBTableColumn SALARY;
- public final DBTableColumn RETIRED;
- public final DBTableColumn UPDATE_TIMESTAMP;
-
- public Employees(DBDatabase db)
- {
- super("EMPLOYEES", db);
- // ID
- EMPLOYEE_ID = addColumn("EMPLOYEE_ID", DataType.AUTOINC, 0, true, "EMPLOYEE_ID_SEQUENCE");
- SALUTATION = addColumn("SALUTATION", DataType.VARCHAR, 20, false);
- FIRSTNAME = addColumn("FIRSTNAME", DataType.VARCHAR, 40, true);
- LASTNAME = addColumn("LASTNAME", DataType.VARCHAR, 40, true);
- DATE_OF_BIRTH = addColumn("DATE_OF_BIRTH", DataType.DATE, 0, false);
- DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.INTEGER, 0, true);
- GENDER = addColumn("GENDER", DataType.VARCHAR, 1, false);
- PHONE_NUMBER = addColumn("PHONE_NUMBER", DataType.VARCHAR, 40, false);
- EMAIL = addColumn("EMAIL", DataType.VARCHAR, 80, false);
- SALARY = addColumn("SALARY", DataType.DECIMAL, 10.2, false);
- RETIRED = addColumn("RETIRED", DataType.BOOL, 0, true, false);
- UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP, 0, true);
-
- // Primary Key
- setPrimaryKey(EMPLOYEE_ID);
- // Set other Indexes
- addIndex("EMPLOYEE_NAME_IDX", true, new DBColumn[] { FIRSTNAME, LASTNAME, DATE_OF_BIRTH });
-
- // Create Options for GENDER column
- Options genders = new Options();
- genders.set("M", "Male");
- genders.set("F", "Female");
- GENDER.setOptions(genders);
- }
- }
-
- // Declare all Tables and Views here
- public final Departments DEPARTMENTS = new Departments(this);
- public final Employees EMPLOYEES = new Employees(this);
-
- /**
- * Constructor of the SampleDB data model description
- *
- * Put all foreigen key realtions here.
- */
- public SampleDB()
- {
- // Define Foreign-Key Relations
- addRelation( EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-cxf/xcf.xml b/empire-db-examples/empire-db-example-cxf/xcf.xml
deleted file mode 100644
index 454ee60..0000000
--- a/empire-db-examples/empire-db-example-cxf/xcf.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/core"
- xsi:schemaLocation="
-http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- </cxf:features>
- </cxf:bus>
-</beans>
\ No newline at end of file
diff --git a/empire-db-examples/empire-db-example-spring/.gitignore b/empire-db-examples/empire-db-example-spring/.gitignore
deleted file mode 100644
index 8bd3a05..0000000
--- a/empire-db-examples/empire-db-example-spring/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/target/
-/.settings/
-/.classpath
-/.project
diff --git a/empire-db-examples/empire-db-example-spring/pom.xml b/empire-db-examples/empire-db-example-spring/pom.xml
deleted file mode 100644
index 603bbbd..0000000
--- a/empire-db-examples/empire-db-example-spring/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-examples</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- </parent>
- <artifactId>empire-db-example-spring</artifactId>
- <name>Apache Empire-db Spring Example</name>
- <description>Examples showing the use of empire-db with Spring.</description>
-
- <properties>
- <spring.version>3.2.16.RELEASE</spring.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db</artifactId>
- </dependency>
- <!-- use log4j for logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <!-- Spring -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.2.2</version>
- </dependency>
-
- <!-- This dependency should be declared as runtime but the exec plugin is broken atm... -->
- <dependency>
- <groupId>org.hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <!-- <scope>runtime</scope> -->
- </dependency>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>8.3-603.jdbc3</version>
- <!-- <scope>runtime</scope> -->
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <!-- <scope>runtime</scope> -->
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <!-- <scope>runtime</scope> -->
- </dependency>
-
- <!-- ojdbc
- <dependency>
- <groupId>com.oracle</groupId>
- <artifactId>ojdbc5</artifactId>
- <version>11.2.0.3</version>
- </dependency>
- -->
-
- <!-- msssql
- <dependency>
- <groupId>com.microsoft</groupId>
- <artifactId>sqljdbc</artifactId>
- <version>1.0</version>
- </dependency>
- -->
-
- <dependency>
- <groupId>org.apache.empire-db</groupId>
- <artifactId>empire-db-spring</artifactId>
- </dependency>
- </dependencies>
-
- <!-- better would be to add this repository in your settings.xml -->
- <repositories>
- <repository>
- <id>spring-milestone</id>
- <name>Spring Portfolio Milestone Repository</name>
- <url>http://s3.amazonaws.com/maven.springframework.org/milestone</url>
- </repository>
- </repositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.1.1</version>
- <configuration>
- <!-- <classpathScope>runtime</classpathScope> -->
- <mainClass>org.apache.empire.samples.spring.SampleSpringApp</mainClass>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/EmpireApp.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/EmpireApp.java
deleted file mode 100644
index 2b7da27..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/EmpireApp.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring;
-
-
-/**
- * This is the interface to the application. It is usually some high level interface; for this basic
- * example this is the dao object.
- *
- */
-public interface EmpireApp {
-
- void clearDatabase();
-
- void setupDatabase();
-
- Integer insertDepartment(String departmentName, String businessUnit);
-
- Integer insertEmployee(String firstName, String lastName, String gender, int departmentId);
-
- void updateEmployee(int idPers, String phoneNumber);
-
- void doQuery(QueryType type);
-
- public enum QueryType
- {
- Reader,
- BeanList,
- XmlDocument
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/EmpireAppImpl.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/EmpireAppImpl.java
deleted file mode 100644
index 58c29b7..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/EmpireAppImpl.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring;
-
-import java.sql.Connection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.empire.db.DBColumn;
-import org.apache.empire.db.DBColumnExpr;
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBReader;
-import org.apache.empire.db.DBRecord;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.db.derby.DBDatabaseDriverDerby;
-import org.apache.empire.db.h2.DBDatabaseDriverH2;
-import org.apache.empire.db.hsql.DBDatabaseDriverHSql;
-import org.apache.empire.db.postgresql.DBDatabaseDriverPostgreSQL;
-import org.apache.empire.samples.spring.db.SampleBean;
-import org.apache.empire.samples.spring.db.SampleDB;
-import org.apache.empire.samples.spring.support.EmpireDaoSupport;
-import org.apache.empire.xml.XMLWriter;
-import org.springframework.transaction.annotation.Transactional;
-import org.w3c.dom.Document;
-
-/**
- *
- */
-public class EmpireAppImpl extends EmpireDaoSupport implements EmpireApp {
-
-
- @Transactional
- public void clearDatabase() {
- SampleDB db = getDB();
- Connection conn = getConnection();
-
- DBCommand cmd = db.createCommand();
- // Delete all Employees (no constraints)
- db.executeSQL(cmd.getDelete(db.EMPLOYEES), conn);
- // Delete all Departments (no constraints)
- db.executeSQL(cmd.getDelete(db.DEPARTMENTS), conn);
- }
-
- @Transactional
- public Integer insertDepartment(String departmentName, String businessUnit) {
- SampleDB db = getDB();
- Connection conn = getConnection();
-
- DBRecord rec = new DBRecord();
- rec.create(db.DEPARTMENTS);
- rec.setValue(db.DEPARTMENTS.NAME, departmentName);
- rec.setValue(db.DEPARTMENTS.BUSINESS_UNIT, businessUnit);
- rec.update(conn);
- // Return Department ID
- return rec.getInt(db.DEPARTMENTS.DEPARTMENT_ID);
- }
-
- @Transactional
- public Integer insertEmployee(String firstName, String lastName, String gender, int departmentId) {
- SampleDB db = getDB();
- Connection conn = getConnection();
-
- DBRecord rec = new DBRecord();
- rec.create(db.EMPLOYEES);
- rec.setValue(db.EMPLOYEES.FIRSTNAME, firstName);
- rec.setValue(db.EMPLOYEES.LASTNAME, lastName);
- rec.setValue(db.EMPLOYEES.GENDER, gender);
- rec.setValue(db.EMPLOYEES.DEPARTMENT_ID, departmentId);
- rec.update(conn);
- // Return Employee ID
- return rec.getInt(db.EMPLOYEES.EMPLOYEE_ID);
- }
-
- @Transactional
- public void updateEmployee(int idPers, String phoneNumber) {
- if (getEmployee(idPers) == null) {
- //if you like more verbose exceptions for the app
- throw new IllegalArgumentException("The specified employee does not exist.");
- }
-
- SampleDB db = getDB();
- Connection conn = getConnection();
-
- DBRecord rec = new DBRecord();
- rec.read(db.EMPLOYEES, idPers, conn);
- // Set
- rec.setValue(db.EMPLOYEES.PHONE_NUMBER, phoneNumber);
- rec.update(conn);
- }
-
- @Transactional
- public void setupDatabase() {
- initializeDatabase();
- }
-
- @Transactional(readOnly = true)
- public void doQuery(QueryType type) {
- SampleDB db = getDB();
- Connection conn = getConnection();
-
- // Define the query
- DBCommand cmd = db.createCommand();
- // Define shortcuts for tables used - not necessary but convenient
- SampleDB.Employees EMP = db.EMPLOYEES;
- SampleDB.Departments DEP = db.DEPARTMENTS;
-
- // The following expression concats lastname + ', ' + firstname
- DBColumnExpr EMPLOYEE_FULLNAME = EMP.LASTNAME.append(", ").append(EMP.FIRSTNAME).as("FULL_NAME");
-
- // The following expression extracts the extension number from the phone field
- // e.g. substr(PHONE_NUMBER, length(PHONE_NUMBER)-instr(reverse(PHONE_NUMBER), '-')+2) AS PHONE_EXTENSION
- // Hint: Since the reverse() function is not supported by HSQLDB there is special treatment for HSQL
- DBColumnExpr PHONE_LAST_DASH;
- if ( db.getDriver() instanceof DBDatabaseDriverHSql
- || db.getDriver() instanceof DBDatabaseDriverDerby
- || db.getDriver() instanceof DBDatabaseDriverH2)
- PHONE_LAST_DASH = EMP.PHONE_NUMBER.indexOf("-", EMP.PHONE_NUMBER.indexOf("-").plus(1)).plus(1); // HSQLDB only
- else PHONE_LAST_DASH = EMP.PHONE_NUMBER.length().minus(EMP.PHONE_NUMBER.reverse().indexOf("-")).plus(2);
- DBColumnExpr PHONE_EXT_NUMBER = EMP.PHONE_NUMBER.substring(PHONE_LAST_DASH).as("PHONE_EXTENSION");
-
- // DBColumnExpr genderExpr = cmd.select(EMP.GENDER.decode(EMP.GENDER.getOptions()).as(EMP.GENDER.getName()));
- // Select required columns
- cmd.select(EMP.EMPLOYEE_ID, EMPLOYEE_FULLNAME);
- if(db.getDriver() instanceof DBDatabaseDriverPostgreSQL)
- {
- // postgres does not support the substring expression
- cmd.select(EMP.GENDER, EMP.PHONE_NUMBER);
- }else{
- cmd.select(EMP.GENDER, EMP.PHONE_NUMBER, PHONE_EXT_NUMBER);
-
- }
- cmd.select(DEP.NAME.as("DEPARTMENT"));
- cmd.select(DEP.BUSINESS_UNIT);
- cmd.join(EMP.DEPARTMENT_ID, DEP.DEPARTMENT_ID);
- // Set constraints and order
- cmd.where(EMP.LASTNAME.length().isGreaterThan(0));
- cmd.orderBy(EMP.LASTNAME, EMP.FIRSTNAME);
-
- // Query Records and print output
- DBReader reader = new DBReader();
- try
- {
- // Open Reader
- System.out.println("Running Query:");
- System.out.println(cmd.getSelect());
- reader.open(cmd, conn);
- // Print output
- System.out.println("---------------------------------");
- switch(type)
- {
- case BeanList:
- // Text-Output by iterating through all records.
- while (reader.moveNext())
- {
- System.out.println(reader.getString(EMP.EMPLOYEE_ID)
- + "\t" + reader.getString(EMPLOYEE_FULLNAME)
- + "\t" + EMP.GENDER.getOptions().get(reader.getString(EMP.GENDER))
- + "\t" + reader.getString(PHONE_EXT_NUMBER)
- + "\t" + reader.getString(DEP.NAME));
- }
- break;
- case Reader:
- // Text-Output using a list of Java Beans supplied by the DBReader
- List<SampleBean> beanList = reader.getBeanList(SampleBean.class);
- System.out.println(String.valueOf(beanList.size()) + " SampleBeans returned from Query.");
- for (SampleBean b : beanList)
- {
- System.out.println(b.toString());
- }
- break;
- case XmlDocument:
- // XML Output
- Document doc = reader.getXmlDocument();
- // Print XML Document to System.out
- XMLWriter.debug(doc);
- break;
- }
-
- } finally
- {
- // always close Reader
- reader.close();
- }
- }
-
-
- public Map<Object, Object> getDepartment(int id) {
- SampleDB db = getDB();
- return get(db.DEPARTMENTS, id);
- }
-
- public Map<Object, Object> getEmployee(int id) {
- SampleDB db = getDB();
- return get(db.EMPLOYEES, id);
- }
-
- private Map<Object, Object> get(DBTable table, int pk) {
- Connection conn = getConnection();
-
- DBCommand cmd = db.createCommand();
- cmd.select(table.getColumns());
- cmd.where(table.getPrimaryKey().getColumns()[0].is(pk)); //i know there is just one pk-column ;-)
- DBReader reader = openReader(cmd, conn);
- Map<Object, Object> dep = null;
- if (reader.moveNext()) {
- dep = new HashMap<Object, Object>();
- for (DBColumn col : table.getColumns()) {
- dep.put(col.getName(), reader.getValue(col));
- }
- }
- reader.close();
- return dep;
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java
deleted file mode 100644
index 1ff4509..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring;
-
-import java.util.logging.Logger;
-
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-
-/**
- *
- */
-public class SampleSpringApp {
- private static final Logger log = Logger.getLogger(SampleSpringApp.class.getName());
-
- //creates the application context
- //this is usually in some bootstrapping code; so your application will
- //just have one at runtime.
- static ApplicationContext ctx = getContext();
-
- //get the service that is the entry point into the application
- //normally this is injected by spring into classes that need it
- static EmpireApp appBean = ctx.getBean("empireApp", EmpireApp.class);
-
- public static void main(String[] args) throws Exception {
-
- System.out.println("Running Spring Example...");
-
- appBean.setupDatabase();
- appBean.clearDatabase();
-
- System.out.println("*** Step 6: insertDepartment() & insertEmployee() ***");
- int idDevDep = appBean.insertDepartment("Development", "ITTK");
- int idSalDep = appBean.insertDepartment("Sales", "ITTK");
-
- int idPers1 = appBean.insertEmployee("Peter", "Sharp", "M", idDevDep);
- int idPers2 = appBean.insertEmployee("Fred", "Bloggs", "M", idDevDep);
- int idPers3 = appBean.insertEmployee("Emma", "White", "F", idSalDep);
-
- System.out.println("*** Step 7: updateEmployee() ***");
- appBean.updateEmployee(idPers1, "+49-7531-457160");
- appBean.updateEmployee(idPers2, "+49-5555-505050");
- appBean.updateEmployee(idPers3, "+49-040-125486");
-
- System.out.println("*** Step 8 Option 1: queryRecords() / Tab-Output ***");
- appBean.doQuery(EmpireApp.QueryType.Reader);
-
- System.out.println("*** Step 8 Option 2: queryRecords() / Bean-List-Output ***");
- appBean.doQuery(EmpireApp.QueryType.BeanList);
-
- System.out.println("*** Step 8 Option 3: queryRecords() / XML-Output ***");
- appBean.doQuery(EmpireApp.QueryType.XmlDocument);
- }
-
-
-
- static GenericApplicationContext getContext() {
- log.info("Creating Spring Application Context ...");
- GenericApplicationContext ctx = new GenericApplicationContext();
- XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
- reader.loadBeanDefinitions(new ClassPathResource("/applicationContext.xml"));
-
- ctx.refresh();
- return ctx;
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/db/SampleBean.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/db/SampleBean.java
deleted file mode 100644
index 8814aab..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/db/SampleBean.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring.db;
-
-
-/**
- * The SampleBean class is used to demonstrate JavaBean support for SQL-Queries.
- * The SampleBean is used in the SampleApp's queryRecords function.
- */
-public class SampleBean
-{
- private int employeeId;
- private String fullName;
- private String gender;
- private String phoneNumber;
- private String department;
- private String businessUnit;
-
- /*
- * Uncomment this if you want to use constructor instead of setters
- * However, number of arguments and data types must match query!
- *
- public SampleBean(int employeeId, String fullName, String gender, String phoneNumber, String department, String businessUnit)
- {
- this.employeeId = employeeId;
- this.fullName = fullName;
- this.gender = gender;
- this.phoneNumber = phoneNumber;
- this.department = department;
- this.businessUnit = businessUnit;
- }
- */
-
- public int getEmployeeId()
- {
- return employeeId;
- }
-
- public void setEmployeeId(int employeeId)
- {
- this.employeeId = employeeId;
- }
-
- public String getFullName()
- {
- return fullName;
- }
-
- public void setFullName(String fullName)
- {
- this.fullName = fullName;
- }
-
- public String getGender()
- {
- return gender;
- }
-
- public void setGender(String gender)
- {
- this.gender = gender;
- }
-
- public String getPhoneNumber()
- {
- return phoneNumber;
- }
-
- public void setPhoneNumber(String phoneNumber)
- {
- this.phoneNumber = phoneNumber;
- }
-
- public String getDepartment()
- {
- return department;
- }
-
- public void setDepartment(String department)
- {
- this.department = department;
- }
-
- public String getBusinessUnit()
- {
- return businessUnit;
- }
-
- public void setBusinessUnit(String businessUnit)
- {
- this.businessUnit = businessUnit;
- }
-
- @Override
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- buf.append(employeeId);
- buf.append("\t");
- buf.append(fullName);
- buf.append("\t");
- buf.append(gender);
- buf.append("\t");
- buf.append(department);
- buf.append("\t");
- buf.append(businessUnit);
- return buf.toString();
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/db/SampleDB.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/db/SampleDB.java
deleted file mode 100644
index 40277bf..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/db/SampleDB.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring.db;
-
-import org.apache.empire.commons.Options;
-import org.apache.empire.data.DataType;
-import org.apache.empire.db.DBColumn;
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.db.DBTableColumn;
-
-/**
- * <PRE>
- * This file contains the definition of the data model in Java.
- * The SampleDB data model consists of two tables and a foreign key relation.
- * The tables are defined as nested classes here, but you may put the in separate files if you want.
- *
- * PLEASE NOTE THE NAMING CONVENTION:
- * Since all tables, views and columns are declared as "final" constants they are all in upper case.
- * We recommend using a prefix of T_ for tables and C_ for columns in order to keep them together
- * when listed in your IDE's code completion.
- * There is no need to stick to this convention but it makes life just another little bit easier.
- *
- * You may declare other database tables or views in the same way.
- * </PRE>
- */
-public class SampleDB extends DBDatabase
-{
- private final static long serialVersionUID = 1L;
-
- /**
- * This class represents the definition of the Departments table.
- */
- public static class Departments extends DBTable
- {
-
- private final static long serialVersionUID = 1L;
-
- public final DBTableColumn DEPARTMENT_ID;
- public final DBTableColumn NAME;
- public final DBTableColumn HEAD;
- public final DBTableColumn BUSINESS_UNIT;
- public final DBTableColumn UPDATE_TIMESTAMP;
-
- public Departments(DBDatabase db)
- {
- super("DEPARTMENTS", db);
- // ID
- DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, true, "DEP_ID_SEQUENCE");
- NAME = addColumn("NAME", DataType.VARCHAR, 80, true);
- HEAD = addColumn("HEAD", DataType.VARCHAR, 80, false);
- BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.VARCHAR, 4, true, "ITTK");
- UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP, 0, true);
-
- // Primary Key
- setPrimaryKey(DEPARTMENT_ID);
- // Set other Indexes
- addIndex("DEARTMENT_NAME_IDX", true, new DBColumn[] { NAME });
- }
- }
-
- /**
- * This class represents the definition of the Employees table.
- */
- public static class Employees extends DBTable
- {
- private final static long serialVersionUID = 1L;
-
- public final DBTableColumn EMPLOYEE_ID;
- public final DBTableColumn SALUTATION;
- public final DBTableColumn FIRSTNAME;
- public final DBTableColumn LASTNAME;
- public final DBTableColumn DATE_OF_BIRTH;
- public final DBTableColumn DEPARTMENT_ID;
- public final DBTableColumn GENDER;
- public final DBTableColumn PHONE_NUMBER;
- public final DBTableColumn EMAIL;
- public final DBTableColumn SALARY;
- public final DBTableColumn RETIRED;
- public final DBTableColumn UPDATE_TIMESTAMP;
-
- public Employees(DBDatabase db)
- {
- super("EMPLOYEES", db);
- // ID
- EMPLOYEE_ID = addColumn("EMPLOYEE_ID", DataType.AUTOINC, 0, true, "EMPLOYEE_ID_SEQUENCE");
- SALUTATION = addColumn("SALUTATION", DataType.VARCHAR, 20, false);
- FIRSTNAME = addColumn("FIRSTNAME", DataType.VARCHAR, 40, true);
- LASTNAME = addColumn("LASTNAME", DataType.VARCHAR, 40, true);
- DATE_OF_BIRTH = addColumn("DATE_OF_BIRTH", DataType.DATE, 0, false);
- DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.INTEGER, 0, true);
- GENDER = addColumn("GENDER", DataType.VARCHAR, 1, false);
- PHONE_NUMBER = addColumn("PHONE_NUMBER", DataType.VARCHAR, 40, false);
- EMAIL = addColumn("EMAIL", DataType.VARCHAR, 80, false);
- SALARY = addColumn("SALARY", DataType.DECIMAL, 10.2, false);
- RETIRED = addColumn("RETIRED", DataType.BOOL, 0, true, false);
- UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP, 0, true);
-
- // Primary Key
- setPrimaryKey(EMPLOYEE_ID);
- // Set other Indexes
- addIndex("EMPLOYEE_NAME_IDX", true, new DBColumn[] { FIRSTNAME, LASTNAME, DATE_OF_BIRTH });
-
- // Create Options for GENDER column
- Options genders = new Options();
- genders.set("M", "Male");
- genders.set("F", "Female");
- GENDER.setOptions(genders);
- }
- }
-
- // Declare all Tables and Views here
- public final Departments DEPARTMENTS = new Departments(this);
- public final Employees EMPLOYEES = new Employees(this);
-
- /**
- * Constructor of the SampleDB data model description
- *
- * Put all foreign key relations here.
- */
- public SampleDB()
- {
- // Define Foreign-Key Relations
- addRelation( EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java
deleted file mode 100644
index fbf874d..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring.support;
-
-import org.apache.empire.exceptions.EmpireException;
-import org.springframework.dao.UncategorizedDataAccessException;
-
-/**
- * Exception inside springs exception hierarchy. This may be good for client
- * code that catches any {@link org.springframework.dao.DataAccessException}
- * and doesn't want to look for implementation specific {@link org.apache.empire.exceptions.EmpireException}.
- */
-public class EmpireDBException extends UncategorizedDataAccessException {
-
- private static final long serialVersionUID = 1L;
-
- public EmpireDBException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
- public EmpireDBException(EmpireException e) {
- super(e.getMessage(), e);
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java
deleted file mode 100644
index 3127a50..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring.support;
-
-import java.sql.Connection;
-
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBDatabaseDriver;
-import org.apache.empire.db.DBReader;
-import org.apache.empire.db.DBSQLScript;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.exceptions.EmpireException;
-import org.springframework.jdbc.core.support.JdbcDaoSupport;
-
-/**
- * Extent JdbcDaoSupport from spring to provide a helper class to implement DAO objects using the Empire-DB framework.
- *
- */
-public class EmpireDaoSupport extends JdbcDaoSupport {
-
- protected DBDatabase db;
- protected DBDatabaseDriver driver;
-
- public EmpireDaoSupport() {
- }
-
- public void setDatabase(DBDatabase db) {
- this.db = db;
- }
-
- public void setDatabaseDriver(DBDatabaseDriver dbdriver) {
- this.driver = dbdriver;
- }
-
- @Override
- protected void checkDaoConfig() {
- super.checkDaoConfig();
- if (db == null)
- throw new IllegalArgumentException("'database' must be given!");
-
- if (driver == null)
- throw new IllegalArgumentException("'databaseDriver' must be given!");
- }
-
- public DBDatabase getDatabase() {
- try {
- if (!db.isOpen())
- db.open(driver, getConnection());
- return db;
- } catch (EmpireException e) {
- throw translateEmpireException(e);
- }
- }
-
- public boolean databaseExists() {
- Connection conn = getConnection();
- try {
- DBDatabase db = getDatabase();
- if (db.getTables() == null || db.getTables().isEmpty()) {
- throw new AssertionError("There are no tables in this database!");
- }
- DBCommand cmd = db.createCommand();
- if (cmd == null) {
- throw new AssertionError("The DBCommand object is null.");
- }
- DBTable t = db.getTables().get(0);
- cmd.select(t.count());
- return (db.querySingleInt(cmd, -1, conn) >= 0);
- } catch (Exception e) {
- return false;
- }
- }
-
- public void createDatabase() {
- Connection conn = getConnection();
-
- // create DLL for Database Definition
- DBSQLScript script = new DBSQLScript();
- db.getCreateDDLScript(driver, script);
- // Show DLL Statement
- System.out.println(script.toString());
- // Execute Script
- script.executeAll(driver, conn, false);
- }
-
- public void initializeDatabase() {
- try {
- if (!databaseExists()) {
- createDatabase();
- }
- } catch (EmpireException e) {
- throw translateEmpireException(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- public <T extends DBDatabase> T getDB() {
- if (getDatabase() == null) {
- throw new IllegalStateException("The database is null?!");
- }
- return (T) getDatabase();
- }
-
- public DBDatabaseDriver getDatabasedriver() {
- return driver;
- }
-
- public RuntimeException translateEmpireException(EmpireException e) {
- return new EmpireDBException(e);
- }
-
- protected DBReader openReader(DBCommand cmd, Connection conn) {
- DBReader r = new DBReader();
- r.open(cmd, conn);
- return r;
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDriverFactory.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDriverFactory.java
deleted file mode 100644
index 18d61bb..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDriverFactory.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.samples.spring.support;
-
-import java.sql.Connection;
-
-import org.apache.empire.db.DBDatabaseDriver;
-import org.apache.empire.db.derby.DBDatabaseDriverDerby;
-import org.apache.empire.db.h2.DBDatabaseDriverH2;
-import org.apache.empire.db.hsql.DBDatabaseDriverHSql;
-import org.apache.empire.db.mysql.DBDatabaseDriverMySQL;
-import org.apache.empire.db.oracle.DBDatabaseDriverOracle;
-import org.apache.empire.db.postgresql.DBDatabaseDriverPostgreSQL;
-import org.apache.empire.db.sqlserver.DBDatabaseDriverMSSQL;
-import org.springframework.jdbc.core.support.JdbcDaoSupport;
-
-/**
- * Creates the Empire-DB Drivers. Extends JdbcDaoSupport because it needs a Connection
- */
-public class EmpireDriverFactory extends JdbcDaoSupport {
-
- // copy&paste from the SampleApp
-
- public DBDatabaseDriver createDriver(String driverclass, String schema) {
- if (isClass(DBDatabaseDriverMySQL.class, driverclass))
- {
- DBDatabaseDriverMySQL driver = new DBDatabaseDriverMySQL();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(schema);
- return driver;
- }
- else if (isClass(DBDatabaseDriverOracle.class, driverclass))
- {
- DBDatabaseDriverOracle driver = new DBDatabaseDriverOracle();
- // Set Driver specific properties (if any)
- return driver;
- }
- else if (isClass(DBDatabaseDriverMSSQL.class, driverclass))
- {
- DBDatabaseDriverMSSQL driver = new DBDatabaseDriverMSSQL();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(schema);
- return driver;
- }
- else if (isClass(DBDatabaseDriverHSql.class, driverclass))
- {
- DBDatabaseDriverHSql driver = new DBDatabaseDriverHSql();
- // Set Driver specific properties (if any)
- return driver;
- }
- else if (isClass(DBDatabaseDriverPostgreSQL.class, driverclass))
- {
- DBDatabaseDriverPostgreSQL driver = new DBDatabaseDriverPostgreSQL();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(schema);
- // Create the reverse function that is needed by this sample
- Connection conn = getConnection();
- driver.createReverseFunction(conn);
- releaseConnection(conn);
- return driver;
- }
- else if (isClass(DBDatabaseDriverH2.class, driverclass))
- {
- DBDatabaseDriverH2 driver = new DBDatabaseDriverH2();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(schema);
- return driver;
- }
- else if (isClass(DBDatabaseDriverDerby.class, driverclass))
- {
- DBDatabaseDriverDerby driver = new DBDatabaseDriverDerby();
- // Set Driver specific properties (if any)
- driver.setDatabaseName(schema);
- return driver;
- }
- else
- { // Unknown Provider
- throw new RuntimeException("Unknown Database Driver " + driverclass);
- }
- }
-
- private boolean isClass(Class<? extends DBDatabaseDriver> clazz, String name) {
- return name.equals(clazz.getName());
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/EmpireApp.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/EmpireApp.java
deleted file mode 100644
index ddf809f..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/EmpireApp.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example1;
-
-
-/**
- * This is the interface to the application. It is usually some high level interface; for this basic
- * example this is the dao object.
- *
- */
-public interface EmpireApp {
-
- void clearDatabase();
-
- void setupDatabase();
-
- Integer insertDepartment(String departmentName, String businessUnit);
-
- Integer insertEmployee(String firstName, String lastName, String gender, int departmentId);
-
- void updateEmployee(int idPers, String phoneNumber);
-
- void doQuery(QueryType type);
-
- public enum QueryType
- {
- Reader,
- BeanList,
- XmlDocument
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/EmpireAppImpl.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/EmpireAppImpl.java
deleted file mode 100644
index ba5bd45..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/EmpireAppImpl.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example1;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.empire.db.DBColumn;
-import org.apache.empire.db.DBColumnExpr;
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBDatabaseDriver;
-import org.apache.empire.db.DBReader;
-import org.apache.empire.db.DBRecord;
-import org.apache.empire.db.DBRecordData;
-import org.apache.empire.db.DBSQLScript;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.db.derby.DBDatabaseDriverDerby;
-import org.apache.empire.db.h2.DBDatabaseDriverH2;
-import org.apache.empire.db.hsql.DBDatabaseDriverHSql;
-import org.apache.empire.db.postgresql.DBDatabaseDriverPostgreSQL;
-import org.apache.empire.spring.DBReaderExtractor;
-import org.apache.empire.spring.DBRecordCallbackHandler;
-import org.apache.empire.spring.DBRecordMapper;
-import org.apache.empire.spring.EmpireDaoSupport;
-import org.apache.empire.xml.XMLWriter;
-import org.springframework.dao.DataAccessException;
-import org.springframework.jdbc.core.ConnectionCallback;
-import org.springframework.transaction.annotation.Transactional;
-import org.w3c.dom.Document;
-
-/**
- *
- */
-public class EmpireAppImpl extends EmpireDaoSupport implements EmpireApp {
-
- @Transactional
- public void clearDatabase() {
- SampleDB db = getDatabase();
-
- DBCommand cmd = db.createCommand();
- // Delete all Employees (no constraints)
- getEmpireTemplate().executeDelete(db.EMPLOYEES, cmd);
- // Delete all Departments (no constraints)
- getEmpireTemplate().executeDelete(db.DEPARTMENTS, cmd);
- }
-
-
- @Transactional
- public Integer insertDepartment(String departmentName, String businessUnit) {
- SampleDB db = getDatabase();
-
- DBRecord rec = new DBRecord();
- rec.create(db.DEPARTMENTS);
- rec.setValue(db.DEPARTMENTS.NAME, departmentName);
- rec.setValue(db.DEPARTMENTS.BUSINESS_UNIT, businessUnit);
-
- getEmpireTemplate().updateRecord(rec);
- // Return Department ID
- return rec.getInt(db.DEPARTMENTS.DEPARTMENT_ID);
- }
-
- @Transactional
- public Integer insertEmployee(String firstName, String lastName,
- String gender, int departmentId) {
- SampleDB db = getDatabase();
-
- DBRecord rec = new DBRecord();
- rec.create(db.EMPLOYEES);
- rec.setValue(db.EMPLOYEES.FIRSTNAME, firstName);
- rec.setValue(db.EMPLOYEES.LASTNAME, lastName);
- rec.setValue(db.EMPLOYEES.GENDER, gender);
- rec.setValue(db.EMPLOYEES.DEPARTMENT_ID, departmentId);
- getEmpireTemplate().updateRecord(rec);
- // Return Employee ID
- return rec.getInt(db.EMPLOYEES.EMPLOYEE_ID);
- }
-
- @Transactional
- public void updateEmployee(int idPers, String phoneNumber) {
- if (getEmployee(idPers) == null) {
- // if you like more verbose exceptions for the app
- throw new IllegalArgumentException(
- "The specified employee does not exist.");
- }
-
- SampleDB db = getDatabase();
-
- DBRecord rec = getEmpireTemplate().openRecord(db.EMPLOYEES, idPers);
- // Set
- rec.setValue(db.EMPLOYEES.PHONE_NUMBER, phoneNumber);
- getEmpireTemplate().updateRecord(rec);
- }
-
- @Transactional(readOnly = true)
- public void doQuery(QueryType type) {
- SampleDB db = getDatabase();
-
- // Define the query
- DBCommand cmd = db.createCommand();
- // Define shortcuts for tables used - not necessary but convenient
- final SampleDB.Employees EMP = db.EMPLOYEES;
- final SampleDB.Departments DEP = db.DEPARTMENTS;
-
- // The following expression concats lastname + ', ' + firstname
- final DBColumnExpr EMPLOYEE_FULLNAME = EMP.LASTNAME.append(", ")
- .append(EMP.FIRSTNAME).as("FULL_NAME");
-
- // The following expression extracts the extension number from the phone
- // field
- // e.g. substr(PHONE_NUMBER,
- // length(PHONE_NUMBER)-instr(reverse(PHONE_NUMBER), '-')+2) AS
- // PHONE_EXTENSION
- // Hint: Since the reverse() function is not supported by HSQLDB there
- // is special treatment for HSQL
- final DBColumnExpr PHONE_LAST_DASH;
- if (db.getDriver() instanceof DBDatabaseDriverHSql
- || db.getDriver() instanceof DBDatabaseDriverDerby
- || db.getDriver() instanceof DBDatabaseDriverH2)
- PHONE_LAST_DASH = EMP.PHONE_NUMBER.indexOf("-",
- EMP.PHONE_NUMBER.indexOf("-").plus(1)).plus(1); // HSQLDB
- // only
- else
- PHONE_LAST_DASH = EMP.PHONE_NUMBER.length()
- .minus(EMP.PHONE_NUMBER.reverse().indexOf("-")).plus(2);
- final DBColumnExpr PHONE_EXT_NUMBER = EMP.PHONE_NUMBER.substring(
- PHONE_LAST_DASH).as("PHONE_EXTENSION");
-
- // DBColumnExpr genderExpr =
- // cmd.select(EMP.GENDER.decode(EMP.GENDER.getOptions()).as(EMP.GENDER.getName()));
- // Select required columns
- cmd.select(EMP.EMPLOYEE_ID, EMPLOYEE_FULLNAME);
- if (db.getDriver() instanceof DBDatabaseDriverPostgreSQL) {
- // postgres does not support the substring expression
- cmd.select(EMP.GENDER, EMP.PHONE_NUMBER);
- } else {
- cmd.select(EMP.GENDER, EMP.PHONE_NUMBER, PHONE_EXT_NUMBER);
-
- }
- cmd.select(DEP.NAME.as("DEPARTMENT"));
- cmd.select(DEP.BUSINESS_UNIT);
- cmd.join(EMP.DEPARTMENT_ID, DEP.DEPARTMENT_ID);
- // Set constraints and order
- cmd.where(EMP.LASTNAME.length().isGreaterThan(0));
- cmd.orderBy(EMP.LASTNAME, EMP.FIRSTNAME);
-
- // Query Records and print output
- try {
- // Open Reader
- System.out.println("Running Query:");
- System.out.println(cmd.getSelect());
- // Print output
- System.out.println("---------------------------------");
- switch (type) {
- case BeanList:
- // Text-Output by iterating through all records.
- DBRecordCallbackHandler readerImpl = new DBRecordCallbackHandler() {
-
- public void processRecord(DBRecordData reader) {
- System.out.println(reader.getString(EMP.EMPLOYEE_ID)
- + "\t"
- + reader.getString(EMPLOYEE_FULLNAME)
- + "\t"
- + EMP.GENDER.getOptions().get(
- reader.getString(EMP.GENDER)) + "\t"
- + reader.getString(PHONE_EXT_NUMBER) + "\t"
- + reader.getString(DEP.NAME));
-
- }
- };
- getEmpireTemplate().query(cmd, readerImpl);
- break;
- case Reader:
- // Text-Output using a list of Java Beans supplied by the
- // DBReader
- DBReaderExtractor<List<SampleBean>> beanListImpl = new DBReaderExtractor<List<SampleBean>>() {
-
- public List<SampleBean> process(DBReader reader) {
- return reader.getBeanList(SampleBean.class);
- }
- };
- List<SampleBean> beanList = getEmpireTemplate().query(cmd,
- beanListImpl);
- System.out.println(String.valueOf(beanList.size())
- + " SampleBeans returned from Query.");
- for (SampleBean b : beanList) {
- System.out.println(b.toString());
- }
- break;
- case XmlDocument:
- // XML Output
- XmlDocumentExtractor xmlImpl = new XmlDocumentExtractor();
- Document doc = getEmpireTemplate().query(cmd, xmlImpl);
- // Print XML Document to System.out
- XMLWriter.debug(doc);
- break;
- }
-
- } finally {
-
- // always close Reader
-
- // reader is closed in EmpireTemplate's methods
-
- // reader.close();
- }
- }
-
- public Map<Object, Object> getDepartment(int id) {
- SampleDB db = getDatabase();
- return get(db.DEPARTMENTS, id);
- }
-
- public Map<Object, Object> getEmployee(int id) {
- SampleDB db = getDatabase();
- return get(db.EMPLOYEES, id);
- }
-
- private Map<Object, Object> get(DBTable table, int pk) {
-
- SampleDB db = getDatabase();
-
- DBCommand cmd = db.createCommand();
- cmd.select(table.getColumns());
- cmd.where(table.getPrimaryKey().getColumns()[0].is(pk)); // i know there
- // is just
- // one
- // pk-column
- // ;-)
- Map<Object, Object> dep = getEmpireTemplate().queryForObject(cmd,
- new RowToObjectMapDataMapper(table));
-
- return dep;
- }
-
- public static class XmlDocumentExtractor implements
- DBReaderExtractor<Document> {
-
- public Document process(DBReader reader) {
- return reader.getXmlDocument();
- }
-
- }
-
- public static class RowToObjectMapDataMapper implements
- DBRecordMapper<Map<Object, Object>> {
-
- DBTable table;
-
- public RowToObjectMapDataMapper(DBTable table) {
- super();
- this.table = table;
- }
-
- public Map<Object, Object> mapRecord(DBRecordData record, int rowNum) {
- Map<Object, Object> dep = new HashMap<Object, Object>();
- for (DBColumn col : table.getColumns()) {
- dep.put(col.getName(), record.getValue(col));
- }
- return dep;
- }
-
- }
-
- public boolean databaseExists() {
- Connection conn = getConnection();
- try {
- DBDatabase db = getDatabase();
- if (db.getTables() == null || db.getTables().isEmpty()) {
- throw new AssertionError(
- "There are no tables in this database!");
- }
- DBCommand cmd = db.createCommand();
- if (cmd == null) {
- throw new AssertionError("The DBCommand object is null.");
- }
- DBTable t = db.getTables().get(0);
- cmd.select(t.count());
- return (db.querySingleInt(cmd, -1, conn) >= 0);
- } catch (Exception e) {
- return false;
- }
- }
-
- public void initializeDatabase() {
- if (!databaseExists()) {
- createDatabase();
- }
- }
-
- @Transactional
- public void setupDatabase() {
- initializeDatabase();
- }
-
- public void createDatabase() {
-
- // create DLL for Database Definition
- final DBSQLScript script = new DBSQLScript();
- final DBDatabaseDriver driver = getDatabase().getDriver();
- getDatabase().getCreateDDLScript(driver, script);
-
- // Show DLL Statement
- System.out.println(script.toString());
- // Execute Script
- getEmpireTemplate().execute(new ConnectionCallback<Object>() {
-
- public Object doInConnection(Connection con) throws SQLException,
- DataAccessException {
- script.executeAll(driver, con, false);
- return null;
- }
- });
-
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleBean.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleBean.java
deleted file mode 100644
index efe89b1..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleBean.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example1;
-
-
-/**
- * The SampleBean class is used to demonstrate JavaBean support for SQL-Queries.
- * The SampleBean is used in the SampleApp's queryRecords function.
- */
-public class SampleBean
-{
- private int employeeId;
- private String fullName;
- private String gender;
- private String phoneNumber;
- private String department;
- private String businessUnit;
-
- /*
- * Uncomment this if you want to use constructor instead of setters
- * However, number of arguments and data types must match query!
- *
- public SampleBean(int employeeId, String fullName, String gender, String phoneNumber, String department, String businessUnit)
- {
- this.employeeId = employeeId;
- this.fullName = fullName;
- this.gender = gender;
- this.phoneNumber = phoneNumber;
- this.department = department;
- this.businessUnit = businessUnit;
- }
- */
-
- public int getEmployeeId()
- {
- return employeeId;
- }
-
- public void setEmployeeId(int employeeId)
- {
- this.employeeId = employeeId;
- }
-
- public String getFullName()
- {
- return fullName;
- }
-
- public void setFullName(String fullName)
- {
- this.fullName = fullName;
- }
-
- public String getGender()
- {
- return gender;
- }
-
- public void setGender(String gender)
- {
- this.gender = gender;
- }
-
- public String getPhoneNumber()
- {
- return phoneNumber;
- }
-
- public void setPhoneNumber(String phoneNumber)
- {
- this.phoneNumber = phoneNumber;
- }
-
- public String getDepartment()
- {
- return department;
- }
-
- public void setDepartment(String department)
- {
- this.department = department;
- }
-
- public String getBusinessUnit()
- {
- return businessUnit;
- }
-
- public void setBusinessUnit(String businessUnit)
- {
- this.businessUnit = businessUnit;
- }
-
- @Override
- public String toString()
- {
- StringBuffer buf = new StringBuffer();
- buf.append(employeeId);
- buf.append("\t");
- buf.append(fullName);
- buf.append("\t");
- buf.append(gender);
- buf.append("\t");
- buf.append(department);
- buf.append("\t");
- buf.append(businessUnit);
- return buf.toString();
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleDB.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleDB.java
deleted file mode 100644
index d13f647..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleDB.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example1;
-
-import org.apache.empire.commons.Options;
-import org.apache.empire.data.DataType;
-import org.apache.empire.data.DataMode;
-import org.apache.empire.db.DBColumn;
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.db.DBTableColumn;
-
-/**
- * <PRE>
- * This file contains the definition of the data model in Java.
- * The SampleDB data model consists of two tables and a foreign key relation.
- * The tables are defined as nested classes here, but you may put the in separate files if you want.
- *
- * PLEASE NOTE THE NAMING CONVENTION:
- * Since all tables, views and columns are declared as "final" constants they are all in upper case.
- * We recommend using a prefix of T_ for tables and C_ for columns in order to keep them together
- * when listed in your IDE's code completion.
- * There is no need to stick to this convention but it makes life just another little bit easier.
- *
- * You may declare other database tables or views in the same way.
- * </PRE>
- */
-public class SampleDB extends DBDatabase
-{
- private final static long serialVersionUID = 1L;
-
- /**
- * This class represents the definition of the Departments table.
- */
- public static class Departments extends DBTable
- {
-
- private final static long serialVersionUID = 1L;
-
- public final DBTableColumn DEPARTMENT_ID;
- public final DBTableColumn NAME;
- public final DBTableColumn HEAD;
- public final DBTableColumn BUSINESS_UNIT;
- public final DBTableColumn UPDATE_TIMESTAMP;
-
- public Departments(DBDatabase db)
- {
- super("DEPARTMENTS", db);
- // ID
- DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, true, "DEP_ID_SEQUENCE");
- NAME = addColumn("NAME", DataType.VARCHAR, 80, true);
- HEAD = addColumn("HEAD", DataType.VARCHAR, 80, false);
- BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.VARCHAR, 4, true, "ITTK");
- UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP, 0, true);
-
- // Primary Key
- setPrimaryKey(DEPARTMENT_ID);
- // Set other Indexes
- addIndex("DEARTMENT_NAME_IDX", true, new DBColumn[] { NAME });
- }
- }
-
- /**
- * This class represents the definition of the Employees table.
- */
- public static class Employees extends DBTable
- {
- private final static long serialVersionUID = 1L;
-
- public final DBTableColumn EMPLOYEE_ID;
- public final DBTableColumn SALUTATION;
- public final DBTableColumn FIRSTNAME;
- public final DBTableColumn LASTNAME;
- public final DBTableColumn DATE_OF_BIRTH;
- public final DBTableColumn DEPARTMENT_ID;
- public final DBTableColumn GENDER;
- public final DBTableColumn PHONE_NUMBER;
- public final DBTableColumn EMAIL;
- public final DBTableColumn SALARY;
- public final DBTableColumn RETIRED;
- public final DBTableColumn UPDATE_TIMESTAMP;
-
- public Employees(DBDatabase db)
- {
- super("EMPLOYEES", db);
- // ID
- EMPLOYEE_ID = addColumn("EMPLOYEE_ID", DataType.AUTOINC, 0, true, "EMPLOYEE_ID_SEQUENCE");
- SALUTATION = addColumn("SALUTATION", DataType.VARCHAR, 20, false);
- FIRSTNAME = addColumn("FIRST_NAME", DataType.VARCHAR, 40, true);
- LASTNAME = addColumn("LAST_NAME", DataType.VARCHAR, 40, true);
- DATE_OF_BIRTH = addColumn("DATE_OF_BIRTH", DataType.DATE, 0, false);
- DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.INTEGER, 0, true);
- GENDER = addColumn("GENDER", DataType.VARCHAR, 1, false);
- PHONE_NUMBER = addColumn("PHONE_NUMBER", DataType.VARCHAR, 40, false);
- EMAIL = addColumn("EMAIL", DataType.VARCHAR, 80, false);
- SALARY = addColumn("SALARY", DataType.DECIMAL, 10.2, false);
- RETIRED = addColumn("RETIRED", DataType.BOOL, 0, true, false);
- UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.TIMESTAMP, 0, true);
-
- // Primary Key
- setPrimaryKey(EMPLOYEE_ID);
- // Set other Indexes
- addIndex("EMPLOYEE_NAME_IDX", true, new DBColumn[] { FIRSTNAME, LASTNAME, DATE_OF_BIRTH });
-
- // Create Options for GENDER column
- Options genders = new Options();
- genders.set("M", "Male");
- genders.set("F", "Female");
- GENDER.setOptions(genders);
- }
- }
-
- // Declare all Tables and Views here
- public final Departments DEPARTMENTS = new Departments(this);
- public final Employees EMPLOYEES = new Employees(this);
-
- /**
- * Constructor of the SampleDB data model description
- *
- * Put all foreign key relations here.
- */
- public SampleDB()
- {
- // Define Foreign-Key Relations
- addRelation( EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleSpringApp.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleSpringApp.java
deleted file mode 100644
index 3ff0230..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example1/SampleSpringApp.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example1;
-
-import java.util.logging.Logger;
-
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-
-/**
- *
- */
-public class SampleSpringApp {
- private static final Logger log = Logger.getLogger(SampleSpringApp.class.getName());
-
- //creates the application context
- //this is usually in some bootstrapping code; so your application will
- //just have one at runtime.
- static ApplicationContext ctx = getContext();
-
- //get the service that is the entry point into the application
- //normally this is injected by spring into classes that need it
- static EmpireApp appBean = ctx.getBean("empireApp", EmpireApp.class);
-
- public static void main(String[] args) throws Exception {
-
- System.out.println("Running Spring Example...");
-
- appBean.setupDatabase();
- appBean.clearDatabase();
-
- System.out.println("*** Step 6: insertDepartment() & insertEmployee() ***");
- int idDevDep = appBean.insertDepartment("Development", "ITTK");
- int idSalDep = appBean.insertDepartment("Sales", "ITTK");
-
- int idPers1 = appBean.insertEmployee("Peter", "Sharp", "M", idDevDep);
- int idPers2 = appBean.insertEmployee("Fred", "Bloggs", "M", idDevDep);
- int idPers3 = appBean.insertEmployee("Emma", "White", "F", idSalDep);
-
- System.out.println("*** Step 7: updateEmployee() ***");
- appBean.updateEmployee(idPers1, "+49-7531-457160");
- appBean.updateEmployee(idPers2, "+49-5555-505050");
- appBean.updateEmployee(idPers3, "+49-040-125486");
-
- System.out.println("*** Step 8 Option 1: queryRecords() / Tab-Output ***");
- appBean.doQuery(EmpireApp.QueryType.Reader);
-
- System.out.println("*** Step 8 Option 2: queryRecords() / Bean-List-Output ***");
- appBean.doQuery(EmpireApp.QueryType.BeanList);
-
- System.out.println("*** Step 8 Option 3: queryRecords() / XML-Output ***");
- appBean.doQuery(EmpireApp.QueryType.XmlDocument);
-
-
- }
-
-
-
- static GenericApplicationContext getContext() {
- log.info("Creating Spring Application Context ...");
- GenericApplicationContext ctx = new GenericApplicationContext();
- XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
- reader.loadBeanDefinitions(new ClassPathResource("/example1/applicationContext.xml"));
-
- ctx.refresh();
- return ctx;
- }
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/Department.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/Department.java
deleted file mode 100644
index 08d8943..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/Department.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example2;
-
-public class Department {
-
- private Integer departmentId;
- private String name;
- private String businessUnit;
- private String head;
-
- public Integer getDepartmentId() {
- return departmentId;
- }
-
- public void setDepartmentId(Integer departmentId) {
- this.departmentId = departmentId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getBusinessUnit() {
- return businessUnit;
- }
-
- public void setBusinessUnit(String businessUnit) {
- this.businessUnit = businessUnit;
- }
-
- public String getHead() {
- return head;
- }
-
- public void setHead(String head) {
- this.head = head;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(departmentId);
- buf.append("\t");
- buf.append(name);
- buf.append(" ");
- buf.append(businessUnit);
- buf.append("\t");
- buf.append(head);
- return buf.toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
-
- if (obj.getClass().equals(this.getClass())) {
- Department other = (Department) obj;
- if (other.departmentId == null || this.departmentId == null) {
- return false;
- }
- return this.departmentId.equals(other.departmentId);
- }
-
- return super.equals(obj);
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/Employee.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/Employee.java
deleted file mode 100644
index 5a07ce9..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/Employee.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example2;
-
-public class Employee {
-
- public static enum Gender {
-
- M("Male"), F("Female");
-
- private String label;
-
- private Gender(String label) {
- this.label = label;
- }
-
- @Override
- public String toString() {
- return this.label;
- }
- }
-
- private Integer employeeId;
- private String firstName;
- private String lastName;
- private Gender gender;
- private String phoneNumber;
-
- private Department department;
-
- public Integer getEmployeeId() {
- return employeeId;
- }
-
- public void setEmployeeId(Integer employeeId) {
- this.employeeId = employeeId;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public Gender getGender() {
- return gender;
- }
-
- public void setGender(Gender gender) {
- this.gender = gender;
- }
-
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
-
- public Department getDepartment() {
- return department;
- }
-
- public void setDepartment(Department department) {
- this.department = department;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(employeeId);
- buf.append("\t");
- buf.append(firstName);
- buf.append(" ");
- buf.append(lastName);
- buf.append("\t");
- buf.append(gender);
-
- if (department != null){
- buf.append("\t");
- buf.append(department.getName());
- buf.append("\t");
- buf.append(department.getBusinessUnit());
- }
- return buf.toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
-
- if (obj.getClass().equals(this.getClass())) {
- Employee other = (Employee) obj;
- if (other.employeeId == null || this.employeeId == null) {
- return false;
- }
- return this.employeeId.equals(other.employeeId);
- }
-
- return super.equals(obj);
- }
-
- @Override
- public int hashCode() {
- return 1;
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeDao.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeDao.java
deleted file mode 100644
index b2dd39f..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example2;
-
-import java.util.List;
-
-public interface EmployeeDao {
-
- public List<Employee> getEmployees();
-
- public List<Department> getDepartments();
-
- public Integer createEmployee(Employee employee);
-
- public void updateEmployee(Employee employee);
-
- public Employee openEmployee(Integer id);
-
- public Employee findEmployee(String firstName, String lastName);
-
- public Department openDepartment(Integer id);
-
- public Department findDepartment(String name);
-
- public Integer createDepartment(Department department);
-
- public void updateDepartment(Department department);
-
- public void renameDepartment(Integer id, String name);
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeDaoImpl.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeDaoImpl.java
deleted file mode 100644
index 37eb07b..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeDaoImpl.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example2;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBJoinType;
-import org.apache.empire.db.DBRecord;
-import org.apache.empire.db.DBRecordData;
-import org.apache.empire.spring.DBRecordMapper;
-import org.apache.empire.spring.DBRecordWriter;
-import org.apache.empire.spring.EmpireDaoSupport;
-import org.apache.empire.spring.example1.SampleDB;
-import org.apache.empire.spring.example1.SampleDB.Departments;
-import org.apache.empire.spring.example1.SampleDB.Employees;
-import org.springframework.transaction.annotation.Transactional;
-
-public class EmployeeDaoImpl extends EmpireDaoSupport implements EmployeeDao {
-
- private Employees EMPLOYEES;
- private Departments DEPARTMENTS;
-
- @Override
- protected void initEmpireDao() {
- SampleDB db = getDatabase();
- this.EMPLOYEES = db.EMPLOYEES;
- this.DEPARTMENTS = db.DEPARTMENTS;
- }
-
- private DBCommand createEmployeeSelectCommand() {
- DBCommand cmd = getDatabase().createCommand();
- cmd.select(EMPLOYEES.getColumns());
- cmd.select(DEPARTMENTS.getColumns());
-
- cmd.join(EMPLOYEES.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_ID, DBJoinType.INNER);
- return cmd;
- }
-
- private DBCommand createDepartmentSelectCommand() {
- DBCommand cmd = getDatabase().createCommand();
- cmd.select(DEPARTMENTS.getColumns());
- return cmd;
- }
-
- @Transactional(readOnly = true)
- public Employee openEmployee(Integer id) {
- DBCommand cmd = createEmployeeSelectCommand();
- cmd.where(EMPLOYEES.EMPLOYEE_ID.is(id));
- return getEmpireTemplate().queryForObject(cmd, new EmployeeMapper());
- }
-
- @Transactional(readOnly = true)
- public Employee findEmployee(String firstName, String lastName) {
- DBCommand cmd = createEmployeeSelectCommand();
- cmd.where(EMPLOYEES.FIRSTNAME.is(firstName));
- cmd.where(EMPLOYEES.LASTNAME.is(lastName));
- return getEmpireTemplate().queryForObject(cmd, new EmployeeMapper());
- }
-
- @Transactional(readOnly = true)
- public Department openDepartment(Integer id) {
- DBCommand cmd = createDepartmentSelectCommand();
- cmd.where(DEPARTMENTS.DEPARTMENT_ID.is(id));
- return getEmpireTemplate().queryForBean(cmd, Department.class);
- }
-
- @Transactional(readOnly = true)
- public Department findDepartment(String name) {
- DBCommand cmd = createDepartmentSelectCommand();
- cmd.where(DEPARTMENTS.NAME.is(name));
- return getEmpireTemplate().queryForBean(cmd, Department.class);
- }
-
- @Transactional(readOnly = true)
- public List<Department> getDepartments() {
- DBCommand cmd = createDepartmentSelectCommand();
- return getEmpireTemplate().queryForBeanList(cmd, Department.class);
- }
-
-
- @Transactional
- public void renameDepartment(Integer id, String name) {
- DBCommand cmd = getDatabase().createCommand();
- cmd.where(DEPARTMENTS.DEPARTMENT_ID.is(id));
- cmd.set(DEPARTMENTS.NAME.to(name));
- getEmpireTemplate().executeUpdate(cmd);
- }
-
- @Transactional(readOnly = true)
- public List<Employee> getEmployees() {
- DBCommand cmd = createEmployeeSelectCommand();
- return getEmpireTemplate().query(cmd, new EmployeeMapper());
- }
-
- @Transactional
- public Integer createEmployee(Employee employee) {
- DBRecord record = new DBRecord();
- record.create(EMPLOYEES);
- new EmployeeWriter().write(record, employee);
- getEmpireTemplate().updateRecord(record);
- return record.getInt(EMPLOYEES.EMPLOYEE_ID);
- }
-
- @Transactional
- public void updateEmployee(Employee employee) {
- DBRecord record = getEmpireTemplate().openRecord(EMPLOYEES, employee.getEmployeeId());
- new EmployeeWriter().write(record, employee);
- getEmpireTemplate().updateRecord(record);
- }
-
- @Transactional
- public Integer createDepartment(Department department) {
- DBRecord record = new DBRecord();
- record.create(DEPARTMENTS);
- new DepartmentWriter().write(record, department);
- getEmpireTemplate().updateRecord(record);
- return record.getInt(DEPARTMENTS.DEPARTMENT_ID);
- }
-
- @Transactional
- public void updateDepartment(Department department) {
- DBRecord record = getEmpireTemplate().openRecord(DEPARTMENTS, department.getDepartmentId());
- new DepartmentWriter().write(record, department);
- getEmpireTemplate().updateRecord(record);
- }
-
- private class EmployeeMapper implements DBRecordMapper<Employee> {
-
- DepartmentMapper departmentMapper = new DepartmentMapper();
-
- @Override
- public Employee mapRecord(DBRecordData record, int rowNum) {
- Employee result = new Employee();
- // Auto-copy all properties
- //record.setBeanProperties(result);
-
- result.setEmployeeId(record.getInt(EMPLOYEES.EMPLOYEE_ID));
- result.setFirstName(record.getString(EMPLOYEES.FIRSTNAME));
- result.setLastName(record.getString(EMPLOYEES.LASTNAME));
- result.setGender(Employee.Gender.valueOf(record.getString(EMPLOYEES.GENDER)));
- result.setPhoneNumber(record.getString(EMPLOYEES.PHONE_NUMBER));
-
- result.setDepartment(departmentMapper.mapRecord(record, rowNum));
- return result;
- }
-
- }
-
- private class EmployeeWriter implements DBRecordWriter<Employee> {
-
- @Override
- public void write(DBRecord record, Employee entity) {
- // Auto-copy all properties
- //record.setRecordValues(entity);
-
- record.setValue(EMPLOYEES.EMPLOYEE_ID, entity.getEmployeeId());
- record.setValue(EMPLOYEES.FIRSTNAME, entity.getFirstName());
- record.setValue(EMPLOYEES.LASTNAME, entity.getLastName());
- record.setValue(EMPLOYEES.GENDER, entity.getGender().name());
- record.setValue(EMPLOYEES.PHONE_NUMBER, entity.getPhoneNumber());
-
- record.setValue(EMPLOYEES.DEPARTMENT_ID, entity.getDepartment().getDepartmentId());
- }
-
- }
-
- private class DepartmentMapper implements DBRecordMapper<Department> {
-
- // reader cache, in case of joined resultset the same object is returned
-
- Map<Integer, Department> cache = new HashMap<Integer, Department>();
-
- @Override
- public Department mapRecord(DBRecordData record, int rowNum) {
-
- Integer id = record.getInt(DEPARTMENTS.DEPARTMENT_ID);
-
- Department department = cache.get(id);
- if (department == null) {
- department = new Department();
- // Auto-copy all properties
- //record.setBeanProperties(department);
-
- department.setDepartmentId(id);
- department.setName(record.getString(DEPARTMENTS.NAME));
- department.setHead(record.getString(DEPARTMENTS.HEAD));
- department.setBusinessUnit(record.getString(DEPARTMENTS.BUSINESS_UNIT));
-
- cache.put(id, department);
- }
- return department;
- }
-
- }
-
- private class DepartmentWriter implements DBRecordWriter<Department> {
-
- @Override
- public void write(DBRecord record, Department entity) {
- // Auto-copy all properties
- //record.setRecordValues(entity);
-
- record.setValue(DEPARTMENTS.DEPARTMENT_ID, entity.getDepartmentId());
- record.setValue(DEPARTMENTS.NAME, entity.getName());
- record.setValue(DEPARTMENTS.HEAD, entity.getHead());
- record.setValue(DEPARTMENTS.BUSINESS_UNIT, entity.getBusinessUnit());
-
- }
-
- }
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeSpringApp.java b/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeSpringApp.java
deleted file mode 100644
index 3b641a7..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/spring/example2/EmployeeSpringApp.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.empire.spring.example2;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.empire.db.DBColumnExpr;
-import org.apache.empire.db.DBCommand;
-import org.apache.empire.db.DBDatabase;
-import org.apache.empire.db.DBDatabaseDriver;
-import org.apache.empire.db.DBSQLScript;
-import org.apache.empire.db.DBTable;
-import org.apache.empire.spring.EmpireTemplate;
-import org.apache.empire.spring.example1.SampleDB;
-import org.apache.empire.spring.example2.Employee.Gender;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.dao.DataAccessException;
-import org.springframework.jdbc.core.ConnectionCallback;
-
-/**
- *
- */
-public class EmployeeSpringApp {
- private static final Logger log = Logger.getLogger(EmployeeSpringApp.class.getName());
-
- //creates the application context
- //this is usually in some bootstrapping code; so your application will
- //just have one at runtime.
- static ApplicationContext ctx = getContext();
-
- //get the service that is the entry point into the application
- //normally this is injected by spring into classes that need it
- static EmployeeDao employeeDao = ctx.getBean("employeeDao", EmployeeDao.class);
- static SampleDB sampleDb = ctx.getBean("sampleDb", SampleDB.class);
-
- public static void main(String[] args) throws Exception {
-
- System.out.println("Running Spring Example...");
-
- setupDatabase();
- clearDatabase();
-
- Department depDevelopment, depSales;
-
- System.out.println("*** Create Departments ***");
-
- {
- depDevelopment = new Department();
- depDevelopment.setName("Development");
- depDevelopment.setBusinessUnit("ITTK");
- Integer id = employeeDao.createDepartment(depDevelopment);
- depDevelopment = employeeDao.openDepartment(id);
- }
- {
- depSales = new Department();
- depSales.setName("Sales");
- depSales.setBusinessUnit("ITTK");
- Integer id = employeeDao.createDepartment(depSales);
- depSales = employeeDao.openDepartment(id);
- }
-
- System.out.println("*** Create Employees ***");
-
- Employee peter = new Employee();
- peter.setFirstName("Peter");
- peter.setLastName("Sharp");
- peter.setGender(Gender.M);
- peter.setDepartment(depDevelopment);
-
- Integer peterId = employeeDao.createEmployee(peter);
- peter = employeeDao.openEmployee(peterId);
-
-
-
- Employee fred = new Employee();
- fred.setFirstName("Fred");
- fred.setLastName("Bloggs");
- fred.setGender(Gender.M);
- fred.setDepartment(depDevelopment);
-
- Integer fredId = employeeDao.createEmployee(fred);
- fred = employeeDao.openEmployee(fredId);
-
-
- Employee emma = new Employee();
- emma.setFirstName("Emma");
- emma.setLastName("White");
- emma.setGender(Gender.F);
- emma.setDepartment(depSales);
-
- Integer emmaId = employeeDao.createEmployee(emma);
- emma = employeeDao.openEmployee(emmaId);
-
-
- System.out.println("*** updateEmployees ***");
-
- peter.setPhoneNumber("+49-7531-457160");
- employeeDao.updateEmployee(peter);
-
- fred.setPhoneNumber("+49-5555-505050");
- employeeDao.updateEmployee(fred);
-
- emma.setPhoneNumber("+49-040-125486");
- employeeDao.updateEmployee(emma);
-
- System.out.println("*** List employees ***");
-
- List<Employee> employees = employeeDao.getEmployees();
- for (Iterator<Employee> iterator = employees.iterator(); iterator.hasNext();) {
- Employee employee = iterator.next();
- System.out.println(employee);
- }
-
- System.out.println("*** List departments ***");
-
- List<Department> departments = employeeDao.getDepartments();
- for (Iterator<Department> iterator = departments.iterator(); iterator.hasNext();) {
- Department department = iterator.next();
- System.out.println(department);
- }
-
- }
-
- private static void clearDatabase() {
- // Delete all Employees (no constraints)
-
- EmpireTemplate empireTemplate = ctx.getBean("empireTemplate", EmpireTemplate.class);
- empireTemplate.executeDelete(sampleDb.EMPLOYEES, sampleDb.createCommand());
- empireTemplate.executeDelete(sampleDb.DEPARTMENTS, sampleDb.createCommand());
-
- }
-
-
-
-
- public static void setupDatabase() {
- if (!databaseExists()) {
- createDatabase();
- }
- }
-
-
- public static boolean databaseExists() {
- try {
- DBDatabase db = sampleDb;
- if (db.getTables() == null || db.getTables().isEmpty()) {
- throw new AssertionError(
- "There are no tables in this database!");
- }
- DBCommand cmd = db.createCommand();
- if (cmd == null) {
- throw new AssertionError("The DBCommand object is null.");
- }
- DBTable t = db.getTables().get(0);
- DBColumnExpr COUNT = t.count();
-
- cmd.select(COUNT);
-
- EmpireTemplate empireTemplate = ctx.getBean("empireTemplate", EmpireTemplate.class);
- return (empireTemplate.queryForInteger(cmd, COUNT, -1) >= 0);
- } catch (Exception e) {
- return false;
- }
- }
-
-
- private static void createDatabase() {
-
- // create DLL for Database Definition
- final DBSQLScript script = new DBSQLScript();
- final DBDatabaseDriver driver = sampleDb.getDriver();
- sampleDb.getCreateDDLScript(driver, script);
-
- // Show DLL Statement
- System.out.println(script.toString());
- // Execute Script
- EmpireTemplate empireTemplate = ctx.getBean("empireTemplate", EmpireTemplate.class);
- empireTemplate.execute(new ConnectionCallback<Object>() {
-
- @Override
- public Object doInConnection(Connection con) throws SQLException,
- DataAccessException {
- script.executeAll(driver, con, false);
- return null;
- }
- });
-
- }
-
-
-
- static GenericApplicationContext getContext() {
- log.info("Creating Spring Application Context ...");
- GenericApplicationContext ctx = new GenericApplicationContext();
- XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
- reader.loadBeanDefinitions(new ClassPathResource("/example2/applicationContext-employee.xml"));
-
- ctx.refresh();
- return ctx;
- }
-
-
-
-}
diff --git a/empire-db-examples/empire-db-example-spring/src/main/resources/applicationContext.xml b/empire-db-examples/empire-db-example-spring/src/main/resources/applicationContext.xml
deleted file mode 100644
index 5b63525..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/resources/applicationContext.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
-
- <!-- one option is to use a class from spring that will read the properties file
- and replaces the ${...} placeholders with the appropriate values -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <value>classpath:/settings.properties</value>
- </property>
- </bean>
-
- <!-- Data Source / DB Settings -->
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="${jdbc.driverClass}"/>
- <property name="url" value="${jdbc.url}"/>
- <property name="username" value="${jdbc.username}"/>
- <property name="password" value="${jdbc.password}"/>
- </bean>
-
- <!-- Transaction manager for a single JDBC DataSource (alternative to JTA) -->
- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <constructor-arg ref="dataSource"/>
- </bean>
- <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager" ref="transactionManager"/>
- </bean>
-
- <!-- @Transactional -->
- <tx:annotation-driven transaction-manager="transactionManager"/>
-
- <!-- Empire-DB classes -->
- <bean id="driverFactory" class="org.apache.empire.samples.spring.support.EmpireDriverFactory">
- <property name="dataSource" ref="dataSource" />
- </bean>
- <bean id="databaseDriver" factory-bean="driverFactory" factory-method="createDriver">
- <constructor-arg value="${empire.driver}"/>
- <constructor-arg value="${empire.schemaname}"/>
- </bean>
- <bean id="sampleDatabase" class="org.apache.empire.samples.spring.db.SampleDB">
- </bean>
-
- <!-- application dao/services -->
- <bean id="empireApp" class="org.apache.empire.samples.spring.EmpireAppImpl">
- <property name="dataSource" ref="dataSource"/>
- <property name="database" ref="sampleDatabase"/>
- <property name="databaseDriver" ref="databaseDriver"/>
- </bean>
-</beans>
\ No newline at end of file
diff --git a/empire-db-examples/empire-db-example-spring/src/main/resources/example1/applicationContext.xml b/empire-db-examples/empire-db-example-spring/src/main/resources/example1/applicationContext.xml
deleted file mode 100644
index 7987d5a..0000000
--- a/empire-db-examples/empire-db-example-spring/src/main/resources/example1/applicationContext.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
-
- <!-- one option is to use a class from spring that will read the properties file
- and replaces the ${...} placeholders with the appropriate values -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <value>classpath:/settings.properties</value>
- </property>
- </bean>
-
- <!-- Data Source / DB Settings -->
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="${jdbc.driverClass}"/>
- <property name="url" value="${jdbc.url}"/>
- <property name="username" value="${jdbc.username}"/>
- <property name="password" value="${jdbc.password}"/>
- </bean>
-
- <!-- Transaction manager for a single JDBC DataSource (alternative to JTA) -->
- <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
- <constructor-arg ref="dataSource"/>
- </bean>
- <bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager" ref="transactionManager"/>
- </bean>
-
- <!-- @Transactional -->
- <tx:annotation-driven transaction-manager="transactionManager"/>
-
- <!-- Empire-DB classes -->
-
- <!-- application dao/services -->
- <bean id="empireApp" class="org.apache.empire.spring.example1.EmpireAppImpl" parent="empireDao"/>
-
-
- <bean id="empireDb" class="org.apache.empire.spring.DBDatabaseFactoryBean">
- <property name="driverClass" value="${empire.driver}"/>
- <property name="schema" value="${empire.schemaname}"/>
- <property name="databaseClass" value="org.apache.empire.spring.example1.SampleDB"/>
- </bean>
-
- <bean id="empireDao" abstract="true">
- <property name="database" ref="empireDb"/>
- <property name="empireTemplate" ref="empireTemplate"/>
- </bean>
-
-
- <bean id="empireTemplate" class="org.apache.empire.spring.EmpireTemplate">
- <property name="dataSource" ref="dataSource"/>
- </bean>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
... 32669 lines suppressed ...