summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.classpath10
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.project17
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ear/shop.earbin0 -> 25877 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ejbjar/StatefulSession-HelloEjb.jarbin0 -> 3440 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/war/shop.warbin0 -> 13164 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/Count.classbin0 -> 152 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountBean.classbin0 -> 549 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountCallbacks.classbin0 -> 586 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountClient.classbin0 -> 1044 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/examples/session/stateful_dd/META-INF/ejb-jar.xml35
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.properties32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.xml595
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/CodeCategory.java18
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/FirstTest.javabin0 -> 1376 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java1
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountBean.java70
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountClient.java1
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountInterface.java13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Bank.java60
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/BankBean.java119
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Client.java1
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java1
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/META-INF/persistence.xml13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/MyListener.java34
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/build.xml32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Client.java22
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/InitContext.java11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGenerator.java13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGeneratorImpl.java29
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Startup.java32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/build.xml62
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/jndi.properties4
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogBean.java33
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogClient.java38
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/META-INF/sun-ejb-jar.xml20
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/PoisonBean.java40
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/Readme11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/build.xml30
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogBean.java22
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogClient.java34
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/ejb-jar.xml19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/sun-ejb-jar.xml13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/build.xml30
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/Count.java24
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountBean.java53
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java53
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountClient.java63
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/META-INF/ejb-jar.xml5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/build.xml29
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/Count.java24
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java47
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountCallbacks.java43
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountClient.java63
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/META-INF/ejb-jar.xml35
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/build.xml32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/Hello.java13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloBean.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloClient.java35
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/META-INF/ejb-jar.xml5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/build.xml32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java18
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java40
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml72
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/application.xml21
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/ejb-jar.xml22
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/persistence.xml13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/sun-ejb-jar.xml13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/sun-web.xml5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/web.xml38
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/build.xml87
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/PricerClient.java52
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/SetupClient.java58
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Customer.java104
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/LineItem.java132
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Order.java183
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Product.java93
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/mdb/OrderProcessorBean.java68
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CartBean.java320
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CatalogBean.java41
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/PricerBean.java138
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/UserManagerBean.java86
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Cart.java81
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Catalog.java31
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidLoginNameException.java19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidPasswordException.java19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/OrderException.java19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Pricer.java50
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/PricerException.java19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/UserManager.java38
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp44
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp70
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp87
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp8
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp22
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/CatalogServlet.java167
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/LoginServlet.java166
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/ShowQuoteServlet.java200
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.classpath8
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.packaging24
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.project18
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.xdoclet59
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/README52
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/execClient.bat1
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/jndi.properties6
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.properties32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.xml100
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/packaging-build.xml37
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/application.xml11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/persistence.xml13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Course.java48
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Student.java50
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/StudentCourseBidBean.java53
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/client/StudentCourseClient.java41
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/interfaces/StudentCourse.java14
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Company.java48
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeInfo.java29
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeOMBidBean.java81
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Employee.java53
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java44
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/interfaces/CompanyEmployeeOM.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Order.java45
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/OrderShipmentBidBean.java40
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Shipment.java53
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/client/OrderShipmentClient.java39
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/interfaces/OrderShipment.java14
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/build.xml83
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Car.java15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Coupe.java25
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Motorcycle.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicle.java67
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicleStatelessJoinedBean.java46
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Roadster.java29
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/client/RoadVehicleClient.java28
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/interfaces/RoadVehicleStatelessJoined.java12
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Car.java21
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Coupe.java31
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Motorcycle.java22
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicle.java72
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicleStatelessBean.java50
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Roadster.java31
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java54
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/interfaces/RoadVehicleStateless.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Course.java44
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Student.java50
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/StudentCourseUniBean.java48
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/client/StudentCourseClient.java30
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/interfaces/StudentCourse.java14
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/BusinessAddress.java42
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/Employee.java45
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java42
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/client/EmployeeAddressClient.java28
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/interfaces/EmployeeAddressMOUni.java12
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Company.java47
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/CompanyEmployeeOMUniBean.java73
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Employee.java42
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/client/CompanyEmployeeClient.java35
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/interfaces/CompanyEmployeeOM.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Order.java45
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/OrderShipmentUniBean.java33
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Shipment.java42
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/client/OrderShipmentClient.java30
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/interfaces/OrderShipment.java12
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/CartBean.java39
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/META-INF/application.xml11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/build.xml25
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/client/CartClient.java47
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/interfaces/Cart.java11
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/HelloWorldBean.java12
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/META-INF/application.xml17
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/PricerBean.java66
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/TaxRateBean.java20
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/WEB-INF/web.xml25
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/build.xml26
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/client/PricerClient.java36
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/HelloWorldServlet.java54
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/PricerClientServlet.java84
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java18
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/LoggerInterceptor.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/HelloWorld.java8
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/Pricer.java9
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerInjection.java5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerLookup.java5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/TaxRate.java8
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/jndi.properties6
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/xdoclet-build.xml77
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Readme.txt9
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.classpath9
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.project17
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/client/LoanApplicationClient.jarbin0 -> 1751 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ear/CleanDayLimitOrders.earbin0 -> 4935 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ejbjar/LoanApplicationEjb.jarbin0 -> 2804 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jar/EntityIntro.jarbin0 -> 4073 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jnijar/JavaLoanApp.jarbin0 -> 870 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/rar/OutboundLoanRa.rarbin0 -> 12671 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRates.classbin0 -> 129 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesBean.classbin0 -> 1814 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesClient.classbin0 -> 1044 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionFactoryImpl.classbin0 -> 2042 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionImpl.classbin0 -> 1563 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionMetaDataImpl.classbin0 -> 651 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.classbin0 -> 450 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionSpecImpl.classbin0 -> 207 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/InteractionImpl.classbin0 -> 2526 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.classbin0 -> 2618 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionImpl.classbin0 -> 3738 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.classbin0 -> 729 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/MappedRecordImpl.classbin0 -> 1889 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/RecordFactoryImpl.classbin0 -> 678 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.classbin0 -> 1871 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/jni/JavaLoanApp.classbin0 -> 244 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.properties32
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.xml764
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/Readme.txt61
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/build.xml47
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRates.java9
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesBean.java46
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesClient.java18
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionFactoryImpl.java69
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionImpl.java54
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionMetaDataImpl.java31
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.java27
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionSpecImpl.java9
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java96
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/META-INF/ra.xml28
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.java100
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionImpl.java135
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.java35
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/MappedRecordImpl.java121
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/RecordFactoryImpl.java20
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.java124
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/JavaLoanApp.java20
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/BuildLog.htm52
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.dllbin0 -> 114688 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.expbin0 -> 758 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.ilkbin0 -> 763084 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.libbin0 -> 1928 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.objbin0 -> 14622 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pchbin0 -> 11010048 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pdbbin0 -> 2599936 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.resbin0 -> 880 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/stdafx.objbin0 -> 234840 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.idbbin0 -> 617472 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.pdbbin0 -> 610304 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.cpp65
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.def6
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.h34
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.ncbbin0 -> 68608 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.rc115
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.sln21
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.suobin0 -> 8192 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.vcproj187
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/ReadMe.txt59
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Resource.h16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/examples_jni_JavaLoanApp.h21
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/res/LoanApp.rc213
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.cpp7
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.h52
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/nativelib/LoanApp.dllbin0 -> 114688 bytes
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Hello.java13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloBean.java16
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java59
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original41
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/META-INF/ejb-jar.xml5
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Readme.txt13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/build.xml30
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrders.java13
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersBean.java67
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersClient.java19
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application-client.xml7
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application.xml10
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/ejb-jar.xml22
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/Readme.txt15
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/build.xml29
284 files changed, 10755 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.classpath b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.classpath
new file mode 100644
index 0000000..4cc8b54
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 5.0"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/appserv-ws.jar"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/appserv-rt.jar"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/j2ee.jar"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/javaee.jar"/>
+ <classpathentry kind="output" path="build"/>
+</classpath>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.project b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.project
new file mode 100644
index 0000000..8f225f6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>EJB3-Examples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.core.prefs b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b37a7b2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sun Aug 21 19:27:03 CEST 2005
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.ui.prefs b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..ec73087
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Sat Sep 10 21:58:14 CEST 2005
+eclipse.preferences.version=1
+internal.default.compliance=default
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ear/shop.ear b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ear/shop.ear
new file mode 100644
index 0000000..2f5ead1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ear/shop.ear
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ejbjar/StatefulSession-HelloEjb.jar b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ejbjar/StatefulSession-HelloEjb.jar
new file mode 100644
index 0000000..42d5b88
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/ejbjar/StatefulSession-HelloEjb.jar
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/war/shop.war b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/war/shop.war
new file mode 100644
index 0000000..e0fbffe
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/assemble/war/shop.war
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/Count.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/Count.class
new file mode 100644
index 0000000..2134c43
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/Count.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountBean.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountBean.class
new file mode 100644
index 0000000..8d19722
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountBean.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountCallbacks.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountCallbacks.class
new file mode 100644
index 0000000..4c03f25
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountCallbacks.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountClient.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountClient.class
new file mode 100644
index 0000000..433107a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/classes/examples/session/stateful_dd/CountClient.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/examples/session/stateful_dd/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/examples/session/stateful_dd/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..a483584
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/build/examples/session/stateful_dd/META-INF/ejb-jar.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+ <description>Stateful Session Bean Example</description>
+ <display-name>Stateful Session Bean Example</display-name>
+ <enterprise-beans>
+ <session>
+ <ejb-name>CountBean</ejb-name>
+ <business-remote>examples.session.stateful_dd.Count</business-remote>
+ <ejb-class>examples.session.stateful_dd.CountBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>examples.session.stateful_dd.CountCallbacks
+ </interceptor-class>
+ <post-construct><lifecycle-callback-method>construct</lifecycle-callback-method></post-construct>
+ <post-activate><lifecycle-callback-method>activate</lifecycle-callback-method></post-activate>
+ <pre-passivate><lifecycle-callback-method>passivate</lifecycle-callback-method></pre-passivate>
+<!-- <pre-destroy><lifecycle-callback-method>destroy</lifecycle-callback-method></pre-destroy> -->
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>CountBean</ejb-name>
+ <interceptor-class>examples.session.stateful_dd.CountCallbacks
+ </interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.properties b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.properties
new file mode 100644
index 0000000..ddf8b69
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.properties
@@ -0,0 +1,32 @@
+#
+# Common properties, included by common.xml
+# Edit this file to reflect your environment.
+
+# local configuration parameters
+admin.password=adminadmin
+admin.host=localhost
+appserver.instance=server
+appserver.instance.port=8080
+admin.user=admin
+admin.port=4848
+domain.name=domain1
+
+#jndi.port=3700
+#jndi.factory=com.sun.jndi.cosnaming.CNCtxFactory
+#jndi.factory=com.sun.jndi.fscontext.RefFSContextFactory
+#jndi.provider.url=corbaloc::${admin.host}:${jndi.port}/NameService
+#jndi.provider.url=file:c:
+
+
+# The path seperator for the platform
+# Unix - :
+# Note for windows add the drive after the seperator
+# Windows - ;C:
+pathsep=;
+
+# The directory seperator for the platform
+# Unix - /
+# Windows - \
+#
+dirsep=/
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.xml
new file mode 100644
index 0000000..3959a1a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/etc/common.xml
@@ -0,0 +1,595 @@
+<!--
+Common ant targets for Mastering EJB 3.0,
+
+This file is included from each chapter's build.xml files
+and does not need to be edited. To adapt the build environment,
+edit common.properties only.
+-->
+
+<!-- ======================================================== -->
+<!-- Application Server Common Properties -->
+<!-- ======================================================== -->
+
+<property file="${basedir}/etc/common.properties"/>
+<property environment="env"/>
+
+
+
+<!-- -->
+<!-- JBoss-specific properties -->
+<!-- -->
+
+<property name="jboss.home" value="${env.JBOSS_HOME}"/>
+<property name="jboss.server.config" value="all"/>
+<!-- <property name="deploy.dir" value="${jboss.home}/server/${jboss.server.config}/deploy"/> -->
+<property name="vendor.lib.dir1" value="c:/Programme/jboss-EJB-3.0_RC1/lib/ejb3.deployer"/>
+<property name="vendor.lib.dir2" value="${env.JBOSS_HOME}/client"/>
+<property name="vendor.deploy.dir" value="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer"/>
+<property name="vendor.ejb3-1.jar" value="jboss-ejb3.jar" />
+<property name="vendor.ejb3-2.jar" value="jboss-ejb3x.jar" />
+
+<!-- -->
+<!-- Sun-specific properties -->
+<!-- -->
+
+<!-- Source file location. -->
+<property name="src" value="./src"/>
+<property name="generated.dir" value="${src.dir}/generated" />
+<property name="src.docroot" value="${src}/docroot"/>
+<property name="appserver.home" value="${env.GLASSFISH_HOME}"/>
+<property name="deploy.dir" value="${env.GLASSFISH_HOME}/domains/domain1/autodeploy"/>
+
+<!-- Destination directory for the build and assembly targets -->
+<property name="build" value="./build"/>
+<property name="descriptors" value="./descriptors"/>
+<property name="build.classesdir" value="${build}/classes"/>
+<property name="assemble" value="./assemble"/>
+<property name="assemble.jar" value="${assemble}/jar"/>
+<property name="assemble.ejbjar" value="${assemble}/ejbjar"/>
+<property name="assemble.ear" value="${assemble}/ear"/>
+<property name="assemble.clientjar" value="${assemble}/client"/>
+<property name="assemble.war" value="${assemble}/war"/>
+<property name="assemble.rar" value="${assemble}/rar"/>
+
+<property name="service.wsdl"
+ value="http://${admin.host}:${appserver.instance.port}/${ServiceName}/${PortType}?WSDL" />
+
+
+<!-- some common file names -->
+<property name="ear" value="${appname}.ear"/>
+<property name="jar" value="${appname}.jar"/>
+<property name="war" value="${appname}.war"/>
+<property name="rar" value="${raname}.rar"/>
+<property name="ejbjar" value="${appname}Ejb.jar"/>
+<property name="clientjar" value="${appname}Client.jar"/>
+<property name="earDD" value="application.xml"/>
+<property name="jarDD" value="ejb-jar.xml"/>
+<property name="sunjarDD" value="sun-ejb-jar.xml"/>
+<property name="wsDD" value="webservices.xml"/>
+<property name="persDD" value="persistence.xml"/>
+<property name="warDD" value="web.xml,sun-web.xml,sun-jaxws.xml"/>
+
+<!-- classpath jar files location. -->
+<property name="sample.classpath.dir" value="${appserver.home}/lib"/>
+<property name="optional.taskdef.jar" value="sun-appserv-ant.jar"/>
+
+<target name="setup_env"
+ depends="init_common">
+ <property name="admin.host" value="${as.env.AS_ADMIN_HOST}"/>
+ <property name="admin.port" value="${as.env.AS_ADMIN_PORT}"/>
+ <property name="admin.user" value="${as.env.AS_ADMIN_USER}"/>
+ <property name="admin.password" value="${as.env.AS_ADMIN_PASSWORD}"/>
+ <property name="appserver.instance" value="${as.env.AS_ADMIN_INSTANCE}"/>
+</target>
+
+<target name="init_common" depends="build_cpath">
+ <property name="classpath.prefix" value="."/>
+ <property name="classpath.suffix" value="."/>
+ <property name="build.classpath"
+ value="${classpath.prefix}:${build.classesdir}:${appserver.cpath}:${classpath.suffix}:${java.home}/../lib/tools.jar"/>
+ <property name="run.classpath"
+ value="${build.classpath}:${assemble.clientjar}/${clientjar}"/>
+ <taskdef name="apt" classname="com.sun.tools.ws.ant.Apt" >
+ <classpath refid="sample_classpath_jars"/>
+</taskdef>
+
+<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport" >
+ <classpath refid="sample_classpath_jars"/>
+</taskdef>
+
+<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen" >
+ <classpath refid="sample_classpath_jars"/>
+</taskdef>
+</target>
+
+<target name="build_cpath" unless="appserver.cpath">
+ <path id="sample_classpath_jars">
+ <fileset dir="${appserver.home}/lib" includes="*.jar" />
+ <pathelement location="${assemble.clientjar}/${clientjar}"/>
+ </path>
+
+ <pathconvert pathsep=";" property="appserver.cpath"
+ refid="sample_classpath_jars"/>
+</target>
+
+
+
+
+<!-- =============================== -->
+<!-- Compile all classes -->
+<!-- =============================== -->
+
+<target name="compile_common" depends="init_common">
+ <mkdir dir="${build.classesdir}"/>
+ <mkdir dir="${src}/generated"/>
+ <echo message="${pack.dir}" />
+ <javac srcdir="${pack.dir}"
+ destdir="${build.classesdir}"
+ classpath="${build.classpath}"/>
+</target>
+
+
+
+<!-- ======================================================= -->
+<!-- Clean up various files and directories. -->
+<!-- ======================================================= -->
+<target name="clean_clientjar_common">
+ <delete dir="${assemble.clientjar}"/>
+</target>
+
+
+<target name="clean_war_common">
+ <delete dir="${assemble.war}"/>
+</target>
+
+
+<target name="clean_ear_common">
+ <delete dir="${assemble.ear}"/>
+</target>
+
+<target name="clean_ejbjar_common">
+ <delete dir="${assemble.ejbjar}"/>
+</target>
+
+<target name="clean_rar_common">
+ <delete dir="${assemble.rar}"/>
+</target>
+
+<target name="clean_jar_common">
+ <delete dir="${assemble.jar}"/>
+</target>
+
+
+<target name="clean_common" >
+ <delete dir="${build.dir}"/>
+ <delete dir="${generated.dir}"/>
+</target>
+
+<target name="create_client_jar">
+ <jar destfile="${assemble.clientjar}/${clientjar}">
+ <zipfileset dir="${assemble.clientjar}"
+ includes="**/*.class" />
+ <metainf dir="." includes="${assemble}/${clientDD}"/>
+ </jar>
+</target>
+
+<!-- ======================================================= -->
+<!-- Assemble EAR module. -->
+<!-- ======================================================= -->
+<target name="mkdir_ear">
+ <mkdir dir="${assemble.ear}/META-INF"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble WAR module. -->
+<!-- ======================================================= -->
+<target name="check_warfile">
+ <available file="${build.classesdir}" type="dir"
+ property="warfiles.present"/>
+</target>
+
+<target name="mkdir_war">
+ <mkdir dir="${assemble.war}"/>
+</target>
+
+
+
+<target name="add_docroot" if="docroot.present">
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <fileset dir="${src.docroot}" excludes="CVS,annotation"/>
+ </jar>
+</target>
+
+<target name="add_classes" if="warfiles.present">
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${src}/jsp/" includes="*.jsp" />
+ </jar>
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${build.classesdir}/${war.pkg}/" includes="**/*Servlet.class"
+ prefix="WEB-INF/classes/${war.pkg}"/>
+ </jar>
+</target>
+
+
+<target name="add_ejbjar_war" if="ejbjar.done">
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${assemble.ejbjar}" includes="${ejbjar}"
+ prefix="WEB-INF/lib"/>
+ </jar>
+</target>
+
+
+<target name="mkdir_ear_dir">
+ <mkdir dir="${assemble.ear}"/>
+</target>
+
+<target name="add_ejbjar" if="ejbjar.done">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ </jar>
+</target>
+
+<target name="add_war" if="war.done">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.war}" includes="${war}"/>
+ </jar>
+</target>
+
+<target name="add_clientjar" if="clientjar.done">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.clientjar}" includes="${clientjar}"/>
+ </jar>
+</target>
+
+<target name="create_ear_common" depends="clean_ear_common,mkdir_ear_dir,add_clientjar,add_war">
+<echo message="${src.dir}/${package}/META-INF/${earDD}"/>
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ <fileset dir="${assemble.ejbjar}" includes="sun-application.xml"/>
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${earDD}"/>
+ </jar>
+
+ <delete file="../${ejbjar}" />
+ <delete file="../${clientjar}" />
+</target>
+
+<target name="create_ear_common_with_clientjar" depends="clean_ear_common,mkdir_ear_dir,add_clientjar,add_war">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ <fileset dir="${assemble.ejbjar}" includes="${sun-ejbjar}"/>
+ <metainf dir="${assemble}" includes="${earDD}"/>
+
+ <fileset dir="${assemble.clientjar}" includes="${clientjar}"/>
+ <metainf dir="${assemble}" includes="${clientDD}"/>
+ </jar>
+
+ <delete file="../${ejbjar}" />
+ <delete file="../${clientjar}" />
+</target>
+
+
+<target name="create_war_common"
+ depends="mkdir_war,create_ejbjar_common">
+
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"/>
+ </jar>
+ <echo message="${src.dir}/${package}/WEB-INF/${warDD}" />
+ <jar destfile="${assemble.war}/${war}" update="true" >
+ <fileset dir="${src.dir}/${package}" includes="WEB-INF/*.xml" />
+ </jar>
+ <property name="war.done" value="true"/>
+</target>
+
+
+
+<!-- ======================================================= -->
+<!-- Assemble EJB JAR module. -->
+<!-- ======================================================= -->
+<target name="create_ejbjar_common" depends="clean_ejbjar_common">
+ <mkdir dir="${assemble.ejbjar}"/>
+ <jar destfile="${assemble.ejbjar}/${ejbjar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"
+ excludes="**/servlet/*, **/jsp/*, **/client/" prefix="${jar.pkg}"/>
+ <fileset dir="${src.dir}/${package}"
+ includes="META-INF/${jarDD},META-INF/${sunjarDD},META-INF/${persDD}"/>
+ <fileset dir="${generated.dir}" includes="**"/>
+ </jar>
+
+ <property name="ejbjar.done" value="true"/>
+</target>
+
+<target name="create_ejbjar_ws_common" depends="clean_ejbjar_common">
+ <mkdir dir="${assemble.ejbjar}"/>
+ <mkdir dir="${assemble}/wsdl"/>
+ <copy file="${assemble}/${appname}.wsdl" todir="${assemble}/wsdl" failonerror="false"/>
+ <copy file="${assemble}/mapping.xml" todir="${assemble}/wsdl" failonerror="false"/>
+ <copy file="${src}/${wsDD}" todir="${assemble}/" failonerror="false"/>
+ <jar destfile="${assemble.ejbjar}/${ejbjar}">
+ <zipfileset dir="${build.classesdir}/${jar.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${jar.pkg}"/>
+ <metainf dir="${assemble}" includes="${jarDD},${sunjarDD},${wsDD},wsdl/**"/>
+ </jar>
+ <copy file="${assemble.ejbjar}/${ejbjar}" tofile="../${ejbjar}"/>
+ <property name="ejbjar.done" value="true"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble Connector RAR module. -->
+<!-- ======================================================= -->
+<target name="create_rar_common" depends="clean_rar_common">
+ <mkdir dir="${assemble.rar}"/>
+ <jar destfile="${assemble.rar}/${rar}">
+ <zipfileset dir="${build.classesdir}/${rar.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${rar.pkg}"/>
+ <metainf dir="${assemble}" includes="${rarDD}"/>
+ </jar>
+ <copy file="${assemble.rar}/${rar}" tofile="../${rar}"/>
+ <delete file="../${rar}" />
+ <property name="rar.done" value="true"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble client JAR module. -->
+<!-- ======================================================= -->
+
+<target name="clientjar_common" depends="clean_clientjar_common">
+ <rmic classname="${remote.interface}"
+ classpath="${build}:${appserver.home}/lib/j2ee.jar:${appserver.home}/lib/appserv-ext.jar"
+ iiop="yes"
+ base="${build}"/>
+
+ <rmic classname="${remote.home}"
+ classpath="${build}:${appserver.home}/lib/j2ee.jar:${appserver.home}/lib/appserv-ext.jar"
+ iiop="yes"
+ base="${build}"/>
+
+ <mkdir dir="${assemble.clientjar}"/>
+ <jar destfile="${assemble.clientjar}/${clientjar}">
+ <zipfileset dir="${build.classesdir}"
+ includes="**/*.class" excludes="**/*Bean.class"/>
+<!-- prefix="${app.pkg}"/> -->
+ <metainf dir="." includes="${assemble}/${clientDD}"/>
+ </jar>
+
+ <jar destfile="${assemble.clientjar}/${clientjar}" update="true">
+ <zipfileset dir="${assemble}" includes="${clientDD}" prefix="META-INF"/>
+ </jar>
+
+ <property name="clientjar.done" value="true"/>
+</target>
+
+
+<target name="base_clientjar_common" depends="clean_clientjar_common">
+ <mkdir dir="${assemble.clientjar}"/>
+ <jar destfile="${assemble.clientjar}/${clientjar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/"
+ includes="**/*.class" excludes="**/*Bean.class, **/*Home.class"
+ prefix="${app.pkg}"/>
+ <metainf dir="." includes="${clientDD}"/>
+ </jar>
+
+ <jar destfile="${assemble.clientjar}/${clientjar}" update="true">
+ <zipfileset dir="${assemble}" includes="${clientDD}" prefix="META-INF"/>
+ </jar>
+
+ <property name="clientjar.done" value="true"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble Simple JAR file. -->
+<!-- ======================================================= -->
+<target name="create_jar_common" depends="clean_jar_common">
+ <mkdir dir="${assemble.jar}"/>
+ <jar destfile="${assemble.jar}/${jar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"
+ prefix="${app.pkg}"/>
+ </jar>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Deploy CLI support. -->
+<!-- ======================================================= -->
+
+<!-- Name of the asadmin commands -->
+<property name="s1as.admin" value="${appserver.home}/bin/asadmin"/>
+
+<!-- determine which OS is being utilized. -->
+<target name="checkPlatform" >
+ <condition property ="isUnixPlatform">
+ <os family="unix"/>
+ </condition>
+ <condition property ="isWindowsPlatform">
+ <os family="windows"/>
+ </condition>
+</target>
+
+<!-- configUnix will be invoked when ant is being run on
+ unix/Linux. It will configure the values for ${os}
+ and ${dir.sep}
+-->
+<target name="configUnix" depends="checkPlatform" if="isUnixPlatform" >
+ <echo message="on unix"/>
+ <property name="dir.sep" value="/"/>
+ <property name="os" value="unix"/>
+ <property name="exec.asadmin" value="${s1as.admin}" />
+ <property name="exec.asadmin.part2" value="" />
+</target>
+
+<!--
+configWindows will be invoked when ant is being run on
+windows. It will configure the values for ${os}
+and ${dir.sep}
+-->
+
+<target name="configWindows" depends="checkPlatform" if="isWindowsPlatform" >
+ <echo message="on windows"/>
+ <property name="dir.sep" value="\\"/>
+ <property name="os" value="windows"/>
+ <property name="exec.asadmin" value="cmd.exe" />
+ <property name="exec.asadmin.part2" value= " /c ${s1as.admin}" />
+</target>
+
+
+
+<!-- ======================================================= -->
+<!-- Update target. -->
+<!-- ======================================================= -->
+
+<target name="update_common" depends="setup_env">
+ <echo message="Updating ${deploy.file}."/>
+ <sun-appserv-update file="${deploy.file}"/>
+</target>
+
+<!-- ======================================================= -->
+<!-- Deploy CLI support. -->
+<!-- ======================================================= -->
+
+<!-- Name of the asadmin commands -->
+<property name="s1as.admin" value="${appserver.home}/bin/asadmin"/>
+<property name="s1as.domain.dir" value="${appserver.home}/domains"/>
+<property name="s1as.domain.name" value="${domain.name}"/>
+<property name="s1as.domain" value="${s1as.domain.dir}/${s1as.domain.name}"/>
+
+<target name="configPlatform"
+ depends="checkPlatform, configUnix, configWindows"/>
+
+
+
+<!-- ======================================================= -->
+<!-- Install targets. -->
+<!-- ======================================================= -->
+
+<target name="deploy_common"
+ depends="checkPlatform, configUnix, configWindows">
+ <echo message="Deploying ${deploy.file}."/>
+ <copy file="${assemble.dir}/${deploy.file}" todir="${deploy.dir}"/>
+ <waitfor maxwait="100" maxwaitunit="second">
+ <or>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_deployed"/>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_deployFailed"/>
+ </or>
+ </waitfor>
+</target>
+
+<target name="deploy_connector_common"
+ depends="checkPlatform, configUnix, configWindows">
+ <echo message="Deploying ${assemble.rar}/${raname}.rar."/>
+ <exec executable="${exec.asadmin}" >
+ <arg line="${exec.asadmin.part2}" />
+ <arg line=" deploy"/>
+ <arg line=" --user ${admin.user}"/>
+ <arg line=" --password ${admin.password}"/>
+ <arg line=" --host ${admin.host}"/>
+ <arg line=" --port ${admin.port}"/>
+ <arg line=" --virtualservers ${appserver.instance}"/>
+ <arg line=" --force=true"/>
+ <arg line=" --name ${raname}"/>
+ <arg line=" --upload=true"/>
+ <arg line="${assemble.rar}/${raname}.rar"/>
+ </exec>
+</target>
+
+<target name="deploy_retrieve_common" depends="setup_env, checkPlatform, configUnix, configWindows">
+ <echo message="Deploying ${deploy.file} and retrieving client stubs."/>
+ <exec executable="${exec.asadmin}" >
+ <arg line="${exec.asadmin.part2}" />
+ <arg line=" deploy"/>
+ <arg line=" --user ${admin.user}"/>
+ <arg line=" --password ${admin.password}"/>
+ <arg line=" --host ${admin.host}"/>
+ <arg line=" --port ${admin.port}"/>
+ <arg line=" --virtualservers ${appserver.instance}"/>
+ <arg line=" --force=true"/>
+ <arg line=" --name ${appname}"/>
+ <arg line=" --upload=true"/>
+ <arg line=" --retrieve="/>
+ <arg line="${deploy.file}"/>
+ </exec>
+</target>
+
+<!-- Run stand-alone client target -->
+
+<target name="run_client_standalone" depends="setup_env">
+ <java classname="${client.class}" fork="yes">
+ <classpath>
+ <pathelement path="${build.classes.dir};${appserver.home}/lib/appserv-rt.jar;${appserver.home}/lib/appserv-admin.jar;${appserver.home}/lib/javaee.jar;" />
+ <fileset dir="${appserver.home}/lib/install/applications/jmsra" includes="imqj*.jar" />
+ </classpath>
+ </java>
+</target>
+
+
+
+<!-- Run client target -->
+
+<target name="run_client" depends="setup_env">
+ <java classname="${client.class}" classpath="${assemble.clientjar}/${clientjar};${appserver.home}/lib/j2ee.jar;${appserver.home}/lib/appserv-ext.jar" fork="yes">
+ <sysproperty key="java.naming.provider.url" value="corbaloc::${admin.host}:${jndi.port}/NameService"/>
+ <sysproperty key="java.naming.factory.initial" value="${jndi.factory}"/>
+ </java>
+</target>
+
+<!-- ======================================================= -->
+<!-- Uninstall targets. -->
+<!-- ======================================================= -->
+
+<target name="undeploy_common" depends="init_common" >
+ <echo message="undeploying ${appserver.home}/domains/domain1/autodeploy/${deploy.file}" />
+ <delete file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}"/>
+ <waitfor maxwait="100" maxwaitunit="second">
+ <or>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_undeployed"/>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_undeployFailed"/>
+ </or>
+ </waitfor>
+ <condition property="undeploy_succeeded">
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}.jar_undeployed"/>
+ </condition>
+ <condition property="undeploy_failed">
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}.jar_undeployFailed"/>
+ </condition>
+ <fail if="undeploy_failed" message="undeployment failed"/>
+</target>
+
+
+
+
+<!-- ======================================================= -->
+<!-- Admin targets. -->
+<!-- ======================================================= -->
+<target name="admin_command_common" depends="setup_env">
+ <echo message="Doing admin task ${admin.command}"/>
+ <sun-appserv-admin
+ command="${admin.command}"
+ user="${admin.user}"
+ password="${admin.password}"
+ host="${admin.host}"
+ port="${admin.port}"
+ sunonehome="${appserver.home}" />
+</target>
+
+<target name="reconfig_common">
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Verify Targets. -->
+<!-- ======================================================= -->
+<target name="verify_common" depends="init_common">
+ <echo message="Verifying Process for ${verify.file}" />
+ <java classname="com.sun.enterprise.tools.verifier.Verifier" fork="yes" dir="." failonerror="true">
+ <sysproperty key="appserver.home" value="${appserver.home}"/>
+ <sysproperty key="com.sun.aas.verifier.xsl" value="${appserver.home}/lib/verifier/" />
+ <!-- uncomment the following for verbose output -->
+ <!--<arg value="-v"/>-->
+ <arg value="${verify.file}"/>
+ <classpath path="${build.classpath}"/>
+ </java>
+</target>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/CodeCategory.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/CodeCategory.java
new file mode 100644
index 0000000..2b77770
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/CodeCategory.java
@@ -0,0 +1,18 @@
+package examples.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+enum Visibility {
+ INTERNAL, PUBLIC
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface CodeCategory {
+ Visibility visibility() default Visibility.INTERNAL;
+ boolean isUnitTested() default false;
+ boolean isReviewed() default false;
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/FirstTest.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/FirstTest.java
new file mode 100644
index 0000000..6980ac9
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/annotations/FirstTest.java
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java
new file mode 100644
index 0000000..1efa132
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java
@@ -0,0 +1 @@
+package examples.entity.intro; import java.io.Serializable; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.EntityListener; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.PostLoad; import javax.persistence.PostUpdate; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Version; /** * This demo entity represents a Bank Account. * <p> * The entity is not a remote object and can only be accessed locally by * clients. However, it is made serializable so that instances can be passed by * value to remote clients for local inspection. * <p> * Access to persistent state is by direct field access. */ @Entity(access = AccessType.FIELD) @EntityListener(MyListener.class) @NamedQuery(name="findThem", query="SELECT a FROM Account a") public class Account implements Serializable { /** The account number is the primary key for the persistent object */ @Id public int accountNumber; public String ownerName; public int balance; @Version public int version; /** * Entity beans must have a public no-arg constructor */ public Account() { // our own primary key generation, workaround for the // time being as Glassfish persistence does not support // auto-generation accountNumber = (int) System.nanoTime(); } public String toString() { return "Acc.# " + accountNumber + ", owner" + ownerName + ", balance: " + balance + " $"; } @PrePersist void prepersist() { System.out.println("pre persist!!"); } @PreUpdate void preupdate() { System.out.println("pre update!!"); } @PostUpdate void postupdate() { System.out.println("post update!!"); } @PostLoad void postload() { System.out.println("post load!!"); } } \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountBean.java
new file mode 100644
index 0000000..45f05c3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountBean.java
@@ -0,0 +1,70 @@
+package examples.entity.intro;
+
+import javax.ejb.Interceptors;
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityListener;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+/**
+ * Stateful session bean facade for account entities, remotely accessible
+ */
+
+@Stateful
+@Remote(AccountInterface.class)
+public class AccountBean implements AccountInterface {
+
+ /** The entity manager, injected by the container */
+ @PersistenceContext(type=PersistenceContextType.EXTENDED)
+ private EntityManager manager;
+
+ private Account account;
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public void open(int accountNumber) {
+ account = manager.find(Account.class, accountNumber);
+ if(account == null)
+ account = new Account();
+
+ account.ownerName = "anonymous";
+ account.accountNumber = accountNumber;
+ manager.persist(account);
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public int getBalance() {
+ if(account==null)
+ throw new IllegalStateException();
+ return account.balance;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public void deposit(int amount) {
+ if(account==null)
+ throw new IllegalStateException();
+ //manager = emf.createEntityManager(PersistenceContextType.EXTENDED);
+ //account = manager.merge(account);
+ account.balance += amount;
+ //manager.flush();
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public int withdraw(int amount) {
+ if(account==null)
+ throw new IllegalStateException();
+ // manager.lock(account, LockMode.WRITE);
+ if (amount > account.balance) {
+ return 0;
+ } else {
+ account.balance -= amount;
+ return amount;
+ }
+ }
+
+
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountClient.java
new file mode 100644
index 0000000..ae85824
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountClient.java
@@ -0,0 +1 @@
+package examples.entity.intro; import java.util.Iterator; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; /** * Sample client code for an Account entity that is accessed through * a stateful session bean facade. */ public class AccountClient { public static void main(String[] args) { AccountInterface account = null; try { /* * Get a reference to the Account Session Object */ Context ctx = new InitialContext(System.getProperties()); account = (AccountInterface)ctx.lookup(AccountInterface.class.getName()); Bank bank = (Bank)ctx.lookup(Bank.class.getName()); /* * Let's find existing accounts in the bank... */ List<Account> accounts = bank.listAccounts(); /* * ... and print them to the screen */ System.out.println("--- Accounts in this bank ---"); for(Iterator iter = accounts.iterator(); iter.hasNext();) { System.out.println(iter.next()); } System.out.println("-----------------------------"); /* * Open the account */ account.open(4444); System.out.println("Initial Balance = " + account.getBalance()); /* * Deposit $100 into the account */ account.deposit(100); /* * Retrieve the resulting balance both from * the original and the local copy */ System.out.println("After depositing $100, the account balance is: $" + account.getBalance()); /* * Try to withdraw $150 */ System.out.println("Now trying to withdraw $150."); int withdrawn = account.withdraw(150); if(withdrawn != 150) System.out.println("No success..."); else System.out.println("Success, got the money!"); System.out.println("Finally, the account balance is: $" + account.getBalance()); } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); } } } \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountInterface.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountInterface.java
new file mode 100644
index 0000000..132accf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/AccountInterface.java
@@ -0,0 +1,13 @@
+package examples.entity.intro;
+
+public interface AccountInterface {
+
+ public void open(int accountNumber) ;
+
+ public int getBalance();
+
+ public void deposit(int amount) ;
+
+ public int withdraw(int amount) ;
+
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Bank.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Bank.java
new file mode 100644
index 0000000..625978e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Bank.java
@@ -0,0 +1,60 @@
+package examples.entity.intro;
+
+import java.util.List;
+
+/**
+ * Business interface of the Bank session bean, a facade for the
+ * Account entity bean.
+ */
+
+public interface Bank {
+
+ /**
+ * List accounts in the bank
+ * @return the list of accounts
+ */
+ List<Account> listAccounts();
+
+ /**
+ * Opens a new account
+ * @param ownerName
+ * @return the account object
+ */
+ Account openAccount(String ownerName);
+
+ Account openAccount(String ownerName, int accNum);
+
+ void printBigAccounts();
+
+ /**
+ * Find out the balance of account with given accountNumber
+ * @param accountNumber
+ * @return the current balance
+ */
+ int getBalance(int accountNumber);
+
+ /**
+ * Increases the balance of account with given accountNumber by amount
+ * @param accountNumber
+ * @param amount the amount
+ */
+ void deposit(int accountNumber, int amount);
+
+ /**
+ * Withdraws a given amount, the current balance permitting
+ * @param accountNumber
+ * @param amount
+ * @return amount, if successful, 0 otherwise
+ */
+ int withdraw(int accountNumber, int amount);
+
+ public void checkBalance(int accountNumber);
+
+ /**
+ * Destroys the entity permanently
+ * @param accountNumber
+ */
+ void close(int accountNumber);
+
+ void update(Account a);
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/BankBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/BankBean.java
new file mode 100644
index 0000000..de5e59a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/BankBean.java
@@ -0,0 +1,119 @@
+package examples.entity.intro;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+import javax.persistence.*;
+
+/**
+ * Stateless session bean facade for account entities, remotely accessible
+ */
+@Stateless
+@Remote(Bank.class)
+@EntityListener(MyListener.class)
+public class BankBean implements Bank {
+ /**
+ * The entity manager object, injected by the container
+ */
+ @PersistenceContext
+ private EntityManager manager;
+
+ public List<Account> listAccounts() {
+ //Query query = manager.createQuery("SELECT a FROM Account a");
+ Query query = manager.createNamedQuery("findThem");
+ return query.getResultList();
+ }
+
+ public void printBigAccounts() {
+ Query query =
+ manager.createQuery("SELECT a FROM Account a WHERE a.balance > 1000");
+
+ System.out.println("Got " + query.getResultList().size() + " records.");
+
+ // do sth else in the meantime
+ try {
+ Thread.sleep(15000);
+ } catch (InterruptedException e )
+ {}
+
+ query =
+ manager.createQuery("SELECT a FROM Account a WHERE a.balance > 1000");
+
+ System.out.println("Got " + query.getResultList().size() + " records.");
+ }
+
+
+ public Account openAccount(String ownerName) {
+ Account account = new Account();
+ account.ownerName = ownerName;
+ System.out.println("Entity belongs to persistence context: " +
+ manager.contains(account));
+ manager.persist(account);
+ System.out.println("Entity belongs to persistence context: " +
+ manager.contains(account));
+ return account;
+ }
+
+ public Account openAccount(String ownerName, int accNum) {
+ Account account = new Account();
+ account.ownerName = ownerName;
+ account.accountNumber = accNum;
+ System.out.println("Entity belongs to persistence context: " +
+ manager.contains(account));
+ manager.persist(account);
+ System.out.println("Entity belongs to persistence context: " +
+ manager.contains(account));
+ return account;
+ }
+
+ public int getBalance(int accountNumber) {
+ Account account = manager.find(Account.class, accountNumber);
+ return account.balance;
+ }
+
+ public void deposit(int accountNumber, int amount) {
+ Account account = manager.find(Account.class, accountNumber);
+ account.balance += amount;
+ }
+
+ public int withdraw(int accountNumber, int amount) {
+ Account account = manager.find(Account.class, accountNumber);
+ System.out.println("Withdrawing... " );
+
+ account.balance -= amount;
+ System.out.println("... amount now... " + account.balance );
+ manager.flush();
+ return amount;
+ }
+
+ public void close(int accountNumber) {
+ Account account = manager.find(Account.class, accountNumber);
+ try {
+ Thread.sleep(20000);
+ } catch (InterruptedException e )
+ {}
+ manager.remove(account);
+ try {
+ Thread.sleep(20000);
+ } catch (InterruptedException e )
+ {}
+ }
+
+ public void update(Account a) {
+ manager.merge(a);
+ }
+
+ public void checkBalance(int accountNumber) {
+ System.out.println("Checking... sleep");
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e )
+ {}
+ Account account = manager.find(Account.class, accountNumber);
+ manager.refresh(account);
+ int b = account.balance;
+ System.out.println("Checking... " + b );
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Client.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Client.java
new file mode 100644
index 0000000..16863fc
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Client.java
@@ -0,0 +1 @@
+package examples.entity.intro; import java.util.Iterator; import java.util.List; import javax.naming.*; /** * Sample client code for an Account entity that is accessed through * a stateless session bean. */ public class Client { public static void main(String[] args) { Bank bank = null; Account account = null; int accountNumber = 0; try { /* * Get a reference to the Account Session Object */ Context ctx = new InitialContext(System.getProperties()); bank = (Bank)ctx.lookup(Bank.class.getName()); /* * Let's find existing accounts in the bank... */ List<Account> accounts = bank.listAccounts(); /* * ... and print them to the screen */ System.out.println("--- Accounts in this bank ---"); for(Iterator iter = accounts.iterator(); iter.hasNext();) { System.out.println(iter.next()); } System.out.println("-----------------------------"); /* * Open an account and get a local copy of the account object * We can access the object in the bank by using our account number. */ account = bank.openAccount("Ben Johnson"); accountNumber = account.accountNumber; /* * Call the balance() method, and print it */ System.out.println("Initial Balance = " + bank.getBalance(accountNumber)); /* * Deposit $100 into the account */ bank.deposit(accountNumber,100); /* * Retrieve the resulting balance both from * the original and the local copy */ System.out.println("After depositing $100, the account balance is: $" + bank.getBalance(accountNumber)); System.out.println("Sadly, the local account balance still is: $" + account.balance); /* * Try to withdraw $150 */ System.out.println("Now trying to withdraw $150, which is more than is currently available."); int withdrawn = bank.withdraw(accountNumber,150); if(withdrawn != 150) System.out.println("No success..."); else System.out.println("Success"); // account.balance += 10000; // bank.update(account); // // System.out.println("After depositing $10,000 locally and updating, the account balance is: $" // + bank.getBalance(accountNumber)); } catch (Exception e) { System.out.println("Message: " + e.getMessage()); } finally { /* * Destroy the Entity permanently try { if (account != null) { System.out.println("Destroying account.."); bank.close(accountNumber); } } catch (Exception e) { e.printStackTrace(); } */ } } } \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java
new file mode 100644
index 0000000..f19d236
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/ConflictingClient.java
@@ -0,0 +1 @@
+package examples.entity.intro; import javax.naming.Context; import javax.naming.InitialContext; /** * Sample client code for an Account entity that is accessed through * a stateful session bean facade. */ public class ConflictingClient { static Bank bank = null; static int num = 13; static class SecondClientThread extends Thread { public void run() { System.out.println("Withdrawing... " ); try { bank.withdraw(num, 100000); } catch (Exception e) { //System.out.println("Exception: " + e.getMessage()); } System.out.println("Balance = " + bank.getBalance(num)); } } static class FirstClientThread extends Thread { public void run() { bank.printBigAccounts(); } } public static void main(String[] args) { try { Context ctx = new InitialContext(System.getProperties()); bank = (Bank)ctx.lookup(Bank.class.getName()); bank.openAccount("blub", num); bank.deposit(num, 100000); Thread fst = new FirstClientThread(); Thread scn = new SecondClientThread(); fst.start(); scn.start(); fst.join(); scn.join(); System.out.println("Balance = " + bank.getBalance(num)); } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); } } } \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/META-INF/persistence.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/META-INF/persistence.xml
new file mode 100644
index 0000000..3427b20
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/META-INF/persistence.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence">
+ <persistence-unit name="intro">
+ <jta-data-source>jdbc/__default</jta-data-source>
+ <properties>
+ <property name="ddl-generation" value="createtables"/>
+ <property name="toplink.platform.class.name"
+ value="oracle.toplink.essentials.platform.database.DerbyPlatform"/>
+<!-- <property name="toplink.logging.level" value="FINEST"/> -->
+
+ </properties>
+ </persistence-unit>
+</persistence> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/MyListener.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/MyListener.java
new file mode 100644
index 0000000..f6cabcd
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/MyListener.java
@@ -0,0 +1,34 @@
+package examples.entity.intro;
+
+import javax.persistence.PostLoad;
+import javax.persistence.PostUpdate;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+
+public class MyListener {
+
+ public MyListener() {
+ }
+
+ @PrePersist
+ public void prepersist(Account a) {
+ System.out.println("pre persist " + a );
+ }
+
+ @PreUpdate
+ public void preupdate(Account a) {
+ System.out.println("pre update " + a);
+ }
+
+ @PostUpdate
+ public void postupdate(Account a) {
+ System.out.println("post update " + a);
+ }
+
+
+ @PostLoad
+ public void postload(Account a) {
+ System.out.println("post load!!" + a );
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/build.xml
new file mode 100644
index 0000000..1f2983f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/build.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-entity-intro" default="jar"
+ basedir="../../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="AccountEntity"/>
+ <property name="client.class" value="examples.entity.intro.AccountClient"/>
+ <property name="app.pkg" value="examples/entity/intro"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/entity/intro"/>
+
+
+ <!-- Include common.xml -->
+ &include;
+
+ <property name="deploy.file" value="${assemble.ejbjar}/${ejbjar}" />
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+ <target name="ear" depends="jar,create_ear_common"/>
+
+ <target name="deploy" depends="jar">
+ <copy file="${deploy.file}" todir="${deploy.dir}"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Client.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Client.java
new file mode 100644
index 0000000..1500a48
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Client.java
@@ -0,0 +1,22 @@
+package examples.jndi;
+
+import javax.naming.*;
+import javax.rmi.*;
+
+public class Client {
+
+ public static void main (String[] args) throws Exception {
+
+ // Lookup the remote object via JNDI
+ Context ctx = new InitialContext(System.getProperties());
+ Object remoteObject = ctx.lookup("PKGenerator");
+
+ // Cast the remote object, RMI-IIOP style
+ PrimaryKeyGenerator generator = (PrimaryKeyGenerator)
+ PortableRemoteObject.narrow(
+ remoteObject, PrimaryKeyGenerator.class);
+
+ // Generate a PK by calling the RMI-IIOP stub
+ System.out.println(generator.generate());
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/InitContext.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/InitContext.java
new file mode 100644
index 0000000..dca940f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/InitContext.java
@@ -0,0 +1,11 @@
+package examples.jndi;
+
+public class InitContext {
+ public static void main(String args[]) throws Exception {
+ // Form an Initial Context
+ javax.naming.Context ctx =
+ new javax.naming.InitialContext(System.getProperties());
+ System.err.println("Success!");
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGenerator.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGenerator.java
new file mode 100644
index 0000000..d866f9d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGenerator.java
@@ -0,0 +1,13 @@
+package examples.jndi;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * The remote interface for the remote object. Clients use it
+ * for all operations on the remote object.
+ */
+
+public interface PrimaryKeyGenerator extends Remote {
+ public long generate() throws RemoteException;
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGeneratorImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGeneratorImpl.java
new file mode 100644
index 0000000..eeb08cb
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/PrimaryKeyGeneratorImpl.java
@@ -0,0 +1,29 @@
+package examples.jndi;
+
+import java.rmi.RemoteException;
+import javax.rmi.PortableRemoteObject;
+
+/**
+ * The implementation of a remote object which generates primary keys
+ */
+public class PrimaryKeyGeneratorImpl
+ extends PortableRemoteObject
+ implements PrimaryKeyGenerator {
+
+ private static long i = System.currentTimeMillis();
+
+ public PrimaryKeyGeneratorImpl() throws Exception, RemoteException {
+ /*
+ * Since we extend PortableRemoteObject, the super
+ * class will export our remote object here.
+ */
+ super();
+ }
+
+ /**
+ * Generates a unique primary key
+ */
+ public synchronized long generate() throws RemoteException {
+ return i++;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Startup.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Startup.java
new file mode 100644
index 0000000..c6e9afa
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/Startup.java
@@ -0,0 +1,32 @@
+package examples.jndi;
+import javax.naming.*;
+
+/**
+ * A helper class which starts our RMI-IIOP server
+ */
+public class Startup {
+
+ /**
+ * Our main() method starts things up
+ */
+ public static void main(String args[]) throws Exception {
+
+ /*
+ * Start up our PKGenerator remote object. It will
+ * automatically export itself.
+ */
+ PrimaryKeyGenerator generator = new PrimaryKeyGeneratorImpl();
+
+ /*
+ * Bind our PKGenerator remote object to the JNDI tree
+ */
+ Context ctx = new InitialContext(System.getProperties());
+ ctx.rebind("PKGenerator", generator);
+ System.out.println("PKGenerator bound to JNDI tree.");
+
+ // wait for clients
+ synchronized (generator) {
+ generator.wait();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/build.xml
new file mode 100644
index 0000000..d7c9690
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/build.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-jndi" default="compile" basedir="../../..">
+
+ &include;
+
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property file="${basedir}/etc/common.properties"/>
+
+ <path id="classpath">
+ <pathelement location="${build.classes.dir}"/>
+ </path>
+
+ <!-- =================================================================== -->
+ <!-- Prepares the build directory -->
+ <!-- =================================================================== -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ </target>
+
+ <target name="rmic" depends="prepare">
+ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on" deprecation="on" optimize="off" includes="examples/jndi/PrimaryKeyGeneratorImpl.java">
+ <classpath refid="classpath" />
+ </javac>
+ <rmic base="${build.classes.dir}" classpath="${build.classes.dir}" classname="examples.jndi.PrimaryKeyGeneratorImpl" iiop="true" />
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Compiles the source code -->
+ <!-- =================================================================== -->
+ <target name="compile" depends="rmic">
+ <javac srcdir="${src.dir}"
+ destdir="${build.classes.dir}"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ includes="examples/jndi/**">
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <parallel>
+ <java classname="examples.jndi.Startup" fork="yes" dir=".">
+ <classpath refid="classpath"/>
+ </java>
+
+ <java classname="examples.jndi.Client" fork="yes" dir=".">
+ <classpath refid="classpath"/>
+ </java>
+ </parallel>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}/classes/examples/jndi"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/jndi.properties b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/jndi.properties
new file mode 100644
index 0000000..98cfb22
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/jndi/jndi.properties
@@ -0,0 +1,4 @@
+java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+#java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
+#java.naming.provider.url=file:c
+java.naming.provider.url=corbaloc::localhost:3528/NameService \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogBean.java
new file mode 100644
index 0000000..c8ff738
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogBean.java
@@ -0,0 +1,33 @@
+package examples.messaging;
+
+import javax.jms.*;
+import javax.ejb.*;
+import javax.annotation.PreDestroy;
+
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(propertyName = "destinationType",
+ propertyValue = "javax.jms.Topic")
+ })
+public class LogBean implements MessageListener {
+
+ public LogBean() {
+ System.out.println("LogBean created");
+ }
+
+ public void onMessage(Message msg) {
+ if (msg instanceof TextMessage) {
+ TextMessage tm = (TextMessage) msg;
+ try {
+ String text = tm.getText();
+ System.out.println("Received new message : " + text);
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @PreDestroy
+ public void remove() {
+ System.out.println("LogBean destroyed.");
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogClient.java
new file mode 100644
index 0000000..483c0f1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/LogClient.java
@@ -0,0 +1,38 @@
+package examples.messaging;
+
+import javax.jms.*;
+import javax.naming.InitialContext;
+
+public class LogClient {
+
+ public static void main(String[] args) throws Exception {
+ // Initialize JNDI
+ InitialContext ctx = new InitialContext(System.getProperties());
+
+ // 1: Lookup connection factory
+ TopicConnectionFactory factory =
+ (TopicConnectionFactory) ctx.lookup("jms/TopicConnectionFactory");
+
+ // 2: Use connection factory to create JMS connection
+ TopicConnection connection = factory.createTopicConnection();
+
+ // 3: Use connection to create a session
+ TopicSession session =
+ connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
+
+ // 4: Lookup destination
+ Topic topic = (Topic)ctx.lookup("jms/Topic");
+
+ // 5: Create a message publisher
+ TopicPublisher publisher = session.createPublisher(topic);
+
+ // 6: Create and publish a message
+ TextMessage msg = session.createTextMessage();
+ msg.setText("This is a test message.");
+ publisher.send(msg);
+
+ // finish
+ publisher.close();
+ System.out.println("Message published. Please check application server's console to see the response from MDB.");
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/META-INF/sun-ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/META-INF/sun-ejb-jar.xml
new file mode 100644
index 0000000..6389cbf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/META-INF/sun-ejb-jar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sun-ejb-jar>
+ <enterprise-beans>
+ <name>LogBean</name>
+ <ejb>
+ <ejb-name>LogBean</ejb-name>
+ <jndi-name>jms/Topic</jndi-name>
+ <mdb-connection-factory>
+ <jndi-name>jms/TopicConnectionFactory</jndi-name>
+ </mdb-connection-factory>
+ </ejb>
+ <ejb>
+ <ejb-name>PoisonBean</ejb-name>
+ <jndi-name>jms/Topic</jndi-name>
+ <mdb-connection-factory>
+ <jndi-name>jms/TopicConnectionFactory</jndi-name>
+ </mdb-connection-factory>
+ </ejb>
+ </enterprise-beans>
+</sun-ejb-jar>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/PoisonBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/PoisonBean.java
new file mode 100644
index 0000000..2bdfcba
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/PoisonBean.java
@@ -0,0 +1,40 @@
+package examples.messaging;
+
+import javax.jms.*;
+import javax.ejb.*;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+
+@MessageDriven(activationConfig =
+{ @ActivationConfigProperty(propertyName = "destinationType",
+ propertyValue = "javax.jms.Topic") })
+public class PoisonBean implements MessageListener {
+
+ @Resource
+ private MessageDrivenContext ctx;
+
+ public PoisonBean() {
+ System.out.println("PoisonBean created");
+ }
+
+ public void onMessage(Message msg) {
+ try {
+ System.out.println("Received msg " + msg.getJMSMessageID());
+
+ // Let’s sleep a little bit so that we don’t
+ // see rapid fire re-sends of the message.
+ Thread.sleep(3000);
+
+ // We could either throw a system exception here or
+ // manually force a rollback of the transaction.
+ ctx.setRollbackOnly();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @PreDestroy
+ public void remove() {
+ System.out.println("PoisonBean destroyed.");
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/Readme b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/Readme
new file mode 100644
index 0000000..2800cc7
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/Readme
@@ -0,0 +1,11 @@
+The messagin examples require that JMS connection factories and
+destination resources be created before deploying and running
+the samples.
+
+More specifically, you must create a javax.jms.TopicConnectionFactory
+resource with an JNDI name jms/TopicConnectionFactory, and a
+javax.jms.Topic destination resource with JNDI name jms/Topic. In
+Sun RI/Glassfish, the destination resource must have an additional
+property that links it with a physical destination. To provide that,
+add the property "name" with value "Topic" to that resource in the admin
+GUI.
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/build.xml
new file mode 100644
index 0000000..140b55e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/build.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-messaging" default="deploy"
+ basedir="../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="MessageDrivenLog"/>
+ <property name="client.class" value="examples.messaging.LogClient"/>
+ <property name="app.pkg" value="examples/messaging"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="${app.pkg}"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+
+ <target name="deploy" depends="jar">
+ <copy file="${assemble.ejbjar}/${ejbjar}"
+ todir="${deploy.dir}"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogBean.java
new file mode 100644
index 0000000..89364d9
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogBean.java
@@ -0,0 +1,22 @@
+package examples.messaging.dd;
+
+import javax.jms.*;
+
+public class LogBean implements MessageListener {
+
+ public LogBean() {
+ }
+
+ public void onMessage(Message msg) {
+ if (msg instanceof TextMessage) {
+ TextMessage tm = (TextMessage) msg;
+ try {
+ String text = tm.getText();
+ System.err.println("Received new message : " + text);
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogClient.java
new file mode 100644
index 0000000..14b6008
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/LogClient.java
@@ -0,0 +1,34 @@
+package examples.messaging.dd;
+
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.naming.InitialContext;
+
+public class LogClient {
+
+ public static void main(String[] args) throws Exception {
+ InitialContext ctx = new InitialContext(System.getProperties());
+
+ Topic topic = (Topic) ctx.lookup("jms/Topic");
+ TopicConnectionFactory factory =
+ (TopicConnectionFactory) ctx
+ .lookup("jms/TopicConnectionFactory");
+ TopicConnection connection = factory.createTopicConnection();
+ TopicSession session = connection.createTopicSession(false,
+ Session.AUTO_ACKNOWLEDGE);
+
+ TopicPublisher publisher = session.createPublisher(topic);
+
+ // create and publish a message
+ TextMessage msg = session.createTextMessage();
+ msg.setText("This is a test message.");
+ publisher.publish(msg);
+
+ System.out.println("Message published. Please check application server's console to see the response from MDB.");
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..92cee32
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/ejb-jar.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ejb-jar>
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>LogBeanDD</ejb-name>
+ <ejb-class>examples.messaging.dd.LogBean</ejb-class>
+ <messaging-type>javax.jms.MessageListener</messaging-type>
+ <transaction-type>Bean</transaction-type>
+ <message-destination-type>javax.jms.Topic</message-destination-type>
+ <!-- further details -->
+ <activation-config>
+ <activation-config-property>
+ <activation-config-property-name>destinationType</activation-config-property-name>
+ <activation-config-property-value>javax.jms.Topic</activation-config-property-value>
+ </activation-config-property>
+ </activation-config>
+ </message-driven>
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/sun-ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/sun-ejb-jar.xml
new file mode 100644
index 0000000..85caf26
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/META-INF/sun-ejb-jar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sun-ejb-jar>
+ <enterprise-beans>
+ <name>LogBeanDD</name>
+ <ejb>
+ <ejb-name>LogBeanDD</ejb-name>
+ <jndi-name>jms/Topic</jndi-name>
+ <mdb-connection-factory>
+ <jndi-name>jms/TopicConnectionFactory</jndi-name>
+ </mdb-connection-factory>
+ </ejb>
+ </enterprise-beans>
+</sun-ejb-jar>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/build.xml
new file mode 100644
index 0000000..b6b0013
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/messaging/dd/build.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-messaging-dd" default="deploy"
+ basedir="../../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="MessageDrivenLogDD"/>
+ <property name="client.class" value="examples.messaging.dd.LogClient"/>
+ <property name="app.pkg" value="examples/messaging/dd"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="${app.pkg}"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+
+ <target name="deploy" depends="jar">
+ <copy file="${assemble.ejbjar}/${ejbjar}"
+ todir="${deploy.dir}"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/Count.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/Count.java
new file mode 100644
index 0000000..21be867
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/Count.java
@@ -0,0 +1,24 @@
+package examples.session.stateful;
+
+/**
+ * The business interface - a plain Java interface with only business methods.
+ */
+public interface Count {
+
+ /**
+ * Increments the counter by 1
+ */
+ public int count();
+
+ /**
+ * Sets the counter to val
+ *
+ * @param val
+ */
+ public void set(int val);
+
+ /**
+ * removes the counter
+ */
+ public void remove();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountBean.java
new file mode 100644
index 0000000..6afd4a3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountBean.java
@@ -0,0 +1,53 @@
+package examples.session.stateful;
+
+import javax.ejb.*;
+
+/**
+ * A Stateful Session Bean Class that shows the basics of
+ * how to write a stateful session bean.
+ *
+ * This Bean is initialized to some integer value. It has a
+ * business method which increments the value.
+ *
+ * The annotations below declare that:
+ * <ul>
+ * <li>this is a Stateful Session Bean
+ * <li>the bean's remote business interface is <code>Count</code>
+ * <li>any lifecycle callbacks go to the class <code>CountCallbacks</code>
+ * </ul>
+ */
+
+@Stateful
+@Remote(Count.class)
+@Interceptors(CountCallbacks.class)
+public class CountBean implements Count {
+
+ /** The current counter is our conversational state. */
+ private int val;
+
+ /**
+ * The count() business method.
+ */
+ public int count() {
+ System.out.println("count()");
+ return ++val;
+ }
+
+ /**
+ * The set() business method.
+ */
+ public void set(int val) {
+ this.val = val;
+ System.out.println("set()");
+ }
+
+ /**
+ * The remove method is annotated so that the container knows
+ * it can remove the bean after this method returns.
+ */
+ @Remove
+ public void remove() {
+ System.out.println("remove()");
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java
new file mode 100644
index 0000000..d6f6aa1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountCallbacks.java
@@ -0,0 +1,53 @@
+package examples.session.stateful;
+
+import javax.ejb.InvocationContext;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+/**
+ * This class is a lifecycle callback interceptor for the Count bean.
+ * The callback methods simply print a message when invoked by the
+ * container.
+ */
+public class CountCallbacks {
+
+ public CountCallbacks() {}
+ /**
+ * Called by the container after construction
+ */
+ @PostConstruct
+ public void construct(InvocationContext ctx) throws Exception {
+ System.out.println("cb:construct() ");
+ ctx.proceed();
+ }
+
+ /**
+ * Called by the container after activation
+ */
+ @PostActivate
+ public void activate(InvocationContext ctx) throws Exception {
+ System.out.println("cb:activate()");
+ ctx.proceed();
+ }
+
+ /**
+ * Called by the container before passivation
+ */
+ @PrePassivate
+ public void passivate(InvocationContext ctx) throws Exception {
+ System.out.println("cb:passivate()");
+ ctx.proceed();
+ }
+
+ /**
+ * Called by the container before destruction
+ */
+ @PreDestroy
+ public void destroy(InvocationContext ctx) throws Exception {
+ System.out.println("cb:destroy()");
+ ctx.proceed();
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountClient.java
new file mode 100644
index 0000000..3536705
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/CountClient.java
@@ -0,0 +1,63 @@
+package examples.session.stateful;
+
+import javax.naming.*;
+
+/**
+ * This class is a simple client for a stateful session bean.
+ *
+ * To illustrate how passivation works, configure your EJB server
+ * to allow only 2 stateful session beans in memory. (Consult your
+ * vendor documentation for details on how to do this.) We create
+ * 3 beans in this example to see how and when beans are passivated.
+ */
+public class CountClient {
+
+ public static final int noOfClients = 3;
+
+ public static void main(String[] args) {
+ try {
+ /* Get a reference to the bean */
+ Context ctx = new InitialContext(System.getProperties());
+
+ /* An array to hold the Count beans */
+ Count count[] = new Count[noOfClients];
+ int countVal = 0;
+
+ /* Create and count() on each member of array */
+ System.out.println("Instantiating beans...");
+ for (int i = 0; i < noOfClients; i++) {
+ count[i] = (Count) ctx.lookup(Count.class.getName());
+
+ /* initialize each bean to the current count value */
+ count[i].set(countVal);
+
+ /* Add 1 and print */
+ countVal = count[i].count();
+ System.out.println(countVal);
+
+ /* Sleep for 1/2 second */
+ Thread.sleep(100);
+ }
+
+ /*
+ * Let's call count() on each bean to make sure the
+ * beans were passivated and activated properly.
+ */
+ System.out.println("Calling count() on beans...");
+ for (int i = 0; i < noOfClients; i++) {
+
+ /* Add 1 and print */
+ countVal = count[i].count();
+ System.out.println(countVal);
+
+ /* call remove to let the container dispose of the bean */
+ count[i].remove();
+
+ /* Sleep for 1/2 second */
+ Thread.sleep(50);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..9503e74
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/META-INF/ejb-jar.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <ejb-jar>
+ <enterprise-beans>
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/build.xml
new file mode 100644
index 0000000..d958085
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful/build.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-session-stateful" default="deploy"
+ basedir="../../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="StatefulSession"/>
+ <property name="client.class" value="examples.session.stateful.CountClient"/>
+ <property name="app.pkg" value="examples/session/stateful"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/session/stateful"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+
+ <target name="deploy" depends="jar">
+ <copy file="${assemble.ejbjar}/${ejbjar}"
+ todir="${deploy.dir}"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/Count.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/Count.java
new file mode 100644
index 0000000..f20ae5e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/Count.java
@@ -0,0 +1,24 @@
+package examples.session.stateful_dd;
+
+/**
+ * The business interface - a plain Java interface with only business methods.
+ */
+public interface Count {
+
+ /**
+ * Increments the counter by 1
+ */
+ public int count();
+
+ /**
+ * Sets the counter to val
+ *
+ * @param val
+ */
+ public void set(int val);
+
+ /**
+ * removes the counter
+ */
+ public void remove();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java
new file mode 100644
index 0000000..0a2ab2c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java
@@ -0,0 +1,47 @@
+package examples.session.stateful_dd;
+
+import java.io.Serializable;
+
+/**
+ * A Stateful Session Bean Class that shows the basics of
+ * how to write a stateful session bean.
+ *
+ * This Bean is initialized to some integer value. It has a
+ * business method which increments the value.
+ *
+ * The annotations below declare that:
+ * <ul>
+ * <li>this is a Stateful Session Bean
+ * <li>the bean's remote business interface is <code>Count</code>
+ * <li>any lifecycle callbacks go to the class <code>CountCallbacks</code>
+ * </ul>
+ */
+
+public class CountBean implements Count {
+
+ /** The current counter is our conversational state. */
+ private int val;
+
+ /**
+ * The count() business method.
+ */
+ public int count() {
+ System.out.println("count()");
+ return ++val;
+ }
+
+ /**
+ * The set() business method.
+ */
+ public void set(int val) {
+ this.val = val;
+ System.out.println("set()");
+ }
+
+ /**
+ */
+ public void remove() {
+ System.out.println("remove()");
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountCallbacks.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountCallbacks.java
new file mode 100644
index 0000000..f2ed8b0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountCallbacks.java
@@ -0,0 +1,43 @@
+package examples.session.stateful_dd;
+
+import javax.ejb.InvocationContext;
+
+/**
+ * This class is a lifecycle callback interceptor for the Count bean.
+ * The callback methods simply print a message when invoked by
+ * the container.
+ */
+public class CountCallbacks {
+
+ public CountCallbacks() {}
+
+ /**
+ * Called by the container after construction
+ */
+ public void construct(InvocationContext ctx) {
+ System.out.println("cb:construct()");
+ }
+
+ /**
+ * Called by the container after activation
+ */
+ public void activate(InvocationContext ctx) {
+ System.out.println("cb:activate()");
+ }
+
+ /**
+ * Called by the container before passivation
+ */
+ public void passivate(InvocationContext ctx) {
+ System.out.println("cb:passivate()");
+ }
+
+ /**
+ * Called by the container before destruction
+ */
+
+ public void destroy(InvocationContext ctx) {
+ System.out.println("cb:destroy()");
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountClient.java
new file mode 100644
index 0000000..46fb0cc
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountClient.java
@@ -0,0 +1,63 @@
+package examples.session.stateful_dd;
+
+import javax.naming.*;
+
+/**
+ * This class is a simple client for a stateful session bean.
+ *
+ * To illustrate how passivation works, configure your EJB server
+ * to allow only 2 stateful session beans in memory. (Consult your
+ * vendor documentation for details on how to do this.) We create
+ * 3 beans in this example to see how and when beans are passivated.
+ */
+public class CountClient {
+
+ public static final int noOfClients = 3;
+
+ public static void main(String[] args) {
+ try {
+ /* Get a reference to the bean */
+ Context ctx = new InitialContext();
+
+ /* An array to hold the Count beans */
+ Count count[] = new Count[noOfClients];
+ int countVal = 0;
+
+ /* Create and count() on each member of array */
+ System.out.println("Instantiating beans...");
+ for (int i = 0; i < noOfClients; i++) {
+ //count[i] = (Count) ctx.lookup("StatefulCount" );
+ count[i] = (Count) ctx.lookup(Count.class.getName());
+ /* initialize each bean to the current count value */
+ count[i].set(countVal);
+
+ /* Add 1 and print */
+ countVal = count[i].count();
+ System.out.println(countVal);
+
+ /* Sleep for 1/2 second */
+ Thread.sleep(100);
+ }
+
+ /*
+ * Let's call count() on each bean to make sure the
+ * beans were passivated and activated properly.
+ */
+ System.out.println("Calling count() on beans...");
+ for (int i = 0; i < noOfClients; i++) {
+
+ /* Add 1 and print */
+ countVal = count[i].count();
+ System.out.println(countVal);
+
+ /* call remove to let the container dispose of the bean */
+ count[i].remove();
+
+ /* Sleep for 1/2 second */
+ Thread.sleep(50);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..a483584
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/META-INF/ejb-jar.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+ <description>Stateful Session Bean Example</description>
+ <display-name>Stateful Session Bean Example</display-name>
+ <enterprise-beans>
+ <session>
+ <ejb-name>CountBean</ejb-name>
+ <business-remote>examples.session.stateful_dd.Count</business-remote>
+ <ejb-class>examples.session.stateful_dd.CountBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+
+ <interceptors>
+ <interceptor>
+ <interceptor-class>examples.session.stateful_dd.CountCallbacks
+ </interceptor-class>
+ <post-construct><lifecycle-callback-method>construct</lifecycle-callback-method></post-construct>
+ <post-activate><lifecycle-callback-method>activate</lifecycle-callback-method></post-activate>
+ <pre-passivate><lifecycle-callback-method>passivate</lifecycle-callback-method></pre-passivate>
+<!-- <pre-destroy><lifecycle-callback-method>destroy</lifecycle-callback-method></pre-destroy> -->
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>CountBean</ejb-name>
+ <interceptor-class>examples.session.stateful_dd.CountCallbacks
+ </interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/build.xml
new file mode 100644
index 0000000..8c9181a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/build.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-session-statefull_dd" default="all"
+ basedir="../../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="StatefulSession-Hello"/>
+ <property name="client.class" value="examples.session.stateful_dd.CountClient"/>
+ <property name="app.pkg" value="examples/session/stateful_dd"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/session/stateful_dd"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+ <target name="all" depends="compile_common, jar, deploy"/>
+
+ <target name="deploy" depends="jar">
+ <copy file="${assemble.ejbjar}/${ejbjar}"
+ todir="${deploy.dir}"/>
+ </target>
+
+ <target name="clean" depends="undeploy_common, clean_common" />
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/Hello.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/Hello.java
new file mode 100644
index 0000000..fa4648b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/Hello.java
@@ -0,0 +1,13 @@
+package examples.session.stateless;
+
+/**
+ * This is the Hello business interface.
+ */
+
+public interface Hello {
+
+ /**
+ * @return a greeting to the client.
+ */
+ public String hello();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloBean.java
new file mode 100644
index 0000000..10e6baf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloBean.java
@@ -0,0 +1,16 @@
+package examples.session.stateless;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * Demonstration stateless session bean.
+ */
+@Stateless
+@Remote(Hello.class)
+public class HelloBean implements Hello {
+ public String hello() {
+ System.out.println("hello()");
+ return "Hello, World!";
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloClient.java
new file mode 100644
index 0000000..29ebd03
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/HelloClient.java
@@ -0,0 +1,35 @@
+package examples.session.stateless;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * This class is an example of client code which invokes
+ * methods on a simple, remote stateless session bean.
+ */
+public class HelloClient {
+
+ public static void main(String[] args) throws Exception {
+ /*
+ * Obtain the JNDI initial context.
+ *
+ * The initial context is a starting point for
+ * connecting to a JNDI tree. We choose our JNDI
+ * driver, the network location of the server, etc
+ * by passing in the environment properties.
+ */
+ Context ctx = new InitialContext(System.getProperties());
+
+ /*
+ * Get a reference to a bean instance, looked up by class name
+ */
+ Hello hello = (Hello) ctx.lookup(Hello.class.getName());
+
+ /*
+ * Call the hello() method on the bean.
+ * We then print the result to the screen.
+ */
+ System.out.println(hello.hello());
+
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..9503e74
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/META-INF/ejb-jar.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <ejb-jar>
+ <enterprise-beans>
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/build.xml
new file mode 100644
index 0000000..33b4751
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateless/build.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-session-stateless" default="jar"
+ basedir="../../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="StatelessSession"/>
+ <property name="client.class" value="examples.session.stateless.HelloClient"/>
+ <property name="app.pkg" value="examples/session/stateless"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/session/stateless"/>
+
+
+ <!-- Include common.xml -->
+ &include;
+
+ <property name="deploy.file" value="${assemble.ejbjar}/${ejbjar}" />
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+ <target name="ear" depends="jar,create_ear_common"/>
+
+ <target name="deploy" depends="jar">
+ <copy file="${deploy.file}" todir="${deploy.dir}"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java
new file mode 100644
index 0000000..22ad6ea
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/Hello.java
@@ -0,0 +1,15 @@
+package examples.session.ws;
+
+
+/**
+ * This is the Hello business interface.
+ */
+
+
+public interface Hello {
+
+ public String hello();
+
+ public void foo();
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java
new file mode 100644
index 0000000..13e6eef
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/HelloBean.java
@@ -0,0 +1,18 @@
+package examples.session.ws;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+@Stateless
+@WebService(serviceName="Greeter", portName="GreeterPort")
+public class HelloBean {
+
+ public String hello() {
+ System.out.println("hello()");
+ return "Hello, World!";
+ }
+
+ public void foo() {
+ ;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java
new file mode 100644
index 0000000..be8401e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/JAXWSClient.java
@@ -0,0 +1,40 @@
+package examples.session.ws;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+/**
+ * This is an example of a standalone JAX-WS client. To compile,
+ * it requires some XML artifacts to be generated from the service's
+ * WSDL. This is done in the build file.
+ *
+ * The mapped XML classes used her are
+ * 1. the HelloBean port type class (this is NOT the bean impl. class!)
+ * 2. the Greeter service class
+ */
+public class JAXWSClient {
+
+ static String host = "localhost";
+ static String portType = "HelloBean";
+ static String serviceName = "Greeter";
+ static String serviceEndpointAddress = "http://" + host + ":8080/" + serviceName;
+ static String nameSpace = "urn:ws.session.examples";
+
+ public static void main(String[] args) throws Exception {
+
+ URL wsdlLocation = new URL(serviceEndpointAddress + "/" + portType + "?WSDL");
+ QName serviceNameQ = new QName( nameSpace, serviceName);
+
+ // dynamic service usage
+ Service service = Service.create(wsdlLocation, serviceNameQ);
+ HelloBean firstGreeterPort = service.getPort(HelloBean.class);
+ System.out.println("1: " + firstGreeterPort.hello());
+
+ // static service usage
+// Greeter greeter = new Greeter();
+// HelloBean secondGreeterPort = greeter.getGreeterPort();
+// System.out.println("2: " +secondGreeterPort.hello());
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..9503e74
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/META-INF/ejb-jar.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <ejb-jar>
+ <enterprise-beans>
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml
new file mode 100644
index 0000000..2d4a975
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/ws/build.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-session-ws" default="all"
+ basedir="../../../..">
+
+ <!-- properties overriding common ones -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="WS"/>
+ <property name="client.class" value="examples.session.ws.JAXWSClient"/>
+ <property name="app.pkg" value="examples/session/ws"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/session/ws"/>
+ <property name="ServiceName" value="Greeter" />
+ <property name="PortType" value="HelloBean" />
+
+ <!-- Include common.xml -->
+ &include;
+
+ <!-- specific properties -->
+ <property name="deploy.file" value="${ejbjar}" />
+ <property name="assemble.dir" value="${assemble.ejbjar}" />
+
+ <!-- targets -->
+ <target name="client_jar" depends="compile_client, create_client_jar"/>
+ <target name="all" depends="client_jar"/>
+
+ <target name="compile_service" depends="init_common">
+ <mkdir dir="${build.classes.dir}"/>
+ <javac srcdir="${pack.dir}" debug="true" excludes="**/*Client.java"
+ destdir="${build.classes.dir}"
+ classpath="${build.classpath}"/>
+ </target>
+
+ <target name="compile_client" depends="init_common,clean_clientjar_common">
+ <mkdir dir="${assemble.clientjar}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <get src="${service.wsdl}" dest="${build.classes.dir}/service.wsdl"/>
+ <wsimport
+ fork="true" keep="true"
+ wsdl="${build.classes.dir}/service.wsdl"
+ sourcedestdir="${build.classes.dir}"
+ destdir="${assemble.clientjar}" >
+ </wsimport>
+ <javac srcdir="${pack.dir}" debug="true" includes="**/*Client.java"
+ destdir="${assemble.clientjar}"
+ classpath="${build.classpath}"/>
+ </target>
+
+ <target name="run_wsclient_standalone" depends="client_jar">
+ <java classname="${client.class}"
+ classpath="${assemble.clientjar}/${clientjar};${appserver.home}/lib/appserv-rt.jar;${appserver.home}/lib/appserv-ws.jar;${appserver.home}/lib/appserv-admin.jar;${appserver.home}/lib/javaee.jar;" fork="yes">
+ </java>
+ </target>
+
+ <target name="create_ejbjar" depends="clean_ejbjar_common,compile_service">
+ <mkdir dir="${assemble.ejbjar}"/>
+ <jar destfile="${assemble.ejbjar}/${ejbjar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${jar.pkg}"/>
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${jarDD}"/>
+ </jar>
+ </target>
+
+ <target name="deploy" depends="compile_service,create_ejbjar, deploy_common" />
+ <target name="clean" depends="undeploy_common, clean_common" />
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/application.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/application.xml
new file mode 100644
index 0000000..fe5919f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/application.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application version="5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
+
+ <description>Application description</description>
+ <display-name>Jasmine</display-name>
+ <module>
+ <web>
+ <web-uri>shop.war</web-uri>
+ <context-root>jasmine</context-root>
+ </web>
+ </module>
+ <module>
+ <ejb>shopEjb.jar</ejb>
+ </module>
+
+</application>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..9ca92e0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/ejb-jar.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <ejb-jar>
+ <enterprise-beans>
+ <session>
+ <ejb-name>PricerBean</ejb-name>
+ <ejb-class>examples.shop.impl.session.PricerBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ <env-entry>
+ <env-entry-name>taxRate</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>6</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>bulkDiscountRate</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>10</env-entry-value>
+ </env-entry>
+ </session>
+
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/persistence.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/persistence.xml
new file mode 100644
index 0000000..893e1c7
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/persistence.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence">
+ <persistence-unit name="shop">
+ <jta-data-source>jdbc/__default</jta-data-source>
+ <properties>
+ <property name="ddl-generation" value="createtables"/>
+ <property name="toplink.platform.class.name"
+ value="oracle.toplink.essentials.platform.database.DerbyPlatform"/>
+<!-- <property name="toplink.logging.level" value="FINEST"/> -->
+
+ </properties>
+ </persistence-unit>
+</persistence> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/sun-ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/sun-ejb-jar.xml
new file mode 100644
index 0000000..71fa2ad
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/META-INF/sun-ejb-jar.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sun-ejb-jar>
+ <enterprise-beans>
+ <name>OrderProcessorBean</name>
+ <ejb>
+ <ejb-name>OrderProcessorBean</ejb-name>
+ <jndi-name>jms/OrderQueue</jndi-name>
+ <mdb-connection-factory>
+ <jndi-name>jms/QueueConnectionFactory</jndi-name>
+ </mdb-connection-factory>
+ </ejb>
+ </enterprise-beans>
+</sun-ejb-jar>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/sun-web.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/sun-web.xml
new file mode 100644
index 0000000..cca518c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/sun-web.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sun-web-app>
+ <context-root>jasmine</context-root>
+ <class-loader delegate="true"/>
+</sun-web-app>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/web.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/web.xml
new file mode 100644
index 0000000..7bf9dbb
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/WEB-INF/web.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <welcome-file-list>
+ <welcome-file></welcome-file>
+ </welcome-file-list>
+
+ <servlet>
+ <servlet-name>LoginServlet</servlet-name>
+ <servlet-class>examples.shop.web.servlet.LoginServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>LoginServlet</servlet-name>
+ <url-pattern>/login/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ShowQuoteServlet</servlet-name>
+ <servlet-class>examples.shop.web.servlet.ShowQuoteServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ShowQuoteServlet</servlet-name>
+ <url-pattern>/showQuote/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>CatalogServlet</servlet-name>
+ <servlet-class>examples.shop.web.servlet.CatalogServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CatalogServlet</servlet-name>
+ <url-pattern>/catalog/*</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/build.xml
new file mode 100644
index 0000000..a403dda
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/build.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-shop" default="jar"
+ basedir="../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="shop"/>
+ <property name="client.class" value="examples.shop.client.SetupClient"/>
+ <property name="wsclient.class" value="examples.shop.client.PricerClient"/>
+ <property name="app.pkg" value="examples/shop"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/shop"/>
+ <property name="war.pkg" value="examples/shop"/>
+ <property name="ServiceName" value="PricerService" />
+ <property name="PortType" value="PricerBean" />
+
+ <!-- Include common.xml -->
+ &include;
+
+ <property name="deploy.file" value="${assemble.ear}/${ear}" />
+
+ <target name="compile_client" depends="init_common,clean_clientjar_common">
+ <mkdir dir="${assemble.clientjar}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <get src="${service.wsdl}" dest="${build.classes.dir}/service.wsdl"/>
+ <wsimport
+ fork="true" keep="true"
+ wsdl="${build.classes.dir}/service.wsdl"
+ sourcedestdir="${build.classes.dir}"
+ destdir="${assemble.clientjar}" >
+ </wsimport>
+ <javac srcdir="${pack.dir}" debug="true" includes="**/*Client.java"
+ destdir="${assemble.clientjar}"
+ classpath="${build.classpath}"/>
+ </target>
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+
+ <target name="client_jar" depends="compile_client, create_client_jar"/>
+
+ <target name="ear" depends="jar,war,clean_ear_common,mkdir_ear_dir">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.war}" includes="${war}"/>
+ </jar>
+ <echo message="${src.dir}/${package}/META-INF/${earDD}"/>
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ <fileset dir="${assemble.ejbjar}" includes="sun-application.xml"/>
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${earDD}"/>
+ </jar>
+ <delete file="../${ejbjar}" />
+ </target>
+
+ <target name="run_wsclient_standalone" depends="client_jar">
+ <java classname="${wsclient.class}"
+ classpath="${assemble.clientjar}/${clientjar};${appserver.home}/lib/appserv-rt.jar;${appserver.home}/lib/appserv-ws.jar;${appserver.home}/lib/appserv-admin.jar;${appserver.home}/lib/javaee.jar;" fork="yes">
+ </java>
+ </target>
+
+
+ <target name="war" depends="mkdir_war, create_ejbjar_common">
+ <jar destfile="${assemble.war}/${war}" update="true" >
+ <fileset dir="${src.dir}/${package}" includes="WEB-INF/*.xml" />
+ </jar>
+ <echo message="${src.dir}/${war.pkg}/"/>
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${src.dir}/${war.pkg}/web/jsp/" includes="*.jsp"
+ />
+ </jar>
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${build.classesdir}/${war.pkg}/" includes="**/*Servlet.class"
+ prefix="WEB-INF/classes/${war.pkg}"/>
+ </jar>
+ </target>
+
+
+ <target name="deploy" depends="ear, war">
+ <copy file="${deploy.file}" todir="${deploy.dir}"/>
+ </target>
+
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/PricerClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/PricerClient.java
new file mode 100644
index 0000000..0bd285b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/PricerClient.java
@@ -0,0 +1,52 @@
+package examples.shop.client;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import examples.shop.impl.session.PricerBean;
+
+/**
+ * This class is an example of a standalone JAX-RPC client code which uses both
+ * the static stub and the dynamic proxy approach to get a reference to the
+ * remote Web Service
+ */
+public class PricerClient {
+ static String host = "localhost";
+
+ static String portType = "PricerBean";
+
+ static String serviceName = "PricerService";
+
+ static String serviceEndpointAddress = "http://" + host + ":8080/"
+ + serviceName;
+
+ static String nameSpace = "urn:session.impl.shop.examples";
+
+ public static void main(String[] args) throws Exception {
+
+ URL wsdlLocation = new URL(serviceEndpointAddress + "/" + portType
+ + "?WSDL");
+ QName serviceNameQ = new QName(nameSpace, serviceName);
+
+ // dynamic service usage
+ Service service = Service.create(wsdlLocation, serviceNameQ);
+ PricerBean pricerPort = service.getPort(PricerBean.class);
+
+ String user = "Gerald";
+
+ System.out.println("Tax rate: " + pricerPort.getTaxRate());
+ System.out.println("Discount for : " + user + " is "
+ + pricerPort.getPersonalDiscountRate(user));
+
+ System.out
+ .println("Discount for 1 item (at $1000,- per piece) for " + user + " is "
+ + pricerPort.getDiscount(1, 1000, user));
+
+ System.out
+ .println("Discount for 5 items (at $1000,- per piece) for " + user + " is "
+ + pricerPort.getDiscount(5, 5000, user));
+
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/SetupClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/SetupClient.java
new file mode 100644
index 0000000..c1fbc27
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/client/SetupClient.java
@@ -0,0 +1,58 @@
+package examples.shop.client;
+
+import java.util.Iterator;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import examples.shop.impl.entity.Product;
+import examples.shop.logic.Catalog;
+import examples.shop.logic.UserManager;
+
+/**
+ * Client test application on a CMP Entity Bean, Product.
+ */
+public class SetupClient {
+
+ public static void main(String[] args) throws Exception {
+
+ try {
+
+ Context ctx = new InitialContext(System.getProperties());
+ Catalog catalog = (Catalog) ctx.lookup(Catalog.class.getName());
+
+ /*
+ * Use the catalog to create Products
+ */
+ catalog.addProduct(new Product().init("123-456-7890", "P4-1.8",
+ "1.8 GHz Pentium 4", 200));
+ catalog.addProduct(new Product().init("123-456-7891", "P4-3",
+ "3 GHz Pentium 4", 300));
+ catalog.addProduct(new Product().init("123-456-7892", "P4-4",
+ "4 GHz Pentium", 400));
+ catalog.addProduct(new Product().init("123-456-7893", "SD-256",
+ "256 MB SDRAM", 50));
+ catalog.addProduct(new Product().init("123-456-7894", "SD-512",
+ "512 MB SDRAM", 100));
+ catalog.addProduct(new Product().init("123-456-7895", "DD-1000",
+ "1GB MB DDRAM", 200));
+ catalog.addProduct(new Product().init("123-456-7896", "MP3-x",
+ "MP3 Player", 200));
+
+ /*
+ * Find a Product, and print out it's description
+ */
+ for (Iterator<Product> i = catalog.getProductList().iterator(); i
+ .hasNext();) {
+ System.out.println(i.next().getDescription());
+ }
+
+ UserManager userManager =
+ (UserManager) ctx.lookup(UserManager.class.getName());
+ userManager.createUser("Gerald", "Gerald Brose", "password",
+ "D-13509 Berlin, Germany");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Customer.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Customer.java
new file mode 100644
index 0000000..c986436
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Customer.java
@@ -0,0 +1,104 @@
+package examples.shop.impl.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * This entity represents customer details.
+ */
+@Entity
+public class Customer implements java.io.Serializable {
+
+ private String customerID;
+
+ private String name;
+
+ private String password;
+
+ private String address;
+
+ private double discount;
+
+ /**
+ * Returns the Id of the customer
+ */
+ @Id
+ public String getCustomerID() {
+ return customerID;
+ }
+
+ /**
+ * Sets the id of the customer
+ */
+ public void setCustomerID(String customerId) {
+ this.customerID = customerId;
+ }
+ /**
+ * Returns the name of the customer
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the customer
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the password of the customer
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Sets the password of the customer
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ /**
+ * Returns the address of the customer
+ */
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * Sets the address of the customer
+ */
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public double getDiscount() {
+ return discount;
+ }
+
+ public void setDiscount(double discount) {
+ this.discount = discount;
+ }
+
+ public Customer() {
+ }
+
+ /**
+ * Called when new data is created.
+ *
+ * We need to initialize our Bean's state with the parameters
+ * passed from the client by calling our own abstract set
+ * methods. The Container can then inspect our Bean and
+ * INSERT the corresponding database entries.
+ */
+ public void init(String id, String name, String password, String address) {
+ setCustomerID(id);
+ setName(name);
+ setAddress(address);
+ setPassword(password);
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/LineItem.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/LineItem.java
new file mode 100644
index 0000000..447cc75
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/LineItem.java
@@ -0,0 +1,132 @@
+package examples.shop.impl.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+
+/**
+ * A line item entity is a quantity of a single product.
+ *
+ * Instances of this class are used for both in-memory represenation
+ * of carts and the persistent representation of orders in
+ * the database
+ */
+@Entity
+public class LineItem implements java.io.Serializable {
+
+ private String id;
+
+ /** the product */
+ private Product product;
+
+ /** Number of items */
+ private int quantity;
+
+ /** Amount of the discount for each item */
+ private double discount;
+
+ /**
+ * Constructor
+ * @param productitem
+ * @param number of items
+ * @Param discount for each item
+ */
+ public LineItem(Product productItem, int quantity, double discount) {
+ System.out.println("LineItem(...) called");
+ this.product = productItem;
+ this.quantity = quantity;
+ this.discount = discount;
+ }
+
+ public LineItem() {
+ System.out.println("New LineItem created.");
+ }
+
+ /**
+ * The id number of this line item. This is our primary key as well.
+ *
+ * @return the id
+ */
+ @Id
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the id
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @return the productitem.
+ * productitem has product id, name of the product and description
+ */
+ @OneToOne
+ public Product getProduct() {
+ System.out.println("LineItem.getProduct() called.");
+ return product;
+ }
+
+ /**
+ * @param productItem.
+ */
+ public void setProduct(Product product) {
+ System.out.println("LineItem.setProduct() called.");
+ this.product = product;
+ }
+
+ /**
+ * @return the number of items.
+ */
+ public int getQuantity() {
+ System.out.println("LineItem.getQuantity() called.");
+ return quantity;
+ }
+
+ /**
+ * @param the number of items.
+ */
+ public void setQuantity(int quantity) {
+ System.out.println("LineItem.setQuantity() called.");
+ this.quantity = quantity;
+ }
+
+ /**
+ * @return the base price. The base price is the
+ * product's price times the quantity ordered. This
+ * figure does not take discounts into consideration.
+ */
+ public double basePrice() {
+ System.out.println("LineItem.getBasePrice() called.");
+ return quantity * product.getBasePrice();
+ }
+
+ /**
+ * @return the discount that the customer gets on
+ * this order.
+ *
+ * Note: The discount is a whole number, not
+ * a percentage discount.
+ */
+ public double getDiscount() {
+ System.out.println("LineItem.getDiscount() called.");
+ return discount;
+ }
+
+ /**
+ * @param the discount that the customer gets on
+ * this order.
+ *
+ * Note: The discount is a whole number, not
+ * a percentage discount.
+ */
+ public void setDiscount(double discount) {
+ System.out.println("LineItem.setDiscount(" + discount + ") called.");
+ this.discount = discount;
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Order.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Order.java
new file mode 100644
index 0000000..8986495
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Order.java
@@ -0,0 +1,183 @@
+package examples.shop.impl.entity;
+
+import java.sql.Timestamp;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ * This entity represents an order placed for goods.
+ *
+ * Note: This entity could easily be extended to include other things, such as:
+ * <ul>
+ * <li>Shipping charges
+ * <li>Shipping address vs. Billing address
+ * <li>A date which this order is scheduled to be completed/shipped.
+ * </ul>
+ */
+
+@Entity
+@Table(name = "ORDERS")
+public class Order {
+
+ public enum Status {
+ Submitted, Unverified, Approved, Shipping, Delivered, Returned
+ };
+
+ private String orderId;
+
+ private List<LineItem> lineItems;
+
+ private Customer customer;
+
+ private Timestamp orderDate;
+
+ private Status status;
+
+ private double taxes;
+
+ private double subTotal;
+
+ /**
+ * This order's identification number. It's also our Primary Key.
+ *
+ * @return order id
+ */
+ @Id
+ public String getOrderID() {
+ return orderId;
+ }
+
+ /**
+ * Sets the order id of an order
+ */
+ public void setOrderID(String id) {
+ orderId = id;
+ }
+
+ /**
+ * This represents a one-to-many relationship to the
+ * line items in the order. Persisting the order cascades
+ * to the line items.
+ *
+ * @return the set of order line items
+ */
+ @OneToMany(cascade = CascadeType.PERSIST)
+ public List<LineItem> getLineItems() {
+ return lineItems;
+ }
+
+ /**
+ * Sets set of the order line items
+ */
+ public void setLineItems(List<LineItem> lineItems) {
+ this.lineItems = lineItems;
+ }
+
+ /**
+ * @returns the Customer who placed this Order.
+ */
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ /**
+ * set customer who placed this order.
+ */
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ /**
+ * Returns the date this order was placed.
+ */
+ public Timestamp getOrderDate() {
+ return orderDate;
+ }
+
+ /**
+ * Sets the date this order
+ */
+ public void setOrderDate(Timestamp orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ /**
+ * @return status information about the order.
+ */
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets status information about the order.
+ */
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ /**
+ * Sets the subtotal of this order
+ */
+
+ public double getSubTotal() {
+ return subTotal;
+ }
+
+ /**
+ * Returns the subtotal of this order
+ */
+ public void setSubTotal(double subTotal) {
+ this.subTotal = subTotal;
+ }
+
+ /**
+ * Returns taxes of this order
+ */
+ public double getTaxes() {
+ return taxes;
+ }
+
+ /**
+ * Sets the taxes of this order
+ */
+ public void setTaxes(double taxes) {
+ this.taxes = taxes;
+ }
+
+ /**
+ * Returns the subtotal rice of the entire order, ie. the sum of
+ * the base prices of all line items in this order.
+ */
+ public double totalPrice() {
+ double totalPrice = 0;
+ for (Iterator<LineItem> iter = getLineItems().iterator(); iter
+ .hasNext();) {
+ LineItem item = iter.next();
+ totalPrice += item.getProduct().basePrice;
+ }
+ return totalPrice;
+ }
+
+ /**
+ * Called to initialize a new order entity
+ *
+ * We need to initialize our entity's state with the parameters passed from
+ * the client.
+ */
+ public void init(String orderID, Customer customer, Status status,
+ double subTotal, double taxes) {
+ System.out.println("Order.init(" + orderID + ") called");
+ setOrderID(orderID);
+ setOrderDate(new java.sql.Timestamp(System.currentTimeMillis()));
+ setStatus(status);
+ setSubTotal(subTotal);
+ setTaxes(taxes);
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Product.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Product.java
new file mode 100644
index 0000000..99fb29a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/entity/Product.java
@@ -0,0 +1,93 @@
+package examples.shop.impl.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * Entity
+ *
+ * This is a product that's persistent. It has an ID #, a name,
+ * a description, and a base price.
+ */
+@Entity
+public class Product implements java.io.Serializable {
+
+ public String name;
+ public String description;
+ public double basePrice;
+ public String productID;
+
+ public Product() {
+ }
+
+ /**
+ * @return the product id.
+ */
+ @Id
+ public String getProductID() {
+ return productID;
+ }
+
+ /**
+ * Sets the product id.
+ */
+ public void setProductID(String productID) {
+ this.productID = productID;
+ }
+
+ /**
+ * @return the name of the product.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the product.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the description of the product.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description of the product.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the base price of the product.
+ */
+ public double getBasePrice() {
+ return basePrice;
+ }
+
+ /**
+ * Sets the base price of the product.
+ */
+ public void setBasePrice(double price) {
+ this.basePrice = price;
+ }
+
+
+ /**
+ * This is the initialization method
+ */
+ public Product init(String productID, String name, String description,
+ double basePrice) {
+ this.productID = productID;
+ this.name = name;
+ this.description = description;
+ this.basePrice = basePrice;
+ return this;
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/mdb/OrderProcessorBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/mdb/OrderProcessorBean.java
new file mode 100644
index 0000000..a1056d1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/mdb/OrderProcessorBean.java
@@ -0,0 +1,68 @@
+package examples.shop.impl.mdb;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJBException;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import examples.shop.impl.entity.Order;
+
+
+/**
+ * This message-driven bean receives JMS messages
+ * to process orders. It then performs the order
+ * processing.
+ */
+@MessageDriven(activationConfig = {
+ @ActivationConfigProperty(
+ propertyName = "destinationType",
+ propertyValue = "javax.jms.Queue")
+ })
+public class OrderProcessorBean implements MessageListener {
+
+ @PersistenceContext
+ EntityManager manager;
+
+ public OrderProcessorBean() {
+ }
+
+ /**
+ * The one business method that message-driven beans have
+ * Here we perform the actual order processing
+ */
+ public void onMessage(Message msg) {
+ TextMessage tm = (TextMessage) msg;
+ try {
+ String orderID = tm.getText();
+ System.out.println("Processing order " + orderID);
+
+ Order order = manager.find(Order.class, orderID);
+
+ /*
+ * At this point, we could perform lots of tasks:
+ *
+ * - A call-out to a credit card company (perhaps through
+ * web services) to check the user's credit
+ * card rating and perform a debit.
+ *
+ * - Check the product inventory to ensure availability
+ *
+ * - Check the current backlog for shipping orders
+ *
+ * - Send an email confirmation
+ *
+ * In this example, we'll merely set the order status to
+ * "approved".
+ */
+ order.setStatus(Order.Status.Approved);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new EJBException(e);
+ }
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CartBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CartBean.java
new file mode 100644
index 0000000..d5e2b1b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CartBean.java
@@ -0,0 +1,320 @@
+package examples.shop.impl.session;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import examples.shop.impl.entity.Customer;
+import examples.shop.impl.entity.LineItem;
+import examples.shop.impl.entity.Order;
+import examples.shop.impl.entity.Product;
+import examples.shop.logic.Cart;
+
+/**
+ * This stateful session bean represents a cart which a customer is
+ * working on. A cart is a set of products that the customer is
+ * interested in, but has not committed to buying yet.
+ *
+ * A cart consists of a series of line items. Each line item
+ * represents one particular product the customer wants, as well as a
+ * quantity and discount for that product.
+ *
+ * The distinction between a cart and an order is that a quote is only
+ * temporary and in-memory (hence a stateful session bean), whereas an
+ * order is a persistent record (hence an entity). The cart bean
+ * knows how to transform itself into an order (via the purchase()
+ * method).
+ */
+
+@Stateful
+@Remote(Cart.class)
+public class CartBean implements Cart {
+
+ /**
+ * The shopping cart owner
+ */
+ private String owner;
+
+ /**
+ * The shopping cart contents - a vector of LineItems
+ */
+ private List<LineItem> contents = new ArrayList();
+
+ /**
+ * The subtotal (price before taxes) of the goods
+ */
+ private double subTotal;
+
+ /**
+ * The taxes on the goods
+ */
+ private double taxes;
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ public CartBean() {
+ }
+
+ /**
+ * Get method for the shopping cart owner's name
+ *
+ * @return shopping cart owner
+ */
+ public String getOwner() {
+ return owner;
+ }
+
+ /**
+ * Set method for the shopping cart owner's name
+ *
+ * @param shopping
+ * cart owner
+ */
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ /**
+ * Adds an item to the shopping cart
+ *
+ * @param shopping
+ * cart lineitem
+ */
+ public void add(LineItem lineItem) {
+ /*
+ * Search for an exiting line item in the cart that match
+ * the productID passed in.
+ */
+ for (Iterator<LineItem> iter = contents.iterator(); iter.hasNext();) {
+ LineItem item = iter.next();
+ Product product = item.getProduct();
+
+ if (product != null
+ && product.getProductID().equals(
+ lineItem.getProduct().getProductID())) {
+ // found one, modify that line item's quantity and return
+ item.setQuantity(item.getQuantity() + lineItem.getQuantity());
+ return;
+ }
+ }
+
+ /*
+ * Did not find a match, so add the line item as new.
+ */
+ contents.add(lineItem);
+ }
+
+ /**
+ * Changes the quantities of contents in the shopping cart
+ *
+ * @param product
+ * Id
+ * @param number
+ * of items.
+ */
+ public void modify(String productID, int quantity) throws Exception {
+ System.out.println("CartBean.modify()");
+
+ /*
+ * Search for a lineitem in the cart that match the productID passed in.
+ * If found, modify that lineitem.
+ */
+ for (Iterator<LineItem> iter = contents.iterator(); iter.hasNext();) {
+ LineItem item = iter.next();
+ Product product = item.getProduct();
+ if (product != null && product.getProductID().equals(productID)) {
+ item.setQuantity(quantity);
+ if (quantity == 0) {
+ iter.remove();
+ }
+ return;
+ }
+ }
+ throw new Exception("CartBean.modify() error: Could not find product "
+ + productID);
+ }
+
+ /**
+ * Returns all the shopping cart line items
+ *
+ * @return A collection of Cart LineItems
+ */
+ public List<LineItem> getAll() {
+ return contents;
+ }
+
+ /**
+ * @return the subtotal price which has been previously set by
+ * setSubtotal().
+ */
+ public double getSubtotal() {
+ return subTotal;
+ }
+
+ /**
+ * Sets the subtotal price.
+ * @param subTotal the subtotal price
+ */
+ public void setSubtotal(double subTotal) {
+ this.subTotal = subTotal;
+ }
+
+ /**
+ * @return the taxes computed for this Cart.
+ */
+ public double getTaxes() {
+ return taxes;
+ }
+
+ /**
+ * Sets the taxes for this Cart.
+ */
+ public void setTaxes(double taxes) {
+ System.out.println("CartBean.setTaxes(): " + taxes);
+ this.taxes = taxes;
+ }
+
+ /**
+ * Get the total price. The total Price is computed from:
+ * <ol>
+ * <li>Subtotal price
+ * <li>Tax
+ * </ol>
+ * @return the total price.
+ */
+ public double getTotalPrice() {
+ return subTotal + taxes;
+ }
+
+ /**
+ * Empties the shopping cart
+ */
+ public void clear() {
+ contents.clear();
+ }
+
+ /**
+ * Purchases this cart. The cart will create an order in the database
+ * and return the order ID as a confirmation number.
+ *
+ * @return The Order confirmation number
+ */
+ public String purchase() {
+ System.out.println("CartBean.purchase()");
+ Customer customer = manager.find(Customer.class, owner);
+
+ /*
+ * Create the order entity
+ */
+ Order order = new Order();
+ String orderID = makeUniqueID();
+ order.init(orderID, customer, Order.Status.Unverified, subTotal, taxes);
+ order.setLineItems(prepareContents());
+ manager.persist(order);
+
+ /*
+ * Sends the JMS message to the topic
+ */
+ try {
+ sendMessage(orderID);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ /*
+ * Return the order ID
+ */
+ return orderID;
+ }
+
+ /**
+ * Sends a JMS message to a destination (Queue or Topic)
+ *
+ * @param a
+ * message string, in this case orderId
+ */
+ private void sendMessage(String text) throws Exception {
+ Connection connection = null;
+ MessageProducer producer = null;
+ Session session = null;
+
+ try {
+ Context jndiContext = new InitialContext();
+ ConnectionFactory connectionFactory = (ConnectionFactory) jndiContext
+ .lookup("jms/QueueConnectionFactory");
+ Destination destination = (Destination) jndiContext
+ .lookup("jms/OrderQueue");
+ connection = connectionFactory.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ producer = session.createProducer(destination);
+
+ connection.start();
+ TextMessage msg = session.createTextMessage();
+ msg.setText(text);
+ producer.send(msg);
+ } catch (Exception ex) {
+ throw ex;
+ } finally {
+ if (connection != null) {
+ try {
+ producer.close();
+ connection.close();
+ session.close();
+ } catch (JMSException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ /**
+ * Generates primary keys for line items and loads the products
+ * into the persistence context.
+ */
+
+ private List<LineItem> prepareContents() {
+ for (Iterator<LineItem> iter = contents.iterator(); iter.hasNext();) {
+ LineItem lineItem = iter.next();
+ Product p = manager.find(Product.class, lineItem.getProduct()
+ .getProductID());
+ lineItem.setProduct(p);
+ lineItem.setId(makeUniqueID());
+ }
+ return contents;
+ }
+
+ /**
+ * Returns a unique Id based on current time. Can be removed
+ * when AUTO key generation works in Glassfish *
+ */
+ private String makeUniqueID() {
+ String id = new Long(System.nanoTime()).toString();
+ System.out.println("makeUniqueID: " + id);
+ return id;
+ }
+
+ /**
+ * Removes this quote, and hence all client-
+ * specific state.
+ */
+ @Remove
+ public void remove() {
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CatalogBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CatalogBean.java
new file mode 100644
index 0000000..658b675
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/CatalogBean.java
@@ -0,0 +1,41 @@
+package examples.shop.impl.session;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import examples.shop.impl.entity.Product;
+import examples.shop.logic.Catalog;
+
+/**
+ * This catalog Stateless Session Bean retrieves a list of productitems.
+ * ProductItem has product Id, name of the product and description
+ */
+@Stateless
+@Remote(Catalog.class)
+public class CatalogBean implements Catalog {
+
+ @PersistenceContext
+ private EntityManager manager;
+
+ public CatalogBean() {
+ }
+
+ public Product getProduct(String productId) {
+ return manager.find(Product.class, productId);
+ }
+
+ public List<Product> getProductList() {
+ /* find all products */
+ return manager.createQuery("SELECT p FROM Product p")
+ .getResultList();
+ }
+
+ public void addProduct(Product product) {
+ manager.persist(product);
+ }
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/PricerBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/PricerBean.java
new file mode 100644
index 0000000..cbcb73f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/PricerBean.java
@@ -0,0 +1,138 @@
+package examples.shop.impl.session;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+import examples.shop.impl.entity.Customer;
+import examples.shop.impl.entity.LineItem;
+import examples.shop.logic.Pricer;
+import examples.shop.logic.UserManager;
+
+/**
+ * Stateless Session Bean which computes prices based
+ * upon a set of pricing rules. The pricing rules are
+ * deployed with the bean as environment properties.
+ */
+@Stateless
+@Remote(Pricer.class)
+@WebService(serviceName="PricerService", portName="PricerPort")
+public class PricerBean implements Pricer {
+
+ @Resource(name="taxRate")
+ public int taxRate = 0;
+
+ @Resource(name="bulkDiscountRate")
+ public int bulkDiscountRate = 0;
+
+ @EJB
+ UserManager userManager;
+
+ public PricerBean() {
+ }
+
+ /**
+ * bulk discounts apply to quantities of BULK or more items
+ */
+ private static final int BULK = 5;
+
+ /**
+ * This method computes the applicable discount in absolute
+ * figure, based on bulk and personal discounts that may apply.
+ *
+ * @param quantity the number of items that a user intends to buy
+ * @param basePrice the overall, non-discounted volume of the
+ * purchase (individual price times quantity)
+ * @param the user name
+ * @return the subTotal for the line item after applying any
+ * applicable discounts, excluding taxes
+ */
+ public double getDiscount(int quantity, double basePrice, String user) {
+ double discountRate = getPersonalDiscountRate(user);
+ if (quantity >= BULK) {
+ discountRate += getBulkDiscountRate();
+ System.out.println("Using getBulkDiscountRate " + getBulkDiscountRate());
+ }
+
+ /*
+ * Calculate the discount in absolute figures
+ */
+ return basePrice * (discountRate / 100);
+ }
+
+ /**
+ * A bulk discount applies to quantities of more than 5 pieces.
+ * @return the bulk discount rate int percent
+ */
+ public double getBulkDiscountRate() {
+ return this.bulkDiscountRate;
+ }
+
+ /**
+ * Customers with certain names get discounts. The discount rules
+ * are stored in the environment properties that the bean is
+ * deployed with.
+ */
+ public double getPersonalDiscountRate(String userName) {
+ /*
+ * Get the name of this customer.
+ */
+ Customer user = userManager.getUser(userName);
+ if( user != null)
+ return user.getDiscount();
+ else
+ return 0;
+ }
+
+ /**
+ * Computes the subtotal price for a set of products the customer
+ * is interested in. The subtotal takes into account the price of
+ * each product the customer wants, the quantity of each product,
+ * and any personal discounts the customer gets. However, the
+ * subtotal ignores taxes.
+ *
+ * @param quote All the data needed to compute the
+ * subtotal is in this parameter.
+ */
+ public double priceSubtotal(String user, List<LineItem> items) {
+ System.out.println("PricerBean.priceSubtotal() called");
+
+ /*
+ * Compute the subtotal
+ */
+ double subTotal = 0;
+
+ for(Iterator<LineItem> iter = items.iterator(); iter.hasNext(); ) {
+ LineItem item = iter.next();
+ item.setDiscount(
+ getDiscount(item.getQuantity(), item.basePrice(),user));
+
+ /*
+ * Add the price to the subtotal.
+ */
+ subTotal += (item.basePrice() - item.getDiscount());
+ }
+
+ return subTotal;
+ }
+
+ /**
+ * Computes the taxes on a quote.
+ */
+ public double priceTaxes(double subtotal) {
+ System.out.println("PricerBean.priceTaxes() called, taxes: " + getTaxRate());
+ return (getTaxRate() / 100) * subtotal;
+ }
+
+ /**
+ * @return the applicable tax rate
+ */
+ public double getTaxRate() {
+ return taxRate;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/UserManagerBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/UserManagerBean.java
new file mode 100644
index 0000000..babb67e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/impl/session/UserManagerBean.java
@@ -0,0 +1,86 @@
+package examples.shop.impl.session;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import examples.shop.impl.entity.Customer;
+import examples.shop.logic.InvalidPasswordException;
+import examples.shop.logic.UserManager;
+
+/**
+ * UserManager is Stateless session bean resposible for creating and
+ * retrieving a customer record. It also authenticates the user.
+ */
+
+@Stateless
+@Remote(UserManager.class)
+public class UserManagerBean implements UserManager {
+
+ @PersistenceContext
+ EntityManager manager;
+
+ public UserManagerBean() {
+ }
+
+ /**
+ * Returns an customer object for the given customer id.
+ */
+ public Customer getUser(String customerId) {
+ return manager.find(Customer.class, customerId);
+ }
+
+ /**
+ * It uses the customer entity bean to create a record in the databse
+ * @param customerId
+ * @param name
+ * @param password
+ * @param address
+ */
+
+ public Customer createUser(String customerId, String name, String password, String address) {
+ Customer customer = new Customer();
+ customer.init(customerId, name, password, address);
+ manager.persist(customer);
+ return customer;
+ }
+
+ /**
+ * This method authenticates the user
+ *
+ * @return true, if the password is correct
+ * @throws an InvalidPasswordException if password is incorrect.
+ */
+
+ public boolean validateUser(String customerID, String password)
+ throws InvalidPasswordException {
+ if(customerID== null || password == null)
+ throw new IllegalArgumentException("id " + customerID + " pw " + password);
+ Customer user = getUser(customerID);
+ if (user != null && password.equals(user.getPassword())) {
+ return true;
+ } else {
+ System.out.println("Failure to validate user ID " + customerID
+ + " with password " + password + " against password "
+ + user.getPassword());
+
+ throw new InvalidPasswordException("Invalid Password:"
+ + password);
+ }
+ }
+
+ public List<Customer> findAllCustomers() {
+ return manager.createQuery("SELECT c FROM Customer c").getResultList();
+ }
+
+ public void removeAllCustomers() {
+ List l = manager.createQuery("SELECT c FROM Customer c ").getResultList();
+ for(Iterator iter = l.iterator(); iter.hasNext();) {
+ manager.remove(iter.next());
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Cart.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Cart.java
new file mode 100644
index 0000000..b636de2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Cart.java
@@ -0,0 +1,81 @@
+package examples.shop.logic;
+
+import java.util.List;
+
+import examples.shop.impl.entity.LineItem;
+
+/**
+ * The Cart interface.
+ */
+public interface Cart {
+
+ /**
+ * Adds an item to the shopping cart
+ */
+ public void add(LineItem lineItem);
+
+ /**
+ * Changes the quantities of contents in the shopping cart
+ */
+ public void modify(String productID, int quantity)
+ throws Exception;
+
+ /**
+ * Returns all the shopping cart line items
+ *
+ * @return A collection of Cart LineItems
+ */
+ public List<LineItem> getAll();
+
+ /**
+ * Empties the shopping cart
+ */
+ public void clear();
+
+ /**
+ * Get/set methods for the shopping cart owner's name
+ */
+ public String getOwner();
+
+ public void setOwner(String owner);
+
+ /**
+ * Purchases this cart. The cart will create an order in the database.
+ *
+ * @return The Order confirmation number
+ */
+ public String purchase();
+
+ /**
+ * Returns the subtotal price which has been previously set by
+ * setSubtotal().
+ *
+ * @return the subtotal of this cart items.
+ */
+ public double getSubtotal();
+
+ /**
+ * Sets the subtotal price. Our external pricer bean is responsible for
+ * calculating the subtotal. It calculates it based upon customer discounts
+ * (and can be extended to include other rules as well).
+ */
+ public void setSubtotal(double subTotal);
+
+ /**
+ * Returns the taxes for this Quote.
+ */
+ public double getTaxes();
+
+ /**
+ * Sets the taxes for this Quote.
+ */
+ public void setTaxes(double taxes);
+
+ /**
+ * Returns the total price. Total Price is computed from: 1) Subtotal price
+ * 2) Tax
+ */
+ public double getTotalPrice();
+
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Catalog.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Catalog.java
new file mode 100644
index 0000000..32310fd
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Catalog.java
@@ -0,0 +1,31 @@
+package examples.shop.logic;
+
+import java.util.*;
+
+import examples.shop.impl.entity.Product;
+
+/**
+ * This is the Catalog business interface.
+ */
+
+public interface Catalog {
+
+ /**
+ * @return a vector of Products
+ */
+ public List<Product> getProductList();
+
+ /**
+ * @return a Product for the given product id.
+ */
+ public Product getProduct(String productId);
+
+ /**
+ * Add a new product to the catalog
+ * @param product
+ */
+ public void addProduct(Product product);
+
+}
+
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidLoginNameException.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidLoginNameException.java
new file mode 100644
index 0000000..4583f48
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidLoginNameException.java
@@ -0,0 +1,19 @@
+package examples.shop.logic;
+
+/**
+ * Exceptions thrown by usermanager
+ */
+public class InvalidLoginNameException extends Exception {
+
+ public InvalidLoginNameException() {
+ super();
+ }
+
+ public InvalidLoginNameException(Exception e) {
+ super(e.toString());
+ }
+
+ public InvalidLoginNameException(String s) {
+ super(s);
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidPasswordException.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidPasswordException.java
new file mode 100644
index 0000000..5d0db3c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/InvalidPasswordException.java
@@ -0,0 +1,19 @@
+package examples.shop.logic;
+
+/**
+ * Exceptions thrown by usermanager
+ */
+public class InvalidPasswordException extends Exception {
+
+ public InvalidPasswordException() {
+ super();
+ }
+
+ public InvalidPasswordException(Exception e) {
+ super(e.toString());
+ }
+
+ public InvalidPasswordException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/OrderException.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/OrderException.java
new file mode 100644
index 0000000..bd08de0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/OrderException.java
@@ -0,0 +1,19 @@
+package examples.shop.logic;
+
+/**
+ * Exceptions thrown by Order
+ */
+public class OrderException extends Exception {
+
+ public OrderException() {
+ super();
+ }
+
+ public OrderException(Exception e) {
+ super(e.toString());
+ }
+
+ public OrderException(String s) {
+ super(s);
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Pricer.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Pricer.java
new file mode 100644
index 0000000..5c10b41
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/Pricer.java
@@ -0,0 +1,50 @@
+package examples.shop.logic;
+
+import java.util.List;
+
+import examples.shop.impl.entity.LineItem;
+
+/**
+ * These are the business logic methods exposed publicly by the
+ * Pricer component, a function that computes a price for a
+ * given user and base price.
+ */
+
+public interface Pricer {
+ /**
+ * Computes the price of a set of goods
+ */
+
+ public double priceSubtotal(String user, List<LineItem> items);
+
+ public double priceTaxes(double subtotal);
+
+ /**
+ * @return the applicable tax rate
+ */
+ double getTaxRate();
+
+ /**
+ * @return the current discount rate for buying lots of items
+ */
+ double getBulkDiscountRate();
+
+ /**
+ * @return the discount rate for a given user in percent
+ */
+ double getPersonalDiscountRate(String userName);
+
+ /**
+ * This method computes the applicable discount in absolute
+ * figure, based on bulk and personal discounts that may apply.
+ *
+ * @param quantity the number of items that a user intends to buy
+ * @param basePrice the overall, non-discounted volume of the
+ * purchase (individual price times quantity)
+ * @param the user name
+ * @return the subTotal for the line item after applying any
+ * applicable discounts, excluding taxes
+ */
+ double getDiscount(int quantity, double basePrice, String user);
+
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/PricerException.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/PricerException.java
new file mode 100644
index 0000000..e198a6a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/PricerException.java
@@ -0,0 +1,19 @@
+package examples.shop.logic;
+
+/**
+ * Exceptions thrown by Pricer
+ */
+public class PricerException extends Exception {
+
+ public PricerException() {
+ super();
+ }
+
+ public PricerException(Exception e) {
+ super(e.toString());
+ }
+
+ public PricerException(String s) {
+ super(s);
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/UserManager.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/UserManager.java
new file mode 100644
index 0000000..f34575d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/logic/UserManager.java
@@ -0,0 +1,38 @@
+package examples.shop.logic;
+
+import java.util.List;
+
+import examples.shop.impl.entity.Customer;
+
+/**
+ * This is the UserManager interface.
+ */
+public interface UserManager {
+
+ /**
+ * It uses the customer entity bean to crate a record in the databse
+ */
+ public Customer createUser(String customerId, String name, String password,
+ String address);
+
+ /**
+ * Returns an user object for the given customer id. It uses customer entity
+ * bean to retrieve the user record.
+ */
+ public Customer getUser(String customerId);
+
+ /**
+ * Authenticate the user.
+ */
+ public boolean validateUser(String login, String password)
+ throws InvalidPasswordException;
+
+ /**
+ * Demo lookup
+ *
+ * @return
+ */
+ public List<Customer> findAllCustomers();
+
+ public void removeAllCustomers();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp
new file mode 100644
index 0000000..92ccf8d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/catalog.jsp
@@ -0,0 +1,44 @@
+<%-- This JSP Retrieves products vector from HttpSession and displays in table format.
+ The product details includes name the product and its base price. User can view the
+ product details by clicking on name of the product. User can also add a product to
+ the shopping cart by clicking on add to cart link. When user clicks on add to cart
+ link, item is added to the cart and displays same at the bottom of the screen.
+
+--%>
+<%@ page import="examples.shop.impl.entity.Product" %>
+<html>
+ <head><title> Jasmine's Catalog page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <h3><A HREF="/jasmine/showQuote">View Current Shopping Cart</A></h3>
+ <h3>Please choose from our selections</h3>
+ <center><table>
+ <%
+ //Retrieves catalog vector from HTTPSession and displays product item details in a table format
+ session = request.getSession(false);
+ java.util.Vector products=(java.util.Vector)session.getAttribute("products");
+ int size=products.size();
+ Product item=null;
+ for(int i=0; i<size;i++){
+ item=(Product)products.elementAt(i);
+ %>
+ <tr>
+ <td bgcolor="#ffffaa"><a href="/jasmine/catalog?productId=<%=item.getProductID()%>"><b><%=item.getName()%><b></td>
+ <td align="right" bgcolor="#ffffaa"><%=item.getBasePrice()%></td>
+ <td bgcolor="#ffffaa"> <A HREF="/jasmine/catalog?Buy=<%=item.getProductID()%>"> Add to Cart</A></td>
+ </tr>
+ <%}%>
+ </table></center>
+ <P>
+ <%
+ // Displays the name of the product item added to the cart, at the bottom of the page.
+ String productName = (String) request.getAttribute("ProductPurchased");
+ if (productName != null) {
+ %>
+ <i> <%=productName%></i> has been added to your shopping cart.
+ <% } %>
+
+ <jsp:include page="footer.jsp" />
+
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp
new file mode 100644
index 0000000..0c13d29
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/clearQuote.jsp
@@ -0,0 +1,15 @@
+<%-- When user clicks on clear cart button, servlet forwards request to this jsp --%>
+<html>
+ <head><title>Jasmine's Clear Cart page</title></head>
+
+ <BODY>
+ <jsp:include page="title.jsp" />
+ <font size="+2"><strong>You just cleared your Cart!</strong></font>
+ <br>&nbsp;
+ <br>
+ <center>
+ <a href="/jasmine/wsf.jsp">Back to the main page</a>
+ </center>
+ <jsp:include page="footer.jsp" />
+ </BODY>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp
new file mode 100644
index 0000000..f0779bd
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/emptyQuote.jsp
@@ -0,0 +1,15 @@
+<%-- If shopping cart is empty and user clicks on shopping cart link, servlet forwards request to this jsp --%>
+<html>
+ <head><title> Jasmine's Empty Cart page</title></head>
+ <BODY>
+ <jsp:include page="title.jsp" />
+ <font size="+2">Your Cart is empty.</font>
+ <br>&nbsp;
+ <br>
+ <center>
+ <a href="/jasmine/wsf.jsp">Back to the web storefront.</a>
+ </center>
+ <jsp:include page="footer.jsp" />
+
+ </BODY>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp
new file mode 100644
index 0000000..47aaca8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/error.jsp
@@ -0,0 +1,11 @@
+<%-- JSP container forwards request to this jsp, if any exceptions in processing --%>
+<html>
+ <head><title> Jasmine's Error page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <p>Error in processing your request.
+ <p>Please contact System Administrator
+ <p><i><a href="/jasmine/wsf.jsp">Click here to return to the main page.</a></i>
+ </body>
+</html>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp
new file mode 100644
index 0000000..2df4e29
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/footer.jsp
@@ -0,0 +1,5 @@
+<%-- Diplays Footer --%>
+<hr>
+<i>&copy; 2004-2006, Jasmine's Computer Parts, Inc., All rights reserved.</i>
+<br>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp
new file mode 100644
index 0000000..8d773b3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/login.jsp
@@ -0,0 +1,70 @@
+<%--
+ This JSP displays a login screen. When the user fills out the login
+ screen, it will submit it to the Login Servlet, which will verify the
+ user's credentials by calling EJB components.
+
+ If the verification is unsuccessful, the login servlet will return
+ the user to this page to re-enter his credentials.
+
+ If the verification is successful, Jasmine's main page will be displayed.
+--%>
+
+<html>
+<head>
+ <title>Jasmine's Login page </title>
+</head>
+
+<body>
+
+<%-- Include the title, which is "Jasmine's Computer Parts"--%>
+<jsp:include page="title.jsp" />
+
+<%-- Indicate the error page to use if an error occurs --%>
+<jsp:directive.page errorPage="error.jsp" />
+
+<%-- Display the login form --%>
+<h4>Please enter login information</h4>
+<p>
+<form action="/jasmine/login" method="get">
+ <table>
+ <tr>
+ <td><b>Name:</b></td>
+ <td>
+ <input type="text" name="Login" size="19"/>
+ </td>
+ </tr>
+ <tr>
+ <td><b>Password:</b></td>
+ <td>
+ <input type="text" name="Password" size="19"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="Submit Information"/>
+ <input type="submit" value="Register"/>
+ </td>
+ </tr>
+ </table>
+</form>
+
+<%
+ // get whether the person logged in successfully
+ Boolean failed = (Boolean) request.getAttribute("loginFailed");
+ if (failed != null) {
+ if (failed.booleanValue() == true) {
+%>
+ <p>
+ <strong>Could not log in! Please try again.</strong>
+ <p>
+<%
+ }
+ }
+%>
+
+<%-- Include the page footer --%>
+<jsp:include page="footer.jsp" />
+
+</body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp
new file mode 100644
index 0000000..e18ea8a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/productInfo.jsp
@@ -0,0 +1,32 @@
+<%--This JSP displays details of the selected product.
+ Customer can add this item to the shopping cart by clicking on add to cart link.
+ Customer has provision to navigate to the catalog as well as to the shopping cart pages.
+ --%>
+<%@ page import="examples.shop.impl.entity.Product" %>
+
+<html>
+ <head><title> Jasmine's Product Info page</title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+
+ <%
+ //Retrieves the productItem from request object and displays.
+ Product item=(Product)request.getAttribute("productItem");
+ %>
+
+ <b><%=item.getName()%><b>
+ <h4> Description:</h4>
+ <%=item.getDescription()%>
+ <h4>Base price (before discounts):<%=item.getBasePrice()%></h4>
+
+ <center>
+ <A href="/jasmine/catalog?Buy=<%=item.getProductID()%>">Add this item to Cart</A><br>
+ <A href="/jasmine/catalog">See the Catalog</A><br>
+ <A href="/jasmine/showQuote">View Current Shopping Cart</A>
+
+ <jsp:include page="footer.jsp" />
+
+ </center>
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp
new file mode 100644
index 0000000..448a26b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/receipt.jsp
@@ -0,0 +1,19 @@
+<%--This JSP displays order confirmation. When user clicks on order button,
+ Order will be created in the database and order confirmation number will be
+ displayed to the customer.
+ --%>
+<html>
+ <head><title> Jasmine's Order Confirmation page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+ <%-- Retrieves Order Id from request object and displays.--%>
+ <h3>Thank you for shopping with us.
+ <p>Your order number is <%=request.getAttribute("orderID")%>
+ <p>Please shop with us again soon!
+ </h3>
+ <p><i><a href="/jasmine/wsf.jsp">Click here to return to the main page.</a></i>
+ <jsp:include page="footer.jsp" />
+ </body>
+</html>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp
new file mode 100644
index 0000000..d01abbb
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/showQuote.jsp
@@ -0,0 +1,87 @@
+<%--
+ This JSP displays details of the products added to the cart.
+ The details includes the name of the product, quantity, base price,
+ discount and total price of each line item. It also displays subtotal,
+ taxes and grand total of the entire cart. Customer has provision to
+ modify the quantities, order the contents and clear the cart.
+
+--%>
+<HTML>
+ <head><title> Jasmine's Shopping Cart page </title></head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+ <%@ page import="examples.shop.impl.entity.Product" %>
+ <%@ page import="examples.shop.impl.entity.LineItem" %>
+ <%@ page import="java.util.List" %>
+ <%@ page import="java.util.Iterator" %>
+ <%@ page import="java.text.NumberFormat" %>
+ <form action="/jasmine/showQuote" method="get">
+ <center><table>
+ <tr>
+ <th align=left> Name </TH>
+ <th align=left> Quantity </TH>
+ <th align=left> Individual Base Price </TH>
+ <th align=left> Discount </TH>
+ <th align=left><strong> Total Price </strong></TH>
+ </tr>
+ <%
+ // get the lineItems from the request object and displays in a table format.
+ List<LineItem> lineItems = (List<LineItem>)request.getAttribute("lineItems");
+ double subTotal=((Double)request.getAttribute("subTotal")).doubleValue();
+ double taxes=((Double)request.getAttribute("taxes")).doubleValue();
+ double taxRate=((Double)request.getAttribute("taxRate")).doubleValue();
+ double total=((Double)request.getAttribute("total")).doubleValue();
+
+ for(Iterator<LineItem> iter = lineItems.iterator(); iter.hasNext();) {
+ LineItem li = iter.next();
+ int quantity = li.getQuantity();
+ double discount = li.getDiscount();
+ Product product = li.getProduct();
+ String productID = product.getProductID();
+ double basePrice = product.getBasePrice();
+ %>
+ <tr>
+ <td bgcolor="#ffffaa"><a href="/jasmine/catalog?productId=<%=product.getProductID()%>"><b><%=product.getName()%><b></td>
+ <td><input type="text" name="<%=productID%>" value="<%=quantity%>"></td>
+ <td bgcolor="#ffffaa" align="right"><%=basePrice%></td>
+ <td bgcolor="#ffffaa" align="right"><%=discount%></td>
+ <td bgcolor="#ffffaa" align="right"><%=basePrice*quantity-discount%></td>
+
+ </tr>
+ <% } %>
+ </table></center>
+ <br>
+ <center><table>
+ <tr>
+ <td colspan="2" align="right" bgcolor="#ffffff"> Subtotal:</td>
+ <td bgcolor="#ffffaa" align="right"><%=subTotal%></td>
+ <td> <br></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right" bgcolor="#ffffff">Sales Tax: </td>
+ <td bgcolor="#ffffaa" align="right"><%=taxes%></td><td align="right">(<%=taxRate%>)%</td>
+ <td><br></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right" bgcolor="ffffff"> <font color="ff0000"> <strong>Grand Total:</strong></font> </td>
+ <td bgcolor="#ffffaa" align="right"><%=total%></td>
+ <td><br></td>
+ </tr>
+ </table></center>
+ <!--
+ Print out links and buttons for user feedback.
+ When the customer clicks a button to perform an
+ action (such as submitting an order), sends request to
+ the servlet with necessary parameters to process the request.
+ //-->
+ <p>
+ <A href="/jasmine/catalog">See the Catalog</A>
+ <input type="submit" name="Update" value="Update Quantities"> &nbsp; &nbsp; &nbsp;
+ <input type="submit" name="Order" value="Submit Order"> &nbsp; &nbsp; &nbsp;
+ <input type="submit" name="Clear" value="Clear Cart"> &nbsp; &nbsp; &nbsp;
+
+ <jsp:include page="footer.jsp" />
+ </form>
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp
new file mode 100644
index 0000000..afaaea1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/title.jsp
@@ -0,0 +1,8 @@
+<%-- Diplays title --%>
+<hr>
+<p>
+ <center>
+ <h1>Jasmine's Computer Parts</h1>
+ </center>
+</p>
+<hr> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp
new file mode 100644
index 0000000..de589f1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/jsp/wsf.jsp
@@ -0,0 +1,22 @@
+<%--
+ This JSP page displays Jasmine's main screen.
+ Customers can navigate to the catalog as well as
+ to the shopping cart page.
+--%>
+
+<html>
+ <head>
+ <title>Jasmine's Main page</title>
+ </head>
+ <body>
+ <jsp:include page="title.jsp" />
+ <jsp:directive.page errorPage="error.jsp" />
+
+ <h3><A href="/jasmine/catalog"><b>Catalog</b></A></h3>
+ <h4><p> Choose from our excellent selection of computer parts.</p><br></h4>
+ <h3><A href="/jasmine/showQuote"><b>Shopping Cart</b></A></h3>
+ <h4><p> Look at your shopping cart to see the equipment you've chosen.</p></h4>
+
+ <jsp:include page="footer.jsp" />
+ </body>
+</html>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/CatalogServlet.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/CatalogServlet.java
new file mode 100644
index 0000000..1a0049a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/CatalogServlet.java
@@ -0,0 +1,167 @@
+package examples.shop.web.servlet;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import examples.shop.impl.entity.LineItem;
+import examples.shop.impl.entity.Product;
+import examples.shop.logic.Cart;
+import examples.shop.logic.Catalog;
+
+/**
+ * This servlet displays a catalog of products to
+ * the end-user.
+ *
+ * By the time this servlet is called, the user has
+ * logged in (via the Login servlet), and has a shopping
+ * cart started (i.e. Cart bean). Since this servlet is
+ * pooled and re-used for different user requests, the
+ * servlet code does not store any information specific to
+ * any user. Rather, we store a reference to the user's
+ * Cart in the user's HttpSession object, which is
+ * globally accessible to all servlets.
+ */
+public class CatalogServlet extends HttpServlet {
+
+ public Catalog catalog;
+
+ /**
+ * The servlet engine calls this method once to
+ * initialize a servlet instance.
+ */
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ try {
+ Context ctx = new InitialContext();
+ catalog = (Catalog)ctx.lookup(Catalog.class.getName());
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * The servlet engine calls this method when the user's
+ * desktop browser sends an HTTP request.
+ */
+ public void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ List<Product> products = null;
+ try {
+ /*
+ * Get the user's HttpSession, and from that get
+ * the user's current cart.
+ */
+ HttpSession session = request.getSession(false);
+ if (session == null) {
+ /*
+ * Redirect user to login page if he
+ * doesn't have a session.
+ */
+ response.sendRedirect(response
+ .encodeRedirectURL("/jasmine/login"));
+ return;
+ }
+
+ Object obj = session.getAttribute("cart");
+ if (obj == null) {
+ /*
+ * Redirect user to login page if he
+ * doesn't have a session.
+ */
+ response.sendRedirect(response
+ .encodeRedirectURL("/jasmine/login"));
+ return;
+ }
+ Cart cart = (Cart) obj;
+ String productIDToAdd = request.getParameter("Buy");
+ products = (Vector) session.getAttribute("products");
+ String productId = (String) request.getParameter("productId");
+
+ /*
+ * If user wants to purchase something (via
+ * the URL parameter 'Buy'), add the desired
+ * product item to the cart.
+ */
+
+ if (productIDToAdd != null) {
+ /*
+ * Creates LineItem, and add to the cart.
+ */
+ try {
+ Product item = getProductItem(products, productIDToAdd);
+ cart.add(new LineItem(item, 1, 0));
+ // Set a flag so that JSP knows which product we purchased
+ request.setAttribute("ProductPurchased", item.getName());
+ // Forwards the request to the catalog JSP
+ this.getServletContext().getRequestDispatcher(
+ "/catalog.jsp").forward(request, response);
+ return;
+ } catch (Exception e) {
+ throw new ServletException(e.toString());
+ }
+ }
+ /*
+ * If user wants to view the product details (via
+ * the URL parameter 'productId')
+ */
+ else if (productId != null) {
+ //Retrieves the product item from the prducts vector and pass it in request object.
+ request.setAttribute("productItem", getProductItem(products,
+ productId));
+ // Forwards the request to the productInfo JSP
+ this.getServletContext().getRequestDispatcher(
+ "/productInfo.jsp").forward(request, response);
+ return;
+ }
+ /*
+ * If products vector = null,Retrieves productItems vector
+ * from Catalog stateless session bean and put it in the
+ * HttpSession. we may need to put this vector in
+ * application level instead of session.
+ */
+ else {
+ if (products == null) {
+ products = catalog.getProductList();
+ session.setAttribute("products", products);
+ }
+ // Forwards the request to the catalog JSP
+ this.getServletContext().getRequestDispatcher("/catalog.jsp")
+ .forward(request, response);
+ return;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Returns the product for the given product id, if it is in the vector
+ */
+
+ private Product getProductItem(List<Product> products, String productIDToAdd) {
+ for (Iterator<Product> iter = products.iterator(); iter.hasNext();) {
+ Product item = iter.next();
+ if (item.getProductID().equals(productIDToAdd)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ public String getServletInfo() {
+ return "The Catalog servlet adds products to the user's "
+ + "cart and prints the catalog.";
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/LoginServlet.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/LoginServlet.java
new file mode 100644
index 0000000..0340fd9
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/LoginServlet.java
@@ -0,0 +1,166 @@
+package examples.shop.web.servlet;
+
+import java.io.IOException;
+
+import javax.ejb.EJB;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import examples.shop.logic.Cart;
+import examples.shop.logic.UserManager;
+
+/**
+ * This is the very first servlet the client deals with. It's a Login
+ * authentication servlet and asks the user for his name and password,
+ * and pass it to the UserManager stateless session bean for verificatiion.
+ *
+ * If the user authenticates properly, a reference to a new Cart is saved
+ * in his HttpSession object, and the user can begin to add items to his
+ * cart and shop around.
+ */
+public class LoginServlet extends HttpServlet {
+
+ /** the user manager used to authenticate the user */
+ @EJB
+ UserManager userManager;
+
+ /** the user's cart object */
+ @EJB
+ Cart cart;
+
+ /**
+ * The servlet engine calls this method once to initialize a servlet
+ * instance.
+ */
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ try {
+ /*
+ * Get the initial context using the above startup params.
+ */
+
+ Context ctx = new InitialContext();
+ userManager = (UserManager) ctx.lookup(UserManager.class
+ .getName());
+ cart = (Cart) ctx.lookup(Cart.class.getName());
+
+ } catch (Exception e) {
+ log(e);
+ throw new ServletException(e.toString());
+ }
+ }
+
+ /**
+ * The servlet engine calls this method when the user's desktop browser
+ * sends an HTTP request.
+ */
+ public void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ /*
+ * Set up the user's HttpSession
+ */
+ HttpSession session = request.getSession(true);
+
+ System.out.println(request.getAttributeNames().toString());
+ /*
+ * Retrieve the login name / password from the URL string.
+ */
+ String loginName = request.getParameter("Login");
+ String password = request.getParameter("Password");
+ boolean isLogin = false;
+
+ /*
+ * If user has not tried to log in yet, present him with the login
+ * screen.
+ */
+ if ((loginName == null) || (password == null)) {
+ writeForm(request, response, false);
+ return;
+ } else {
+ /*
+ * Otherwise, the user has been to this screen already, and has
+ * entered some information. Verify that information.
+ */
+ try {
+ isLogin = userManager.validateUser(loginName, password);
+ } catch (Exception e) {
+ writeForm(request, response, true);
+ e.printStackTrace();
+ return;
+ }
+ /*
+ * If the passwords match, make a new Cart Session Bean, and add it
+ * to the user's HttpSession object. When the user navigates to
+ * other servlets, the other servlets can access the HttpSession to
+ * get the user's Cart.
+ */
+ if (isLogin) {
+ try {
+ cart.setOwner(loginName);
+ cart.clear();
+ session.setAttribute("cart", cart);
+
+ /*
+ * Call the main page
+ */
+ RequestDispatcher disp = this.getServletContext()
+ .getRequestDispatcher("/wsf.jsp");
+ disp.forward(request, response);
+
+ return;
+ } catch (Exception e) {
+ log(e);
+ throw new ServletException(e.toString());
+ }
+ } else
+ writeForm(request, response, true);
+ }
+
+ /*
+ * If there was no match, the user is not authenticated. Present another
+ * login screen to him, with an error message indicating that he is not
+ * authenticated.
+ */
+ writeForm(request, response, true);
+ }
+
+ /**
+ * Writes the Login Screen (private use only)
+ *
+ * @param showError
+ * true means show an error b/c client was not authenticated last
+ * time.
+ */
+ private void writeForm(HttpServletRequest request,
+ HttpServletResponse response, boolean showError)
+ throws ServletException, IOException {
+
+ /*
+ * Set a variable indicating whether or not we failed to log-in. The JSP
+ * will read this variable.
+ */
+ request.setAttribute("loginFailed", new Boolean(showError));
+
+ /*
+ * Forward the request to the login JSP
+ */
+ RequestDispatcher disp = this.getServletContext().getRequestDispatcher(
+ "/login.jsp");
+ disp.forward(request, response);
+ }
+
+ private void log(Exception e) {
+ e.printStackTrace();
+ }
+
+ public String getServletInfo() {
+ return "The Login servlet verifies a user.";
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/ShowQuoteServlet.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/ShowQuoteServlet.java
new file mode 100644
index 0000000..d4449d4
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/shop/web/servlet/ShowQuoteServlet.java
@@ -0,0 +1,200 @@
+package examples.shop.web.servlet;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import examples.shop.impl.entity.LineItem;
+import examples.shop.logic.Cart;
+import examples.shop.logic.Pricer;
+
+/**
+ * This servlet allows the user to view and modify his current selections.
+ *
+ * By the time this servlet is called, the user has logged in (via the Login
+ * servlet), and has a shopping cart started (i.e. cart bean). Since this
+ * servlet is pooled and re-used for different user requests, the servlet code
+ * does not store any information specific to any user. Rather, we store a
+ * reference to the user's cart in the user's HttpSession object, which is
+ * globally accessible to all servlets.
+ */
+public class ShowQuoteServlet extends HttpServlet {
+
+ // Pricer for pricing the cart
+ private Pricer pricer;
+
+ /**
+ * The servlet engine calls this method once to initialize a servlet
+ * instance.
+ *
+ * In the body of this method, we need to acquire a Pricer EJB Object for
+ * pricing the carts.
+ */
+ public void init(ServletConfig config) throws ServletException {
+ /*
+ * Call parent to store the config object, so that getServletConfig()
+ * can return it.
+ */
+ super.init(config);
+ try {
+ Context ctx = new InitialContext();
+ pricer = (Pricer)ctx.lookup(Pricer.class.getName());
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * The servlet engine calls this method when the user's desktop browser
+ * sends an HTTP GET request.
+ */
+ public void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ /*
+ * Get the user's HttpSession, and from that get the user's current
+ * cart.
+ */
+ HttpSession session = request.getSession(false);
+ if (session == null) {
+ /*
+ * Redirect user to login page if no session
+ */
+ response.sendRedirect(response.encodeRedirectURL("/jasmine/login"));
+ return;
+ }
+
+ Object obj = session.getAttribute("cart");
+ if (obj == null) {
+ /*
+ * Redirect user to login page if no session
+ */
+ response.sendRedirect(response.encodeRedirectURL("/jasmine/login"));
+ return;
+ }
+
+ Cart cart = (Cart) obj;
+
+ /*
+ * If the user clicked the 'Order' button, he wants to purchase his
+ * selections. We forward the user to the servlet that handles
+ * purchasing.
+ */
+ if (request.getParameter("Order") != null) {
+ /*
+ * First, turn the cart into an order
+ */
+ String orderId = cart.purchase();
+ /*
+ * Stick the orderID in the request so the JSP gets it
+ */
+ request.setAttribute("orderID", orderId);
+ cart.clear();
+ this.getServletContext().getRequestDispatcher("/receipt.jsp")
+ .forward(request, response);
+ return;
+ }
+
+ /*
+ * Next, we need to figure out what button the user clicked, if any.
+ * These come to us as form parameters. We need to loop through each
+ * parameter and interpret it.
+ */
+ Enumeration paramNames = request.getParameterNames();
+ while (paramNames.hasMoreElements()) {
+ String paramName = (String) paramNames.nextElement();
+ String paramValue = request.getParameter(paramName);
+
+ /*
+ * If user clicked 'Update' button, then the user wants to change
+ * the quantities of each product he is ordering. We'll process
+ * those quantities below.
+ */
+ if (paramName.equals("Update")) {
+ } else if (paramName.equals("Clear")) {
+ /*
+ * The user wants to clear the form
+ */
+ cart.clear();
+ this.getServletContext()
+ .getRequestDispatcher("/clearQuote.jsp").forward(
+ request, response);
+ return;
+ } else {
+ /*
+ * If the parameter represents a quantity of a particular
+ * product the user is interested in, then we should update that
+ * product's quantity to reflect this new value.
+ */
+ try {
+ /*
+ * Convert the quantity to int format, and set the new
+ * quantity
+ */
+ int quantity = Integer.parseInt(paramValue);
+ cart.modify(paramName, quantity);
+ } catch (NumberFormatException e) {
+ throw new ServletException("Bad parameter to servlet: "
+ + paramName + ", " + paramValue);
+ } catch (Exception e) {
+ throw new ServletException(e.toString());
+ }
+ }
+ }
+
+ /*
+ * Recalculate all totals based upon new quantities
+ */
+ try {
+ cart.setSubtotal(pricer.priceSubtotal(cart.getOwner(), cart.getAll()));
+ cart.setTaxes(pricer.priceTaxes(cart.getSubtotal()));
+ } catch (Exception e) {
+ log(e);
+ throw new ServletException(e.toString());
+ }
+
+ /*
+ * Otherwise, show the current cart again
+ */
+ List<LineItem> lineItems = cart.getAll();
+ if (lineItems.size() > 0) {
+ /*
+ * Stick lineitems, subtotal, taxes and total in request
+ */
+ request.setAttribute("lineItems", lineItems);
+ request.setAttribute("subTotal", new Double(cart.getSubtotal()));
+ request.setAttribute("taxes", new Double(cart.getTaxes()));
+ request.setAttribute("taxRate", new Double(pricer.getTaxRate()));
+ request.setAttribute("total", new Double(cart.getTotalPrice()));
+ // Forwards the request to the showQuote JSP.
+ this.getServletContext().getRequestDispatcher("/showQuote.jsp")
+ .forward(request, response);
+ return;
+ } else {
+ /*
+ * If there are no products, print out that the cart is empty.
+ */
+ this.getServletContext().getRequestDispatcher("/emptyQuote.jsp")
+ .forward(request, response);
+ return;
+ }
+ }
+
+ private void log(Exception e) {
+ e.printStackTrace();
+ }
+
+ public String getServletInfo() {
+ return "The ShowQuote servlet returns information about"
+ + "the products that the user is in the process of ordering.";
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.classpath b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.classpath
new file mode 100644
index 0000000..c04aa4e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="C:/Java/glassfish.b48/lib/javaee.jar"/>
+ <classpathentry kind="lib" path="C:/Java/glassfish.b48/lib/appserv-rt.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.packaging b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.packaging
new file mode 100644
index 0000000..756c5b8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.packaging
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurations>
+<archive destination="" exploded="false" name="MasteringEJB.ejb3" used="true">
+<folder excludes="**/container/*Servlet.class" includes="**/container/*, **/interfaces/*, **/entity/**/*" location="bin" name="bin" prefix="" project="" projectLocation="bin" used="true"/>
+<file location="SupportFiles/persistence.xml" name="persistence.xml" prefix="META-INF" project="" projectLocation="SupportFiles/persistence.xml" used="true"/>
+</archive>
+<archive destination="" exploded="false" name="MasteringEJB.war" used="true">
+<file location="SupportFiles/web.xml" name="web.xml" prefix="WEB-INF" project="" projectLocation="SupportFiles/web.xml" used="true"/>
+<folder excludes="" includes="**/container/*Servlet.class" location="bin" name="bin" prefix="WEB-INF/classes" project="" projectLocation="bin" used="true"/>
+</archive>
+<archive destination="" exploded="false" name="PricerClient.jar" used="false">
+<file location="SupportFiles/PricerClient/MANIFEST.MF" name="MANIFEST.MF" prefix="META-INF" project="" projectLocation="SupportFiles/PricerClient/MANIFEST.MF" used="true"/>
+<folder excludes="" includes="**/PricerClient.class,**/interfaces/*" location="bin" name="bin" prefix="" project="" projectLocation="bin" used="true"/>
+<file location="SupportFiles/PricerClient/application-client.xml" name="application-client.xml" prefix="META-INF" project="" projectLocation="SupportFiles/PricerClient/application-client.xml" used="true"/>
+</archive>
+<archive destination="" exploded="false" name="MasteringEJB.ear" used="true">
+<file location="MasteringEJB.ejb3" name="MasteringEJB.ejb3" prefix="" project="" projectLocation="MasteringEJB.ejb3" used="true"/>
+<file location="SupportFiles/application.xml" name="application.xml" prefix="META-INF" project="" projectLocation="SupportFiles/application.xml" used="true"/>
+<file location="MasteringEJB.war" name="MasteringEJB.war" prefix="" project="" projectLocation="MasteringEJB.war" used="true"/>
+<file location="SupportFiles/sun-application.xml" name="sun-application.xml" prefix="META-INF" project="" projectLocation="SupportFiles/sun-application.xml" used="true"/>
+<file location="PricerClient.jar" name="PricerClient.jar" prefix="" project="" projectLocation="PricerClient.jar" used="false"/>
+<file location="SecurityExampleClient.jar" name="SecurityExampleClient.jar" prefix="" project="" projectLocation="SecurityExampleClient.jar" used="false"/>
+</archive>
+</configurations>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.project b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.project
new file mode 100644
index 0000000..195ed69
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>MasteringEJB</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.jboss.ide.eclipse.ejb3.wizards.core.EJB3ProjectNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.settings/org.eclipse.jdt.core.prefs b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..94b500d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sun Jan 01 11:53:29 EST 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.xdoclet b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.xdoclet
new file mode 100644
index 0000000..08e9ae2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/.xdoclet
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurations>
+<configuration name="web" used="true">
+<task name="webdoclet" used="true" className="xdoclet.modules.web.WebDocletTask">
+<attribute name="excludedTags" value="@version,@author,@todo" used="true"/>
+<attribute name="destDir" value="src" used="true"/>
+<attribute name="mergeDir" value="" used="false"/>
+<attribute name="force" value="" used="false"/>
+<attribute name="verbose" value="true" used="true"/>
+<attribute name="addedTags" value="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}" used="true"/>
+<attribute name="ignoredtags" value="" used="false"/>
+<attribute name="validating" value="" used="false"/>
+<element name="fileset" used="true">
+<attribute name="dir" value="src" used="true"/>
+<attribute name="includes" value="**/*.java" used="true"/>
+<attribute name="excludes" value="" used="false"/>
+</element>
+<element name="deploymentdescriptor" used="true">
+<attribute name="Servletspec" value="2.4" used="true"/>
+<attribute name="smallicon" value="" used="false"/>
+<attribute name="largeicon" value="" used="false"/>
+<attribute name="displayname" value="" used="false"/>
+<attribute name="description" value="" used="false"/>
+<attribute name="distributable" value="" used="false"/>
+<attribute name="sessiontimeout" value="" used="false"/>
+<attribute name="tagLibs" value="" used="false"/>
+<attribute name="welcomeFiles" value="" used="false"/>
+<attribute name="contextParams" value="" used="false"/>
+<attribute name="useIds" value="" used="false"/>
+<attribute name="xmlencoding" value="" used="false"/>
+<attribute name="schema" value="" used="false"/>
+<attribute name="validateXML" value="" used="false"/>
+<attribute name="acceptInterfaces" value="" used="false"/>
+<attribute name="acceptAbstractClasses" value="" used="false"/>
+<attribute name="packageSubstitutions" value="" used="false"/>
+<attribute name="packageSubstitutionInheritanceSupported" value="" used="false"/>
+<attribute name="subTaskClassName" value="" used="false"/>
+<attribute name="prefixWithPackageStructure" value="" used="false"/>
+<attribute name="destinationFile" value="" used="false"/>
+<attribute name="templateURL" value="" used="false"/>
+<attribute name="templateFile" value="" used="false"/>
+<attribute name="Extent" value="" used="false"/>
+<attribute name="havingClassTag" value="" used="false"/>
+<attribute name="ofType" value="" used="false"/>
+<attribute name="subTaskName" value="" used="false"/>
+<attribute name="destDir" value="SupportFiles" used="true"/>
+<attribute name="mergeDir" value="" used="false"/>
+<attribute name="currentMethodTag" value="" used="false"/>
+<attribute name="currentClassTag" value="" used="false"/>
+<attribute name="currentFieldTag" value="" used="false"/>
+<attribute name="currentPackage" value="" used="false"/>
+<attribute name="currentMethod" value="" used="false"/>
+<attribute name="currentConstructor" value="" used="false"/>
+<attribute name="currentField" value="" used="false"/>
+<attribute name="currentClass" value="" used="false"/>
+</element>
+</task>
+</configuration>
+</configurations>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/README b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/README
new file mode 100644
index 0000000..1990c66
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/README
@@ -0,0 +1,52 @@
+--------------------------------------------
+Building, deploying and running the examples
+--------------------------------------------
+1) Make sure you have a JDK 1.5.x installed,
+ a GlassFish v1 b.48 (or greater) installed,
+ and ANT installed.
+
+ See: https://glassfish.dev.java.net/
+ http://java.sun.com
+ http://ant.apache.org/
+
+2) Set the JAVA_HOME and GLASSFISH_HOME environment
+ appropriately.
+
+3) Setup Glassfish according to the installation
+ instructions.
+
+4) Start embedded Derby database and the Glassfish
+ app server.
+
+ cd <GLASSFISH_HOME>/bin
+ ./asadmin.bat start-database
+ ./asadmin.bat start-domain domain1
+
+5) Executing the following will build and deploy the
+ sample applications.
+
+ cd src/example/stateless
+ ant
+
+ cd src/examples/stateful
+ ant
+
+ cd src/examples/entity
+ ant
+
+ In each case, watch the GlassFish log to see that the applications
+ are deployed properly.
+
+6) Executing the following will run each of the sample clients to
+ exercise the samples applications.
+
+ cd src/examples/stateless
+ ant run
+
+ cd src/examples/stateful
+ ant run
+
+ cd src/examples/entity
+ ant run
+
+If you need help, please email Micah Silverman at: ejb3@MPowerIT.com
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/execClient.bat b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/execClient.bat
new file mode 100644
index 0000000..a4d7ac1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/execClient.bat
@@ -0,0 +1 @@
+java -cp .;..\..\..\glassfish.b48\lib\javaee.jar;..\..\..\glassfish.b48\lib\appserv-rt.jar;%*
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/jndi.properties b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/jndi.properties
new file mode 100644
index 0000000..483fac9
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/clientUtils/jndi.properties
@@ -0,0 +1,6 @@
+#java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+#java.naming.provider.url=corbaname:iiop:localhost:3700
+jndi.factory=com.sun.jndi.cosnaming.CNCtxFactory
+jndi.factory=com.sun.jndi.fscontext.RefFSContextFactory
+jndi.provider.url=corbaloc::localhost:3700/NameService
+#jndi.provider.url=file:c:
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.properties b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.properties
new file mode 100644
index 0000000..ddf8b69
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.properties
@@ -0,0 +1,32 @@
+#
+# Common properties, included by common.xml
+# Edit this file to reflect your environment.
+
+# local configuration parameters
+admin.password=adminadmin
+admin.host=localhost
+appserver.instance=server
+appserver.instance.port=8080
+admin.user=admin
+admin.port=4848
+domain.name=domain1
+
+#jndi.port=3700
+#jndi.factory=com.sun.jndi.cosnaming.CNCtxFactory
+#jndi.factory=com.sun.jndi.fscontext.RefFSContextFactory
+#jndi.provider.url=corbaloc::${admin.host}:${jndi.port}/NameService
+#jndi.provider.url=file:c:
+
+
+# The path seperator for the platform
+# Unix - :
+# Note for windows add the drive after the seperator
+# Windows - ;C:
+pathsep=;
+
+# The directory seperator for the platform
+# Unix - /
+# Windows - \
+#
+dirsep=/
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.xml
new file mode 100644
index 0000000..daf60ce
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/etc/common.xml
@@ -0,0 +1,100 @@
+<property file="${basedir}/etc/common.properties"/>
+<property environment="env"/>
+<property name="appserver.home" value="${env.GLASSFISH_HOME}"/>
+<property name="src.dir" value="${basedir}/src"/>
+<property name="build.dir" value="${basedir}/build"/>
+<property name="package.dir" value="${basedir}/package"/>
+<property name="support.dir" value="${basedir}/SupportFiles"/>
+<property name="temp.dir" value="${basedir}/temp"/>
+<property name="app.src.dir" value="${src.dir}/${app.pkg}"/>
+
+<target name="build.cpath">
+ <path id="appserver.lib">
+ <fileset dir="${appserver.home}/lib" includes="*.jar" />
+ </path>
+ <pathconvert pathsep=";" property="appserver.cpath" refid="appserver.lib"/>
+</target>
+
+<target name="init.common" depends="build.cpath">
+ <property name="build.classpath" value="${appserver.cpath}:${java.home}/../lib/tools.jar"/>
+</target>
+
+<target name="compile.common" depends="init.common">
+ <mkdir dir="${build.dir}/${app.name}"/>
+ <javac srcdir="${app.src.dir}" destdir="${build.dir}/${app.name}" classpath="${build.classpath}"/>
+</target>
+
+<target name="package.client" if="create.client">
+ <mkdir dir="${package.dir}/${app.name}"/>
+ <jar destfile="${package.dir}/${app.name}/${app.name}Client.jar">
+ <fileset dir="${build.dir}/${app.name}/">
+ <include name="**/client/**"/>
+ <include name="**/*.class"/>
+ <include name="**/interfaces/**"/>
+ <exclude name="**/*Bean.class"/>
+ <exclude name="**/container/**"/>
+ </fileset>
+ </jar>
+</target>
+
+<target name="package.ejb" if="create.ejb">
+ <mkdir dir="${package.dir}/${app.name}"/>
+ <jar destfile="${package.dir}/${app.name}/${app.name}EJB.jar">
+ <metainf file="${app.src.dir}/META-INF/persistence.xml"/>
+ <fileset dir="${build.dir}/${app.name}/">
+ <exclude name="**/client/**"/>
+ <exclude name="**/container/**"/>
+ <exclude name="**/WEB-INF/**"/>
+ <include name="**/*.class"/>
+ <include name="**/interfaces/**"/>
+ </fileset>
+ </jar>
+</target>
+
+<target name="package.war" if="create.war">
+ <mkdir dir="${package.dir}/${app.name}"/>
+
+ <!-- Setup temporary staging area with proper structure -->
+ <mkdir dir="${temp.dir}/${app.name}/WEB-INF/classes"/>
+
+ <!-- Copy over files -->
+ <copy todir="${temp.dir}/${app.name}/WEB-INF/classes">
+ <fileset dir="${build.dir}/${app.name}">
+ <include name="**/container/**"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${temp.dir}/${app.name}/WEB-INF" file="${app.src.dir}/WEB-INF/web.xml"/>
+
+ <jar destfile="${package.dir}/${app.name}/${app.name}Web.war">
+ <fileset dir="${temp.dir}/${app.name}"/>
+ </jar>
+
+ <!-- Remove temp staging area -->
+ <delete dir="${temp.dir}/${app.name}"/>
+</target>
+
+<target name="package.ear" if="create.ear">
+ <mkdir dir="${package.dir}/${app.name}"/>
+
+ <!-- Setup temporary staging area with proper structure -->
+ <mkdir dir="${temp.dir}/${app.name}/ear"/>
+
+ <!-- Copy over files -->
+
+ <jar destfile="${package.dir}/${app.name}/${app.name}.ear">
+ <metainf file="${app.src.dir}/META-INF/application.xml"/>
+ <fileset file="${package.dir}/${app.name}/${app.name}Web.war"/>
+ <fileset file="${package.dir}/${app.name}/${app.name}EJB.jar"/>
+ </jar>
+</target>
+
+<target name="package.common" depends="package.client,package.ejb,package.war,package.ear"/>
+
+<target name="deploy.common" if="deploy">
+ <copy todir="${appserver.home}/domains/domain1/autodeploy" file="${package.dir}/${app.name}/${app.name}.ear"/>
+</target>
+
+<target name="execClient" depends="init.common">
+ <java fork="true" classname="${client.class}" classpath="${build.classpath}:${java.home}/lib/jsse.jar:${package.dir}/${app.name}/${app.name}Client.jar"/>
+</target> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/packaging-build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/packaging-build.xml
new file mode 100644
index 0000000..32df5d0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/packaging-build.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Packaging Generator" default="_packaging_generation_">
+<target name="_packaging_generation_" depends="N65540,N65565,N65590,N65623"/>
+<target name="N65540" description="MasteringEJB.ejb3">
+<jar destfile="MasteringEJB.ejb3">
+<zipfileset dir="SupportFiles" prefix="META-INF">
+<include name="persistence.xml"/>
+</zipfileset>
+<zipfileset dir="bin" includes="**/container/*, **/interfaces/*, **/entity/**/*" excludes="**/container/*Servlet.class"/>
+</jar>
+</target>
+<target name="N65565" description="MasteringEJB.war">
+<jar destfile="MasteringEJB.war">
+<zipfileset dir="SupportFiles" prefix="WEB-INF">
+<include name="web.xml"/>
+</zipfileset>
+<zipfileset dir="bin" prefix="WEB-INF/classes" includes="**/container/*Servlet.class"/>
+</jar>
+</target>
+<target name="N65590" description="PricerClient.jar"/>
+<target name="N65623" description="MasteringEJB.ear">
+<jar destfile="MasteringEJB.ear">
+<zipfileset dir=".">
+<include name="MasteringEJB.ejb3"/>
+</zipfileset>
+<zipfileset dir="SupportFiles" prefix="META-INF">
+<include name="application.xml"/>
+</zipfileset>
+<zipfileset dir=".">
+<include name="MasteringEJB.war"/>
+</zipfileset>
+<zipfileset dir="SupportFiles" prefix="META-INF">
+<include name="sun-application.xml"/>
+</zipfileset>
+</jar>
+</target>
+</project>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/application.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/application.xml
new file mode 100644
index 0000000..68de436
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/application.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application version="1.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
+ <display-name>EntityExamples</display-name>
+ <module>
+ <ejb>EntityExamplesEjb.jar</ejb>
+ </module>
+</application>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/persistence.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/persistence.xml
new file mode 100644
index 0000000..e5be93a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/META-INF/persistence.xml
@@ -0,0 +1,13 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+ <persistence-unit name="pu1" transaction-type="JTA">
+ <jta-data-source>jdbc/__default</jta-data-source>
+ <properties>
+ <!--Use the java2db feature -->
+ <!-- <property name="ddl-generation" value="dropandcreate"/> -->
+ <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
+ <!-- Generate the sql specific to Derby database -->
+ <property name="toplink.platform.class.name"
+ value="oracle.toplink.essentials.platform.database.DerbyPlatform"/>
+ </properties>
+ </persistence-unit>
+</persistence>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Course.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Course.java
new file mode 100644
index 0000000..2d6a18c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Course.java
@@ -0,0 +1,48 @@
+package examples.entity.bid.many_to_many;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+
+@Entity(name="CourseBid")
+public class Course implements Serializable {
+ private int id;
+ private String courseName;
+ private Collection<Student> students = new ArrayList<Student>();
+
+ public Course() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getCourseName() {
+ return courseName;
+ }
+
+ public void setCourseName(String courseName) {
+ this.courseName = courseName;
+ }
+
+ @ManyToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER,mappedBy="courses")
+ public Collection<Student> getStudents() {
+ return students;
+ }
+
+ public void setStudents(Collection<Student> students) {
+ this.students = students;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Student.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Student.java
new file mode 100644
index 0000000..fc40746
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/Student.java
@@ -0,0 +1,50 @@
+package examples.entity.bid.many_to_many;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+
+@Entity(name="StudentBid")
+public class Student implements Serializable {
+ private int id;
+ private String name;
+ private Collection<Course> courses = new ArrayList<Course>();
+
+ public Student() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManyToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
+ @JoinTable(name="STUDENTBID_COURSEBID")
+ public Collection<Course> getCourses() {
+ return courses;
+ }
+
+ public void setCourses(Collection<Course> courses) {
+ this.courses = courses;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/StudentCourseBidBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/StudentCourseBidBean.java
new file mode 100644
index 0000000..919f9ce
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/StudentCourseBidBean.java
@@ -0,0 +1,53 @@
+package examples.entity.bid.many_to_many;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.bid.many_to_many.interfaces.StudentCourse;
+
+@Stateless
+public class StudentCourseBidBean implements StudentCourse {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Course c1 = new Course();
+ c1.setCourseName("EJB 3.0 101");
+
+ Course c2 = new Course();
+ c2.setCourseName("EJB 3.0 202");
+
+ Student s1 = new Student();
+ s1.setName("Micah");
+
+ s1.getCourses().add(c1);
+
+ c1.getStudents().add(s1);
+
+ Student s2 = new Student();
+ s2.setName("Tes");
+
+ s2.getCourses().add(c1);
+ s2.getCourses().add(c2);
+
+ c1.getStudents().add(s2);
+ c2.getStudents().add(s2);
+
+ em.persist(s1);
+ em.persist(s2);
+ }
+
+ public List getAllStudents() {
+ Query q = em.createQuery("SELECT s FROM StudentBid s");
+ return q.getResultList();
+ }
+
+ public List getAllCourses() {
+ Query q = em.createQuery("SELECT c FROM CourseBid c");
+ return q.getResultList();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/client/StudentCourseClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/client/StudentCourseClient.java
new file mode 100644
index 0000000..4537ad1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/client/StudentCourseClient.java
@@ -0,0 +1,41 @@
+package examples.entity.bid.many_to_many.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.bid.many_to_many.Course;
+import examples.entity.bid.many_to_many.Student;
+import examples.entity.bid.many_to_many.interfaces.StudentCourse;
+
+
+public class StudentCourseClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ StudentCourse sc = (StudentCourse)ic.lookup(StudentCourse.class.getName());
+
+ sc.doSomeStuff();
+
+ for (Object o : sc.getAllStudents()) {
+ Student s = (Student)o;
+ System.out.println("Student: "+s.getName());
+ for (Object o1 : s.getCourses()) {
+ Course c = (Course)o1;
+ System.out.println("\tCourse: "+c.getCourseName());
+ }
+ }
+ System.out.println();
+ for (Object o : sc.getAllCourses()) {
+ Course c = (Course)o;
+ System.out.println("Course: "+c.getCourseName());
+ for (Object o1 : c.getStudents()) {
+ Student s = (Student)o1;
+ System.out.println("\tStudent: "+s.getName());
+ }
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/interfaces/StudentCourse.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/interfaces/StudentCourse.java
new file mode 100644
index 0000000..90328e4
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/many_to_many/interfaces/StudentCourse.java
@@ -0,0 +1,14 @@
+package examples.entity.bid.many_to_many.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface StudentCourse {
+ public void doSomeStuff();
+
+ public List getAllStudents();
+
+ public List getAllCourses();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Company.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Company.java
new file mode 100644
index 0000000..0183e18
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Company.java
@@ -0,0 +1,48 @@
+package examples.entity.bid.one_to_many;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+@Entity(name="CompanyOMBid")
+public class Company implements Serializable {
+ private int id;
+ private String name;
+ private Collection<Employee> employees = new ArrayList<Employee>();
+
+ public Company() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER,mappedBy="company")
+ public Collection<Employee> getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(Collection<Employee> employees) {
+ this.employees = employees;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeInfo.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeInfo.java
new file mode 100644
index 0000000..02fbbb7
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeInfo.java
@@ -0,0 +1,29 @@
+package examples.entity.bid.one_to_many;
+
+import java.io.Serializable;
+
+public class CompanyEmployeeInfo implements Serializable {
+ private String cName;
+ private String eName;
+
+ public CompanyEmployeeInfo(String c, String e) {
+ cName = c;
+ eName = e;
+ }
+
+ public String getCName() {
+ return cName;
+ }
+
+ public void setCName(String name) {
+ cName = name;
+ }
+
+ public String getEName() {
+ return eName;
+ }
+
+ public void setEName(String name) {
+ eName = name;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeOMBidBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeOMBidBean.java
new file mode 100644
index 0000000..77b763a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/CompanyEmployeeOMBidBean.java
@@ -0,0 +1,81 @@
+package examples.entity.bid.one_to_many;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.bid.one_to_many.interfaces.CompanyEmployeeOM;
+
+@Stateless
+public class CompanyEmployeeOMBidBean implements CompanyEmployeeOM {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Company c = new Company();
+ c.setName("M*Power Internet Services, Inc.");
+
+ //Collection<Employee> employees = new ArrayList<Employee>();
+ Employee e = new Employee();
+ e.setName("Micah Silverman");
+ e.setSex('M');
+ e.setCompany(c);
+ //employees.add(e);
+ c.getEmployees().add(e);
+
+ e = new Employee();
+ e.setName("Tes Silverman");
+ e.setSex('F');
+ e.setCompany(c);
+ //employees.add(e);
+ c.getEmployees().add(e);
+
+ //c.setEmployees(employees);
+ em.persist(c);
+
+ c = new Company();
+ c.setName("Sun Microsystems");
+
+ //employees = new ArrayList<Employee>();
+ e = new Employee();
+ e.setName("Rima Patel");
+ e.setSex('F');
+ e.setCompany(c);
+ //employees.add(e);
+ c.getEmployees().add(e);
+
+ e = new Employee();
+ e.setName("James Gosling");
+ e.setSex('M');
+ e.setCompany(c);
+ //employees.add(e);
+ c.getEmployees().add(e);
+
+ //c.setEmployees(employees);
+ em.persist(c);
+
+ c = new Company();
+ c.setName("Bob's Bait & Tackle");
+ em.persist(c);
+ }
+
+ public List getCompanies() {
+ Query q = em.createQuery("SELECT c FROM CompanyOMBid c");
+ return q.getResultList();
+ }
+
+ public List getEmployees() {
+ Query q = em.createQuery("SELECT e FROM EmployeeOMBid e");
+ return q.getResultList();
+ }
+
+ public void deleteAll() {
+ Query q = em.createQuery("DELETE FROM EmployeeOMBid");
+ q.executeUpdate();
+ q = em.createQuery("DELETE FROM CompanyOMBid");
+ q.executeUpdate();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Employee.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Employee.java
new file mode 100644
index 0000000..c0e85ec
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/Employee.java
@@ -0,0 +1,53 @@
+package examples.entity.bid.one_to_many;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+@Entity(name="EmployeeOMBid")
+public class Employee implements Serializable {
+ private int id;
+ private String name;
+ private char sex;
+ private Company company;
+
+ public Employee() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public char getSex() {
+ return sex;
+ }
+
+ public void setSex(char sex) {
+ this.sex = sex;
+ }
+
+ @ManyToOne
+ public Company getCompany() {
+ return company;
+ }
+
+ public void setCompany(Company company) {
+ this.company = company;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java
new file mode 100644
index 0000000..8959f37
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java
@@ -0,0 +1,44 @@
+package examples.entity.bid.one_to_many.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.bid.one_to_many.Company;
+import examples.entity.bid.one_to_many.Employee;
+import examples.entity.bid.one_to_many.interfaces.CompanyEmployeeOM;
+
+
+public class CompanyEmployeeClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ CompanyEmployeeOM ceom = (CompanyEmployeeOM)ic.lookup(CompanyEmployeeOM.class.getName());
+
+ ceom.deleteAll();
+
+ ceom.doSomeStuff();
+
+ for (Object o : ceom.getCompanies()) {
+ Company c = (Company)o;
+ System.out.println("Here are the employees for company: "+c.getName());
+ for (Employee e : c.getEmployees()) {
+ System.out.println("\tName: "+e.getName()+", Sex: "+e.getSex());
+ }
+ System.out.println();
+ }
+ System.out.println();
+
+ for (Object o : ceom.getEmployees()) {
+ Employee e = (Employee)o;
+ Company c = e.getCompany();
+
+ System.out.println("Employee: "+e.getName()+" works for: "+c.getName());
+
+ System.out.println();
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/interfaces/CompanyEmployeeOM.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/interfaces/CompanyEmployeeOM.java
new file mode 100644
index 0000000..e79f59f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/interfaces/CompanyEmployeeOM.java
@@ -0,0 +1,16 @@
+package examples.entity.bid.one_to_many.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface CompanyEmployeeOM {
+ public void doSomeStuff();
+
+ public List getCompanies();
+
+ public List getEmployees();
+
+ public void deleteAll();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Order.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Order.java
new file mode 100644
index 0000000..6af54aa
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Order.java
@@ -0,0 +1,45 @@
+package examples.entity.bid.one_to_one;
+
+import java.io.Serializable;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+@Entity(name="OrderBid")
+public class Order implements Serializable {
+ private int id;
+ private String orderName;
+ private Shipment shipment;
+
+ public Order() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getOrderName() {
+ return orderName;
+ }
+
+ public void setOrderName(String orderName) {
+ this.orderName = orderName;
+ }
+
+ @OneToOne(cascade={CascadeType.PERSIST})
+ public Shipment getShipment() {
+ return shipment;
+ }
+
+ public void setShipment(Shipment shipment) {
+ this.shipment = shipment;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/OrderShipmentBidBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/OrderShipmentBidBean.java
new file mode 100644
index 0000000..792c2de
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/OrderShipmentBidBean.java
@@ -0,0 +1,40 @@
+package examples.entity.bid.one_to_one;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.bid.one_to_one.interfaces.OrderShipment;
+
+@Stateless
+public class OrderShipmentBidBean implements OrderShipment {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Shipment s = new Shipment();
+ s.setCity("Austin");
+ s.setZipcode("78727");
+
+ Order o = new Order();
+ o.setOrderName("Software Order");
+ o.setShipment(s);
+
+ s.setOrder(o);
+
+ em.persist(o);
+ }
+
+ public List getOrders() {
+ Query q = em.createQuery("SELECT o FROM OrderBid o");
+ return q.getResultList();
+ }
+
+ public List getShipments() {
+ Query q = em.createQuery("SELECT s FROM ShipmentBid s");
+ return q.getResultList();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Shipment.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Shipment.java
new file mode 100644
index 0000000..c778ae2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/Shipment.java
@@ -0,0 +1,53 @@
+package examples.entity.bid.one_to_one;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+@Entity(name="ShipmentBid")
+public class Shipment implements Serializable {
+ private int id;
+ private String city;
+ private String zipcode;
+ private Order order;
+
+ public Shipment() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getZipcode() {
+ return zipcode;
+ }
+
+ public void setZipcode(String zipcode) {
+ this.zipcode = zipcode;
+ }
+
+ @OneToOne(mappedBy="shipment")
+ public Order getOrder() {
+ return order;
+ }
+
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/client/OrderShipmentClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/client/OrderShipmentClient.java
new file mode 100644
index 0000000..d99444c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/client/OrderShipmentClient.java
@@ -0,0 +1,39 @@
+package examples.entity.bid.one_to_one.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.bid.one_to_one.Order;
+import examples.entity.bid.one_to_one.Shipment;
+import examples.entity.bid.one_to_one.interfaces.OrderShipment;
+
+
+public class OrderShipmentClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ OrderShipment os = (OrderShipment)ic.lookup(OrderShipment.class.getName());
+
+ os.doSomeStuff();
+
+ System.out.println("Bidirectional One-To-One client\n");
+
+ for (Object o : os.getOrders()) {
+ Order order = (Order)o;
+ System.out.println("Order "+order.getId()+": "+order.getOrderName());
+ System.out.println("\tShipment details: "+order.getShipment().getCity()+" "+order.getShipment().getZipcode());
+ }
+
+ System.out.println();
+
+ for (Object o : os.getShipments()) {
+ Shipment shipment = (Shipment)o;
+ System.out.println("Shipment: "+shipment.getCity()+" "+shipment.getZipcode());
+ System.out.println("\tOrder details: "+shipment.getOrder().getOrderName());
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/interfaces/OrderShipment.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/interfaces/OrderShipment.java
new file mode 100644
index 0000000..cc4ae2b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_one/interfaces/OrderShipment.java
@@ -0,0 +1,14 @@
+package examples.entity.bid.one_to_one.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface OrderShipment {
+ public void doSomeStuff();
+
+ public List getOrders();
+
+ public List getShipments();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/build.xml
new file mode 100644
index 0000000..f73d142
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/build.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-entity" default="main" basedir="../../..">
+ <!-- basic settings -->
+ <property name="app.pkg" value="examples/entity"/>
+ <property name="app.name" value="EntityExamples"/>
+ <property name="create.client" value="true"/>
+ <property name="create.ejb" value="true"/>
+ <property name="create.ear" value="true"/>
+ <property name="deploy" value="true"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+ <target name="main" depends="compile.common,package.common,deploy.common"/>
+
+ <target name="single_table">
+ <echo message="Executing examples.entity.single_table.client.RoadVehicleClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.single_table.client.RoadVehicleClient"/>
+ </antcall>
+ </target>
+
+ <target name="joined">
+ <echo message="Executing examples.entity.joined.client.RoadVehicleClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.joined.client.RoadVehicleClient"/>
+ </antcall>
+ </target>
+
+ <target name="uni.one_to_one">
+ <echo message="Executing examples.entity.uni.one_to_one.client.OrderShipmentClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.uni.one_to_one.client.OrderShipmentClient"/>
+ </antcall>
+ </target>
+
+ <target name="uni.one_to_many">
+ <echo message="Executing examples.entity.uni.one_to_many.client.CompanyEmployeeClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.uni.one_to_many.client.CompanyEmployeeClient"/>
+ </antcall>
+ </target>
+
+ <target name="uni.many_to_one">
+ <echo message="Executing examples.entity.uni.many_to_one.client.EmployeeAddressClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.uni.many_to_one.client.EmployeeAddressClient"/>
+ </antcall>
+ </target>
+
+ <target name="uni.many_to_many">
+ <echo message="Executing examples.entity.uni.many_to_many.client.StudentCourseClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.uni.many_to_many.client.StudentCourseClient"/>
+ </antcall>
+ </target>
+
+ <target name="bid.one_to_one">
+ <echo message="Executing examples.entity.bid.one_to_one.client.OrderShipmentClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.bid.one_to_one.client.OrderShipmentClient"/>
+ </antcall>
+ </target>
+
+ <target name="bid.one_to_many">
+ <echo message="Executing examples.entity.bid.one_to_many.client.CompanyEmployeeClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.bid.one_to_many.client.CompanyEmployeeClient"/>
+ </antcall>
+ </target>
+
+ <target name="bid.many_to_many">
+ <echo message="Executing examples.entity.bid.many_to_many.client.StudentCourseClient"/>
+ <antcall target="execClient">
+ <param name="client.class" value="examples.entity.bid.many_to_many.client.StudentCourseClient"/>
+ </antcall>
+ </target>
+
+ <target name="run" depends="single_table,joined,uni.one_to_one,uni.one_to_many,uni.many_to_one,uni.many_to_many,bid.one_to_one,bid.one_to_many,bid.many_to_many"/>
+ <!-- target name="run" depends="uni.one_to_one,uni.one_to_many"/ -->
+</project> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Car.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Car.java
new file mode 100644
index 0000000..38cbda0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Car.java
@@ -0,0 +1,15 @@
+package examples.entity.joined;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+
+@Entity(name="CarJoined")
+public class Car extends RoadVehicle implements Serializable {
+ public final AcceleratorType acceleratorType = AcceleratorType.PEDAL;
+
+ public Car() {
+ super();
+ numWheels = 4;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Coupe.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Coupe.java
new file mode 100644
index 0000000..59df47b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Coupe.java
@@ -0,0 +1,25 @@
+package examples.entity.joined;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+
+@Entity(name="CoupeJoined")
+public class Coupe extends Car implements Serializable {
+ public enum BoringFactor {BORING,BORINGER,BORINGEST};
+
+ private BoringFactor boringFactor;
+
+ public Coupe() {
+ super();
+ numPassengers = 5;
+ }
+
+ public BoringFactor getBoringFactor() {
+ return boringFactor;
+ }
+
+ public void setBoringFactor(BoringFactor boringFactor) {
+ this.boringFactor = boringFactor;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Motorcycle.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Motorcycle.java
new file mode 100644
index 0000000..14c83ec
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Motorcycle.java
@@ -0,0 +1,16 @@
+package examples.entity.joined;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+
+@Entity(name="MotorcycleJoined")
+public class Motorcycle extends RoadVehicle implements Serializable {
+ public final AcceleratorType acceleratorType = AcceleratorType.THROTTLE;
+
+ public Motorcycle() {
+ super();
+ numWheels = 2;
+ numPassengers = 2;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicle.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicle.java
new file mode 100644
index 0000000..9fe8c3e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicle.java
@@ -0,0 +1,67 @@
+package examples.entity.joined;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+@Entity(name="RoadVehicleJoined")
+@Table(name="RoadVehicleJoined")
+@Inheritance(strategy=InheritanceType.JOINED)
+public class RoadVehicle implements Serializable {
+ public enum AcceleratorType {PEDAL,THROTTLE};
+
+ @Id
+ protected int id;
+ protected int numPassengers;
+ protected int numWheels;
+ protected String make;
+ protected String model;
+
+ public RoadVehicle() {
+ id = (int) System.nanoTime();
+ }
+
+ public int getNumPassengers() {
+ return numPassengers;
+ }
+
+ public void setNumPassengers(int numPassengers) {
+ this.numPassengers = numPassengers;
+ }
+
+ public int getNumWheels() {
+ return numWheels;
+ }
+
+ public void setNumWheels(int numWheels) {
+ this.numWheels = numWheels;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getMake() {
+ return make;
+ }
+
+ public void setMake(String make) {
+ this.make = make;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ public String toString() {
+ return "Make: "+make+", Model: "+model+", Number of passengers: "+numPassengers;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicleStatelessJoinedBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicleStatelessJoinedBean.java
new file mode 100644
index 0000000..9b46869
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/RoadVehicleStatelessJoinedBean.java
@@ -0,0 +1,46 @@
+package examples.entity.joined;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.joined.Coupe.BoringFactor;
+import examples.entity.joined.Roadster.CoolFactor;
+import examples.entity.joined.interfaces.RoadVehicleStatelessJoined;
+
+@Stateless
+public class RoadVehicleStatelessJoinedBean implements RoadVehicleStatelessJoined {
+ @PersistenceContext(unitName="pu1")
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Coupe c = new Coupe();
+ c.setMake("Bob");
+ c.setModel("E400");
+ c.setBoringFactor(BoringFactor.BORING);
+ em.persist(c);
+
+ Roadster r = new Roadster();
+ r.setMake("Mini");
+ r.setModel("Cooper S");
+ r.setCoolFactor(CoolFactor.COOLEST);
+ em.persist(r);
+
+ Motorcycle m = new Motorcycle();
+ em.persist(m);
+ }
+
+ public List getAllCars() {
+ Query q = em.createQuery("SELECT c.id FROM CarJoined c");
+ List ids = q.getResultList();
+ ArrayList<Car> al = new ArrayList<Car>();
+ for (Object o : ids) {
+ al.add(em.find(Car.class,(Integer)o));
+ }
+ return al;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Roadster.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Roadster.java
new file mode 100644
index 0000000..b93dbf5
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/Roadster.java
@@ -0,0 +1,29 @@
+package examples.entity.joined;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+
+@Entity(name="RoadsterJoined")
+public class Roadster extends Car implements Serializable {
+ public enum CoolFactor {COOL,COOLER,COOLEST};
+
+ private CoolFactor coolFactor;
+
+ public Roadster() {
+ super();
+ numPassengers = 2;
+ }
+
+ public CoolFactor getCoolFactor() {
+ return coolFactor;
+ }
+
+ public void setCoolFactor(CoolFactor coolFactor) {
+ this.coolFactor = coolFactor;
+ }
+
+ public String toString() {
+ return super.toString()+", CoolFactor: "+coolFactor;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/client/RoadVehicleClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/client/RoadVehicleClient.java
new file mode 100644
index 0000000..64cf21e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/client/RoadVehicleClient.java
@@ -0,0 +1,28 @@
+package examples.entity.joined.client;
+
+import java.util.List;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.joined.interfaces.RoadVehicleStatelessJoined;
+
+
+public class RoadVehicleClient {
+ public static void main(String[] args) {
+ InitialContext ic;
+ try {
+ ic = new InitialContext();
+ RoadVehicleStatelessJoined rvs = (RoadVehicleStatelessJoined)ic.lookup(RoadVehicleStatelessJoined.class.getName());
+ rvs.doSomeStuff();
+
+ List l = rvs.getAllCars();
+ for (Object o : l) {
+ System.out.println("Car: "+o);
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/interfaces/RoadVehicleStatelessJoined.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/interfaces/RoadVehicleStatelessJoined.java
new file mode 100644
index 0000000..b205c01
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/joined/interfaces/RoadVehicleStatelessJoined.java
@@ -0,0 +1,12 @@
+package examples.entity.joined.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface RoadVehicleStatelessJoined {
+ public void doSomeStuff();
+
+ public List getAllCars();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Car.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Car.java
new file mode 100644
index 0000000..5c72d7f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Car.java
@@ -0,0 +1,21 @@
+package examples.entity.single_table;
+
+import java.io.Serializable;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity(name="CarSingle")
+@DiscriminatorValue("CAR")
+public class Car extends RoadVehicle implements Serializable {
+ public final AcceleratorType acceleratorType = AcceleratorType.PEDAL;
+
+ public Car() {
+ super();
+ numWheels = 4;
+ }
+
+ public String toString() {
+ return "Car: "+super.toString();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Coupe.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Coupe.java
new file mode 100644
index 0000000..31af7d5
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Coupe.java
@@ -0,0 +1,31 @@
+package examples.entity.single_table;
+
+import java.io.Serializable;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity(name="CoupeSingle")
+@DiscriminatorValue("COUPE")
+public class Coupe extends Car implements Serializable {
+ public enum BoringFactor {BORING,BORINGER,BORINGEST};
+
+ private BoringFactor boringFactor;
+
+ public Coupe() {
+ super();
+ numPassengers = 5;
+ }
+
+ public BoringFactor getBoringFactor() {
+ return boringFactor;
+ }
+
+ public void setBoringFactor(BoringFactor boringFactor) {
+ this.boringFactor = boringFactor;
+ }
+
+ public String toString() {
+ return "Coupe: "+super.toString();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Motorcycle.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Motorcycle.java
new file mode 100644
index 0000000..018cb5d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Motorcycle.java
@@ -0,0 +1,22 @@
+package examples.entity.single_table;
+
+import java.io.Serializable;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity(name="MotorcycleSingle")
+@DiscriminatorValue("MOTORCYCLE")
+public class Motorcycle extends RoadVehicle implements Serializable {
+ public final AcceleratorType acceleratorType = AcceleratorType.THROTTLE;
+
+ public Motorcycle() {
+ super();
+ numWheels = 2;
+ numPassengers = 2;
+ }
+
+ public String toString() {
+ return "Motorcycle: "+super.toString();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicle.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicle.java
new file mode 100644
index 0000000..75a258a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicle.java
@@ -0,0 +1,72 @@
+package examples.entity.single_table;
+
+import java.io.Serializable;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+@Entity(name="RoadVehicleSingle")
+@Table(name="RoadVehicleSingle")
+@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name="DISC", discriminatorType=DiscriminatorType.STRING)
+@DiscriminatorValue("ROADVEHICLE")
+public class RoadVehicle implements Serializable {
+ public enum AcceleratorType {PEDAL,THROTTLE};
+
+ @Id
+ protected int id;
+ protected int numPassengers;
+ protected int numWheels;
+ protected String make;
+ protected String model;
+
+ public RoadVehicle() {
+ id = (int) System.nanoTime();
+ }
+
+ public int getNumPassengers() {
+ return numPassengers;
+ }
+
+ public void setNumPassengers(int numPassengers) {
+ this.numPassengers = numPassengers;
+ }
+
+ public int getNumWheels() {
+ return numWheels;
+ }
+
+ public void setNumWheels(int numWheels) {
+ this.numWheels = numWheels;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getMake() {
+ return make;
+ }
+
+ public void setMake(String make) {
+ this.make = make;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ public String toString() {
+ return "Make: "+make+", Model: "+model+", Number of passengers: "+numPassengers;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicleStatelessBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicleStatelessBean.java
new file mode 100644
index 0000000..94d27db
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/RoadVehicleStatelessBean.java
@@ -0,0 +1,50 @@
+package examples.entity.single_table;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.single_table.Coupe.BoringFactor;
+import examples.entity.single_table.Roadster.CoolFactor;
+import examples.entity.single_table.interfaces.RoadVehicleStateless;
+
+@Stateless
+public class RoadVehicleStatelessBean implements RoadVehicleStateless {
+ @PersistenceContext(unitName="pu1")
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Coupe c = new Coupe();
+ c.setMake("Bob");
+ c.setModel("E400");
+ c.setBoringFactor(BoringFactor.BORING);
+ em.persist(c);
+
+ Roadster r = new Roadster();
+ r.setMake("Mini");
+ r.setModel("Cooper S");
+ r.setCoolFactor(CoolFactor.COOLEST);
+ em.persist(r);
+
+ Motorcycle m = new Motorcycle();
+ em.persist(m);
+ }
+
+ public List getAllRoadVehicles() {
+ Query q = em.createQuery("SELECT r FROM RoadVehicleSingle r");
+ return q.getResultList();
+ }
+
+ public void deleteAll(String type) {
+ Query q = em.createQuery("DELETE FROM "+type);
+ q.executeUpdate();
+ }
+
+ public void updateAll(String type) {
+ Query q = em.createQuery("UPDATE "+type+" r SET r.numPassengers = 1");
+ q.executeUpdate();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Roadster.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Roadster.java
new file mode 100644
index 0000000..ae308ac
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/Roadster.java
@@ -0,0 +1,31 @@
+package examples.entity.single_table;
+
+import java.io.Serializable;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity(name="RaodsterSingle")
+@DiscriminatorValue("ROADSTER")
+public class Roadster extends Car implements Serializable {
+ public enum CoolFactor {COOL,COOLER,COOLEST};
+
+ private CoolFactor coolFactor;
+
+ public Roadster() {
+ super();
+ numPassengers = 2;
+ }
+
+ public CoolFactor getCoolFactor() {
+ return coolFactor;
+ }
+
+ public void setCoolFactor(CoolFactor coolFactor) {
+ this.coolFactor = coolFactor;
+ }
+
+ public String toString() {
+ return "Roadster: "+super.toString();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java
new file mode 100644
index 0000000..6ef6ea6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java
@@ -0,0 +1,54 @@
+package examples.entity.single_table.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.single_table.interfaces.RoadVehicleStateless;
+
+
+public class RoadVehicleClient {
+ public static void main(String[] args) {
+ String action = "insert";
+ String type = "RoadVehicleSingle";
+
+ if (args.length>0) {
+ if (args[0].startsWith("update")) {
+ action="update";
+ }
+ else if (args[0].startsWith("delete")) {
+ action="delete";
+ }
+
+ if (args.length == 2) {
+ type = args[1];
+ }
+ }
+
+ InitialContext ic;
+ try {
+ ic = new InitialContext();
+ RoadVehicleStateless rvs = (RoadVehicleStateless)ic.lookup(RoadVehicleStateless.class.getName());
+
+ if (action.equals("insert")) {
+ System.out.println("Inserting...");
+ rvs.doSomeStuff();
+ }
+ else if (action.equals("update")) {
+ System.out.println("Updating "+type+"...");
+ rvs.updateAll(type);
+ }
+ else if (action.equals("delete")) {
+ System.out.println("Deleting "+type+"...");
+ rvs.deleteAll(type);
+ }
+
+ System.out.println("Here is the list of all RoadVehicles:\n");
+ for (Object o : rvs.getAllRoadVehicles()) {
+ System.out.println("RoadVehicle: "+o);
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/interfaces/RoadVehicleStateless.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/interfaces/RoadVehicleStateless.java
new file mode 100644
index 0000000..c85da7e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/interfaces/RoadVehicleStateless.java
@@ -0,0 +1,16 @@
+package examples.entity.single_table.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface RoadVehicleStateless {
+ public void doSomeStuff();
+
+ public List getAllRoadVehicles();
+
+ public void deleteAll(String type);
+
+ public void updateAll(String type);
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Course.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Course.java
new file mode 100644
index 0000000..b922a7d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Course.java
@@ -0,0 +1,44 @@
+package examples.entity.uni.many_to_many;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name="CourseUni")
+public class Course implements Serializable {
+ private int id;
+ private String courseName;
+ private Collection<Student> students = new ArrayList<Student>();
+
+ public Course() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getCourseName() {
+ return courseName;
+ }
+
+ public void setCourseName(String courseName) {
+ this.courseName = courseName;
+ }
+
+ public Collection<Student> getStudents() {
+ return students;
+ }
+
+ public void setStudents(Collection<Student> students) {
+ this.students = students;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Student.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Student.java
new file mode 100644
index 0000000..a6568b1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/Student.java
@@ -0,0 +1,50 @@
+package examples.entity.uni.many_to_many;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+
+@Entity(name="StudentUni")
+public class Student implements Serializable {
+ private int id;
+ private String name;
+ private Collection<Course> courses = new ArrayList<Course>();
+
+ public Student() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManyToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
+ @JoinTable(name="STUDENTUNI_COURSEUNI")
+ public Collection<Course> getCourses() {
+ return courses;
+ }
+
+ public void setCourses(Collection<Course> courses) {
+ this.courses = courses;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/StudentCourseUniBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/StudentCourseUniBean.java
new file mode 100644
index 0000000..653133b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/StudentCourseUniBean.java
@@ -0,0 +1,48 @@
+package examples.entity.uni.many_to_many;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.uni.many_to_many.interfaces.StudentCourse;
+
+@Stateless
+public class StudentCourseUniBean implements StudentCourse {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Course c1 = new Course();
+ c1.setCourseName("EJB 3.0 101");
+
+ Course c2 = new Course();
+ c2.setCourseName("EJB 3.0 202");
+
+ Student s1 = new Student();
+ s1.setName("Micah");
+
+ s1.getCourses().add(c1);
+
+ c1.getStudents().add(s1);
+
+ Student s2 = new Student();
+ s2.setName("Tes");
+
+ s2.getCourses().add(c1);
+ s2.getCourses().add(c2);
+
+ c1.getStudents().add(s2);
+ c2.getStudents().add(s2);
+
+ em.persist(s1);
+ em.persist(s2);
+ }
+
+ public List<Student> getAllStudents() {
+ Query q = em.createQuery("SELECT s FROM StudentUni s");
+ return q.getResultList();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/client/StudentCourseClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/client/StudentCourseClient.java
new file mode 100644
index 0000000..d18aee2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/client/StudentCourseClient.java
@@ -0,0 +1,30 @@
+package examples.entity.uni.many_to_many.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.uni.many_to_many.Course;
+import examples.entity.uni.many_to_many.Student;
+import examples.entity.uni.many_to_many.interfaces.StudentCourse;
+
+
+public class StudentCourseClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ StudentCourse sc = (StudentCourse)ic.lookup(StudentCourse.class.getName());
+
+ sc.doSomeStuff();
+
+ for (Student s : sc.getAllStudents()) {
+ System.out.println("Student: "+s.getName());
+ for (Course c : s.getCourses()) {
+ System.out.println("\tCourse: "+c.getCourseName());
+ }
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/interfaces/StudentCourse.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/interfaces/StudentCourse.java
new file mode 100644
index 0000000..65e9cef
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_many/interfaces/StudentCourse.java
@@ -0,0 +1,14 @@
+package examples.entity.uni.many_to_many.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+import examples.entity.uni.many_to_many.Student;
+
+@Remote
+public interface StudentCourse {
+ public void doSomeStuff();
+
+ public List<Student> getAllStudents();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/BusinessAddress.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/BusinessAddress.java
new file mode 100644
index 0000000..755cd6c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/BusinessAddress.java
@@ -0,0 +1,42 @@
+package examples.entity.uni.many_to_one;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class BusinessAddress implements Serializable {
+ private int id;
+ private String city;
+ private String zipcode;
+
+ public BusinessAddress() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getZipcode() {
+ return zipcode;
+ }
+
+ public void setZipcode(String zipcode) {
+ this.zipcode = zipcode;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/Employee.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/Employee.java
new file mode 100644
index 0000000..f14104f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/Employee.java
@@ -0,0 +1,45 @@
+package examples.entity.uni.many_to_one;
+
+import java.io.Serializable;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+@Entity
+public class Employee implements Serializable {
+ private int id;
+ private String name;
+ private BusinessAddress address;
+
+ public Employee() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManyToOne(cascade={CascadeType.ALL})
+ public BusinessAddress getAddress() {
+ return address;
+ }
+
+ public void setAddress(BusinessAddress address) {
+ this.address = address;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java
new file mode 100644
index 0000000..be74d18
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java
@@ -0,0 +1,42 @@
+package examples.entity.uni.many_to_one;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.uni.many_to_one.interfaces.EmployeeAddressMOUni;
+
+@Stateless
+public class EmployeeAddressMOUniBean implements EmployeeAddressMOUni {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ BusinessAddress a = new BusinessAddress();
+ a.setCity("Huntington Station");
+ a.setZipcode("11746");
+
+ Employee e = new Employee();
+ e.setName("Micah Silverman");
+ e.setAddress(a);
+ em.persist(e);
+
+ e = new Employee();
+ e.setName("Tes Silverman");
+ e.setAddress(a);
+ em.persist(e);
+
+ e = new Employee();
+ e.setName("Shaina Silverman");
+ e.setAddress(a);
+ em.persist(e);
+ }
+
+ public List getEmployees() {
+ Query q = em.createQuery("SELECT e FROM Employee e");
+ return q.getResultList();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/client/EmployeeAddressClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/client/EmployeeAddressClient.java
new file mode 100644
index 0000000..efabba5
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/client/EmployeeAddressClient.java
@@ -0,0 +1,28 @@
+package examples.entity.uni.many_to_one.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.uni.many_to_one.Employee;
+import examples.entity.uni.many_to_one.interfaces.EmployeeAddressMOUni;
+
+
+public class EmployeeAddressClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ EmployeeAddressMOUni ea = (EmployeeAddressMOUni)ic.lookup(EmployeeAddressMOUni.class.getName());
+
+ ea.doSomeStuff();
+
+ for (Object o : ea.getEmployees()) {
+ Employee e = (Employee)o;
+ System.out.println("Name: "+e.getName()+", Business Address: "+
+ e.getAddress().getCity()+", "+e.getAddress().getZipcode());
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/interfaces/EmployeeAddressMOUni.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/interfaces/EmployeeAddressMOUni.java
new file mode 100644
index 0000000..904a3be
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/interfaces/EmployeeAddressMOUni.java
@@ -0,0 +1,12 @@
+package examples.entity.uni.many_to_one.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface EmployeeAddressMOUni {
+ public void doSomeStuff();
+
+ public List getEmployees();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Company.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Company.java
new file mode 100644
index 0000000..ad5554b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Company.java
@@ -0,0 +1,47 @@
+package examples.entity.uni.one_to_many;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+@Entity(name="CompanyOMUni")
+public class Company implements Serializable {
+ private int id;
+ private String name;
+ private Collection<Employee> employees;
+
+ public Company() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
+ public Collection<Employee> getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(Collection<Employee> employees) {
+ this.employees = employees;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/CompanyEmployeeOMUniBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/CompanyEmployeeOMUniBean.java
new file mode 100644
index 0000000..a7e5ffa
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/CompanyEmployeeOMUniBean.java
@@ -0,0 +1,73 @@
+package examples.entity.uni.one_to_many;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.uni.one_to_many.interfaces.CompanyEmployeeOM;
+
+@Stateless
+public class CompanyEmployeeOMUniBean implements CompanyEmployeeOM {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Company c = new Company();
+ c.setName("M*Power Internet Services, Inc.");
+
+ Collection<Employee> employees = new ArrayList<Employee>();
+ Employee e = new Employee();
+ e.setName("Micah Silverman");
+ e.setSex('M');
+ employees.add(e);
+
+ e = new Employee();
+ e.setName("Tes Silverman");
+ e.setSex('F');
+ employees.add(e);
+
+ c.setEmployees(employees);
+ em.persist(c);
+
+ c = new Company();
+ c.setName("Sun Microsystems");
+
+ employees = new ArrayList<Employee>();
+ e = new Employee();
+ e.setName("Rima Patel");
+ e.setSex('F');
+ employees.add(e);
+
+ e = new Employee();
+ e.setName("James Gosling");
+ e.setSex('M');
+ employees.add(e);
+
+ c.setEmployees(employees);
+ em.persist(c);
+
+ c = new Company();
+ c.setName("Bob's Bait & Tackle");
+ em.persist(c);
+ }
+
+ public List getCompanies() {
+ Query q = em.createQuery("SELECT c FROM CompanyOMUni c");
+ return q.getResultList();
+ }
+
+ public List getCompanies2(String query) {
+ Query q = em.createQuery(query);
+ return q.getResultList();
+ }
+
+ public void deleteCompanies() {
+ Query q = em.createQuery("DELETE FROM CompanyOMUni");
+ q.executeUpdate();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Employee.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Employee.java
new file mode 100644
index 0000000..c849223
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/Employee.java
@@ -0,0 +1,42 @@
+package examples.entity.uni.one_to_many;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name="EmployeeOMUni")
+public class Employee implements Serializable {
+ private int id;
+ private String name;
+ private char sex;
+
+ public Employee() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public char getSex() {
+ return sex;
+ }
+
+ public void setSex(char sex) {
+ this.sex = sex;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/client/CompanyEmployeeClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/client/CompanyEmployeeClient.java
new file mode 100644
index 0000000..6077c1a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/client/CompanyEmployeeClient.java
@@ -0,0 +1,35 @@
+package examples.entity.uni.one_to_many.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.uni.one_to_many.Company;
+import examples.entity.uni.one_to_many.Employee;
+import examples.entity.uni.one_to_many.interfaces.CompanyEmployeeOM;
+
+
+public class CompanyEmployeeClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ CompanyEmployeeOM ceom = (CompanyEmployeeOM)ic.lookup(CompanyEmployeeOM.class.getName());
+
+ ceom.deleteCompanies();
+
+ ceom.doSomeStuff();
+
+ System.out.println("All Companies:");
+ for (Object o : ceom.getCompanies()) {
+ Company c = (Company)o;
+ System.out.println("Here are the employees for company: "+c.getName());
+ for (Employee e : c.getEmployees()) {
+ System.out.println("\tName: "+e.getName()+", Sex: "+e.getSex());
+ }
+ System.out.println();
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/interfaces/CompanyEmployeeOM.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/interfaces/CompanyEmployeeOM.java
new file mode 100644
index 0000000..7da70f3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_many/interfaces/CompanyEmployeeOM.java
@@ -0,0 +1,16 @@
+package examples.entity.uni.one_to_many.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface CompanyEmployeeOM {
+ public void doSomeStuff();
+
+ public List getCompanies();
+
+ public List getCompanies2(String query);
+
+ public void deleteCompanies();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Order.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Order.java
new file mode 100644
index 0000000..71adb1e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Order.java
@@ -0,0 +1,45 @@
+package examples.entity.uni.one_to_one;
+
+import java.io.Serializable;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+@Entity(name="OrderUni")
+public class Order implements Serializable {
+ private int id;
+ private String orderName;
+ private Shipment shipment;
+
+ public Order() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getOrderName() {
+ return orderName;
+ }
+
+ public void setOrderName(String orderName) {
+ this.orderName = orderName;
+ }
+
+ @OneToOne(cascade={CascadeType.PERSIST})
+ public Shipment getShipment() {
+ return shipment;
+ }
+
+ public void setShipment(Shipment shipment) {
+ this.shipment = shipment;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/OrderShipmentUniBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/OrderShipmentUniBean.java
new file mode 100644
index 0000000..9399996
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/OrderShipmentUniBean.java
@@ -0,0 +1,33 @@
+package examples.entity.uni.one_to_one;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.uni.one_to_one.interfaces.OrderShipment;
+
+@Stateless
+public class OrderShipmentUniBean implements OrderShipment {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ Shipment s = new Shipment();
+ s.setCity("Austin");
+ s.setZipcode("78727");
+
+ Order o = new Order();
+ o.setOrderName("Software Order");
+ o.setShipment(s);
+
+ em.persist(o);
+ }
+
+ public List getOrders() {
+ Query q = em.createQuery("SELECT o FROM OrderUni o");
+ return q.getResultList();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Shipment.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Shipment.java
new file mode 100644
index 0000000..4f16169
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/Shipment.java
@@ -0,0 +1,42 @@
+package examples.entity.uni.one_to_one;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity(name="ShipmentUni")
+public class Shipment implements Serializable {
+ private int id;
+ private String city;
+ private String zipcode;
+
+ public Shipment() {
+ id = (int)System.nanoTime();
+ }
+
+ @Id
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getZipcode() {
+ return zipcode;
+ }
+
+ public void setZipcode(String zipcode) {
+ this.zipcode = zipcode;
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/client/OrderShipmentClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/client/OrderShipmentClient.java
new file mode 100644
index 0000000..666fc5d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/client/OrderShipmentClient.java
@@ -0,0 +1,30 @@
+package examples.entity.uni.one_to_one.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.uni.one_to_one.Order;
+import examples.entity.uni.one_to_one.interfaces.OrderShipment;
+
+
+public class OrderShipmentClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ OrderShipment os = (OrderShipment)ic.lookup(OrderShipment.class.getName());
+
+ os.doSomeStuff();
+
+ System.out.println("Unidirectional One-To-One client\n");
+
+ for (Object o : os.getOrders()) {
+ Order order = (Order)o;
+ System.out.println("Order "+order.getId()+": "+order.getOrderName());
+ System.out.println("\tShipment details: "+order.getShipment().getCity()+" "+order.getShipment().getZipcode());
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/interfaces/OrderShipment.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/interfaces/OrderShipment.java
new file mode 100644
index 0000000..c697a10
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/one_to_one/interfaces/OrderShipment.java
@@ -0,0 +1,12 @@
+package examples.entity.uni.one_to_one.interfaces;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface OrderShipment {
+ public void doSomeStuff();
+
+ public List getOrders();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/CartBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/CartBean.java
new file mode 100644
index 0000000..48688c0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/CartBean.java
@@ -0,0 +1,39 @@
+package examples.stateful;
+
+import javax.annotation.Resource;
+import javax.ejb.Remove;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+
+import examples.stateful.interfaces.Cart;
+
+@Stateful
+public class CartBean implements Cart {
+ @Resource SessionContext context;
+ private int numItems;
+
+ public void addItem() {
+ numItems++;
+ }
+
+ public int getItems() {
+ return numItems;
+ }
+
+ @Remove(retainIfException=false)
+ public void remove1() throws Exception {
+ doRemove();
+ }
+
+ @Remove(retainIfException=true)
+ public void remove2() throws Exception {
+ doRemove();
+ }
+
+ private void doRemove() throws Exception {
+ if (numItems > 1 && numItems < 4) {
+ throw new Exception("blah");
+ }
+ System.out.println("Removing cart with: "+numItems+" items.");
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/META-INF/application.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/META-INF/application.xml
new file mode 100644
index 0000000..eb9ae84
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/META-INF/application.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application version="1.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
+ <display-name>StatefulExamples</display-name>
+ <module>
+ <ejb>StatefulExamplesEjb.jar</ejb>
+ </module>
+</application>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/build.xml
new file mode 100644
index 0000000..51b1f71
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/build.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-stateful" default="main" basedir="../../..">
+ <!-- basic settings -->
+ <property name="app.pkg" value="examples/stateful"/>
+ <property name="app.name" value="StatefulExamples"/>
+ <property name="create.client" value="true"/>
+ <property name="create.ejb" value="true"/>
+ <property name="create.ear" value="true"/>
+ <property name="deploy" value="true"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+ <target name="main" depends="compile.common,package.common,deploy.common"/>
+
+ <target name="run">
+ <antcall target="execClient">
+ <param name="client.class" value="examples.stateful.client.CartClient"/>
+ </antcall>
+ </target>
+</project>
+
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/client/CartClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/client/CartClient.java
new file mode 100644
index 0000000..abc2da2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/client/CartClient.java
@@ -0,0 +1,47 @@
+package examples.stateful.client;
+
+import javax.ejb.NoSuchEJBException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.stateful.interfaces.Cart;
+
+public class CartClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ System.out.println("Adding items to cart, then removing...");
+ for (int i=0;i<2;i++) {
+ Cart cart = (Cart)ic.lookup(Cart.class.getName());
+ cart.addItem();
+ cart.addItem();
+ System.out.println("Number of items in the cart: "+cart.getItems());
+ try {
+ try {
+ if (i==0) {
+ cart.remove1();
+ }
+ else {
+ cart.remove2();
+ }
+ }
+ catch (Exception e) {
+ ;
+ }
+
+ cart.addItem();
+ cart.addItem();
+ cart.addItem();
+
+ System.out.println("Number of items in the cart: "+cart.getItems());
+ }
+ catch (NoSuchEJBException nsee) {
+ System.out.println("Cart was already removed during iteration "+i);
+ }
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/interfaces/Cart.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/interfaces/Cart.java
new file mode 100644
index 0000000..a55ebbe
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateful/interfaces/Cart.java
@@ -0,0 +1,11 @@
+package examples.stateful.interfaces;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Cart {
+ public void addItem();
+ public int getItems();
+ public void remove1() throws Exception;
+ public void remove2() throws Exception;
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/HelloWorldBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/HelloWorldBean.java
new file mode 100644
index 0000000..289e962
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/HelloWorldBean.java
@@ -0,0 +1,12 @@
+package examples.stateless;
+
+import javax.ejb.Stateless;
+
+import examples.stateless.interfaces.HelloWorld;
+
+@Stateless
+public class HelloWorldBean implements HelloWorld {
+ public String hi() {
+ return "hi!";
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/META-INF/application.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/META-INF/application.xml
new file mode 100644
index 0000000..a7cc0e6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/META-INF/application.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application version="1.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
+ <display-name>StatelessExamples</display-name>
+ <module>
+ <ejb>StatelessExamplesEjb.jar</ejb>
+ </module>
+ <module>
+ <web>
+ <web-uri>StatelessExamplesWeb.war</web-uri>
+ <context-root>/StatelessExamples</context-root>
+ </web>
+ </module>
+</application>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/PricerBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/PricerBean.java
new file mode 100644
index 0000000..58697d6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/PricerBean.java
@@ -0,0 +1,66 @@
+package examples.stateless;
+
+import javax.ejb.EJB;
+import javax.ejb.Remote;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Stateless;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.stateless.interceptors.AuditorInterceptor;
+import examples.stateless.interceptors.LoggerInterceptor;
+import examples.stateless.interfaces.PricerInjection;
+import examples.stateless.interfaces.PricerLookup;
+import examples.stateless.interfaces.TaxRate;
+
+@Stateless
+@Interceptors({LoggerInterceptor.class,AuditorInterceptor.class})
+@Remote({PricerInjection.class,PricerLookup.class})
+public class PricerBean implements PricerInjection, PricerLookup {
+ private TaxRate taxRate;
+
+ @EJB
+ private TaxRate taxRate2;
+
+ public double getTaxLookup(double cost, String state) {
+ double tax = -1;
+ tax = cost * taxRate.getTaxRate(state);
+ return tax;
+ }
+
+ public double getTaxInjection(double cost, String state) {
+ double tax = -1;
+ tax = cost * taxRate2.getTaxRate(state);
+ return tax;
+ }
+
+ @PostConstruct
+ public void postConstruct() {
+ try {
+ InitialContext ic = new InitialContext();
+ taxRate = (TaxRate)ic.lookup(TaxRate.class.getName());
+ }
+ catch (NamingException e) {
+ // some kind of appropriate handling here
+ }
+ }
+
+ @PreDestroy
+ public void preDestroy() {
+ taxRate = null;
+ }
+
+ @AroundInvoke
+ public Object logger(InvocationContext inv) throws Exception {
+ System.out.println("Intercepted call via internal method to: "+inv.getMethod().getName());
+ Object[] params = inv.getParameters();
+ for (int i=0;i<params.length;i++) {
+ System.out.println("\tparam: "+params[i]);
+ }
+ return inv.proceed();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/TaxRateBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/TaxRateBean.java
new file mode 100644
index 0000000..fb51d29
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/TaxRateBean.java
@@ -0,0 +1,20 @@
+package examples.stateless;
+
+import javax.ejb.Stateless;
+
+import examples.stateless.interfaces.TaxRate;
+
+@Stateless
+public class TaxRateBean implements TaxRate {
+ public double getTaxRate(String state) {
+ if (state.equalsIgnoreCase("ny")) {
+ return 0.0875;
+ }
+ else if (state.equalsIgnoreCase("nj")) {
+ return 0.03;
+ }
+ else {
+ return 0.0;
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/WEB-INF/web.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/WEB-INF/web.xml
new file mode 100644
index 0000000..0100696
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/WEB-INF/web.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <distributable/>
+
+ <servlet>
+ <display-name>PricerClient</display-name>
+ <servlet-name>PricerClient</servlet-name>
+ <servlet-class>examples.stateless.container.PricerClientServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <display-name>HelloWorld</display-name>
+ <servlet-name>HelloWorld</servlet-name>
+ <servlet-class>examples.stateless.container.HelloWorldServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>PricerClient</servlet-name>
+ <url-pattern>/PricerClient</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>HelloWorld</servlet-name>
+ <url-pattern>/HelloWorld</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/build.xml
new file mode 100644
index 0000000..389568b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/build.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-stateless" default="main" basedir="../../..">
+ <!-- basic settings -->
+ <property name="app.pkg" value="examples/stateless"/>
+ <property name="app.name" value="StatelessExamples"/>
+ <property name="create.client" value="true"/>
+ <property name="create.ejb" value="true"/>
+ <property name="create.war" value="true"/>
+ <property name="create.ear" value="true"/>
+ <property name="deploy" value="true"/>
+
+ <!-- Include common.xml -->
+ &include;
+
+ <target name="main" depends="compile.common,package.common,deploy.common"/>
+
+ <target name="run">
+ <antcall target="execClient">
+ <param name="client.class" value="examples.stateless.client.PricerClient"/>
+ </antcall>
+ </target>
+</project>
+
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/client/PricerClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/client/PricerClient.java
new file mode 100644
index 0000000..5762ab0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/client/PricerClient.java
@@ -0,0 +1,36 @@
+package examples.stateless.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.stateless.interfaces.PricerInjection;
+import examples.stateless.interfaces.PricerLookup;
+
+public class PricerClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+
+ // Prefixing the name with the pound sign (#) is a convention of Glassfish
+ // when using multiple interfaces to make up the business interface. The
+ // specification is unclear on how clients should lookup beans that implement
+ // more than one interface.
+
+ PricerLookup pricerLookup = (PricerLookup)ic.lookup("#"+PricerLookup.class.getName());
+ PricerInjection pricerInjection = (PricerInjection)ic.lookup("#"+PricerInjection.class.getName());
+ //PricerLookup pricerLookup = (PricerLookup)ic.lookup(PricerLookup.class.getName());
+ //PricerInjection pricerInjection = (PricerInjection)ic.lookup(PricerInjection.class.getName());
+ //Pricer pricerLookup = (Pricer)ic.lookup(Pricer.class.getName());
+ //Pricer pricerInjection = pricerLookup;
+
+ System.out.println("Tax (using lookup) on: 8.5 for State: ny is: "+
+ pricerLookup.getTaxLookup(8.5,"ny"));
+
+ System.out.println("Tax (using injection) on: 8.5 for State: ny is: "+
+ pricerInjection.getTaxInjection(8.5,"ny"));
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/HelloWorldServlet.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/HelloWorldServlet.java
new file mode 100644
index 0000000..61c78a6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/HelloWorldServlet.java
@@ -0,0 +1,54 @@
+package examples.stateless.container;
+
+import javax.ejb.EJB;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.http.HttpServlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import examples.stateless.interfaces.HelloWorld;
+
+/**
+ * Servlet Class
+ *
+ * @web.servlet name="HelloWorld"
+ * display-name="Name for HelloWorld"
+ * description="Description for HelloWorld"
+ * @web.servlet-mapping url-pattern="/HelloWorld"
+ * @web.servlet-init-param name="A parameter"
+ * value="A value"
+ */
+public class HelloWorldServlet extends HttpServlet {
+ @EJB HelloWorld hwInjected;
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException,
+ IOException {
+
+ doPost(req,resp);
+ }
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException,
+ IOException {
+
+ try {
+ InitialContext ic = new InitialContext();
+ HelloWorld hw = (HelloWorld)ic.lookup(HelloWorld.class.getName());
+
+ PrintWriter pw = resp.getWriter();
+ resp.setContentType("text/html");
+ pw.println("<h4>Lookup output: "+hw.hi()+"</h4>");
+ pw.println("<h4>Injection output: "+hwInjected.hi()+"</h4>");
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/PricerClientServlet.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/PricerClientServlet.java
new file mode 100644
index 0000000..09b59d6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/container/PricerClientServlet.java
@@ -0,0 +1,84 @@
+package examples.stateless.container;
+
+import javax.ejb.EJB;
+import javax.naming.InitialContext;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.servlet.http.HttpServlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import examples.stateless.interfaces.PricerInjection;
+import examples.stateless.interfaces.PricerLookup;
+
+/**
+ * Servlet Class
+ *
+ * @web.servlet name="PricerClient" display-name="Name for PricerClient"
+ * description="Description for PricerClient"
+ * @web.servlet-mapping url-pattern="/PricerClient"
+ * @web.servlet-init-param name="A parameter" value="A value"
+ */
+public class PricerClientServlet extends HttpServlet {
+ @EJB PricerInjection pi2;
+ @EJB PricerLookup pl2;
+
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ doPost(req, resp);
+ }
+
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ double price = 85.0;
+ String state = "ny";
+
+ PrintWriter pw = resp.getWriter();
+ resp.setContentType("text/html");
+ pw.println("<HTML>\n\t<BODY>");
+
+ try {
+ InitialContext ic = new InitialContext();
+ pw.println("<h3>Here are the JNDI names bound for beans in this example:</h3>");
+ pw.println("<ol>");
+ NamingEnumeration ne = ic.list("");
+ while (ne.hasMore()) {
+ NameClassPair ncp = (NameClassPair) ne.next();
+ pw.println("<li>" + ncp.getName());
+ }
+ pw.println("</ol>");
+
+ // Pricer pricer = (Pricer)ic.lookup(Pricer.class.getName());
+ PricerInjection pi = (PricerInjection)ic.lookup("#"+PricerInjection.class.getName());
+ PricerLookup pl = (PricerLookup)ic.lookup("#"+PricerLookup.class.getName());
+
+ pw.println("Tax (using lookup) on: " + price + " for State: "
+ + state + " is: " + pl.getTaxLookup(price, state) + "<br>");
+
+ pw.println("Tax (using injection) on: " + price + " for State: "
+ + state + " is: " + pi.getTaxInjection(price, state)
+ + "<br>");
+
+ pw.println("Tax (using lookup from @EJB) on: " + price + " for State: "
+ + state + " is: " + pl2.getTaxLookup(price, state) + "<br>");
+
+ pw.println("Tax (using injection @EJB) on: " + price + " for State: "
+ + state + " is: " + pi2.getTaxInjection(price, state)
+ + "<br>");
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+
+ pw.println("\t</BODY>\n</HTML>");
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java
new file mode 100644
index 0000000..853a891
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java
@@ -0,0 +1,18 @@
+package examples.stateless.interceptors;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class AuditorInterceptor {
+ @AroundInvoke
+ public Object checkCost(InvocationContext inv) throws Exception {
+ if (inv.getMethod().getName().startsWith("getTax")) {
+ Object[] o = inv.getParameters();
+ double cost = ((Double)o[0]).doubleValue();
+ if (cost > 50) {
+ System.out.println("Cost is > 50!");
+ }
+ }
+ return inv.proceed();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/LoggerInterceptor.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/LoggerInterceptor.java
new file mode 100644
index 0000000..ee37d23
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/LoggerInterceptor.java
@@ -0,0 +1,16 @@
+package examples.stateless.interceptors;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class LoggerInterceptor {
+ @AroundInvoke
+ public Object logger(InvocationContext inv) throws Exception {
+ System.out.println("Intercepted call via external class to: "+inv.getMethod().getName());
+ Object[] params = inv.getParameters();
+ for (int i=0;i<params.length;i++) {
+ System.out.println("\tparam: "+params[i]);
+ }
+ return inv.proceed();
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/HelloWorld.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/HelloWorld.java
new file mode 100644
index 0000000..5d99f5b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/HelloWorld.java
@@ -0,0 +1,8 @@
+package examples.stateless.interfaces;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface HelloWorld {
+ public String hi();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/Pricer.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/Pricer.java
new file mode 100644
index 0000000..9f74419
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/Pricer.java
@@ -0,0 +1,9 @@
+package examples.stateless.interfaces;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Pricer {
+ public double getTaxLookup(double cost, String state);
+ public double getTaxInjection(double cost, String state);
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerInjection.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerInjection.java
new file mode 100644
index 0000000..4fcecb5
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerInjection.java
@@ -0,0 +1,5 @@
+package examples.stateless.interfaces;
+
+public interface PricerInjection {
+ public double getTaxInjection(double cost, String state);
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerLookup.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerLookup.java
new file mode 100644
index 0000000..76996c6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/PricerLookup.java
@@ -0,0 +1,5 @@
+package examples.stateless.interfaces;
+
+public interface PricerLookup {
+ public double getTaxLookup(double cost, String state);
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/TaxRate.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/TaxRate.java
new file mode 100644
index 0000000..9ab2b8f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interfaces/TaxRate.java
@@ -0,0 +1,8 @@
+package examples.stateless.interfaces;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface TaxRate {
+ public double getTaxRate(String state);
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/jndi.properties b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/jndi.properties
new file mode 100644
index 0000000..483fac9
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/jndi.properties
@@ -0,0 +1,6 @@
+#java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+#java.naming.provider.url=corbaname:iiop:localhost:3700
+jndi.factory=com.sun.jndi.cosnaming.CNCtxFactory
+jndi.factory=com.sun.jndi.fscontext.RefFSContextFactory
+jndi.provider.url=corbaloc::localhost:3700/NameService
+#jndi.provider.url=file:c:
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/xdoclet-build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/xdoclet-build.xml
new file mode 100644
index 0000000..2d777d1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/xdoclet-build.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="_xdoclet_generation_" name="XDoclet Generator">
+<property file="xdoclet-build.properties"/>
+<property name="eclipse.home" value="C:/Java/eclipse"/>
+<property name="xdoclet.basedir" value="${eclipse.home}/plugins/org.jboss.ide.eclipse.xdoclet.core_1.5.0.RC1"/>
+<property name="jboss.net.version" value="4.0"/>
+<path id="project.classpath"><pathelement location="bin"/>
+<pathelement location="C:/Java/glassfish/lib/javaee.jar"/>
+<pathelement location="C:/Java/glassfish/lib/appserv-rt.jar"/>
+</path>
+<path id="xdoclet.classpath">
+<path refid="project.classpath"/>
+<fileset dir="${xdoclet.basedir}">
+<include name="*.jar"/>
+<exclude name="xdoclet-module-jboss-net-*.jar"/>
+</fileset>
+<fileset dir="${xdoclet.basedir}">
+<include name="xdoclet-module-jboss-net-${jboss.net.version}*.jar"/>
+</fileset>
+</path>
+<target name="_xdoclet_generation_" depends="N10004"/>
+<target name="N10004" description="web">
+<taskdef classpathref="xdoclet.classpath" classname="xdoclet.modules.web.WebDocletTask" name="webdoclet"/><webdoclet excludedTags="@version,@author,@todo" destDir="src" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}" >
+
+
+
+
+
+
+
+
+<fileset dir="src" includes="**/*.java" >
+
+
+
+</fileset>
+<deploymentdescriptor Servletspec="2.4" destDir="SupportFiles" >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</deploymentdescriptor>
+</webdoclet></target>
+</project>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Readme.txt b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Readme.txt
new file mode 100644
index 0000000..61983a1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Readme.txt
@@ -0,0 +1,9 @@
+Hello Reader,
+
+The code for this book has been organized into three sub-folders viz. Gerald Examples, Micah Examples, and Rima Examples. These sub-folders consists of the code for the chapters that the three of us were responsible for. Hence, under Gerald Examples, you should find code for the chapters 4, 5, 6, 7, 17, Appendix A, and Appendix B. Under Micah Examples, you should find code for the chapters 8, 9, and 11. And under Rima Examples, you should find code for the chapters 3, 12, and 15.
+
+To run these code samples, make sure that you have installed Glassfish properly, and changed the settings contained in /etc/common.properties and /etc/common.xml files in each of the above three sub-folders to suit your deployment. Wherever possible, we have provided READMEs to aid you.
+
+For further questions pertaining to code, you can reach the authors at gerald.brose@acm.org, ejb3@MPowerIT.com, and rima.patel@sun.com.
+
+Happy Reading! \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.classpath b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.classpath
new file mode 100644
index 0000000..af5c052
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 5.0"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/appserv-ws.jar"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/appserv-rt.jar"/>
+ <classpathentry kind="lib" path="C:/Programme/glassfish/lib/javaee.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.project b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.project
new file mode 100644
index 0000000..8f225f6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>EJB3-Examples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/client/LoanApplicationClient.jar b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/client/LoanApplicationClient.jar
new file mode 100644
index 0000000..d0255e6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/client/LoanApplicationClient.jar
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ear/CleanDayLimitOrders.ear b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ear/CleanDayLimitOrders.ear
new file mode 100644
index 0000000..66156e7
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ear/CleanDayLimitOrders.ear
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ejbjar/LoanApplicationEjb.jar b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ejbjar/LoanApplicationEjb.jar
new file mode 100644
index 0000000..141f1eb
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/ejbjar/LoanApplicationEjb.jar
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jar/EntityIntro.jar b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jar/EntityIntro.jar
new file mode 100644
index 0000000..5dcc517
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jar/EntityIntro.jar
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jnijar/JavaLoanApp.jar b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jnijar/JavaLoanApp.jar
new file mode 100644
index 0000000..a6f689f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/jnijar/JavaLoanApp.jar
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/rar/OutboundLoanRa.rar b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/rar/OutboundLoanRa.rar
new file mode 100644
index 0000000..6d8c6ba
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/assemble/rar/OutboundLoanRa.rar
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRates.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRates.class
new file mode 100644
index 0000000..60b19ca
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRates.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesBean.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesBean.class
new file mode 100644
index 0000000..e8b71cf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesBean.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesClient.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesClient.class
new file mode 100644
index 0000000..db0f77c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/loanratesejb/LoanRatesClient.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionFactoryImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionFactoryImpl.class
new file mode 100644
index 0000000..a96cfbe
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionFactoryImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionImpl.class
new file mode 100644
index 0000000..bcb283d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionMetaDataImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionMetaDataImpl.class
new file mode 100644
index 0000000..6a9741c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionMetaDataImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.class
new file mode 100644
index 0000000..bfc6cb8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionSpecImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionSpecImpl.class
new file mode 100644
index 0000000..bab7695
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ConnectionSpecImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/InteractionImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/InteractionImpl.class
new file mode 100644
index 0000000..121fb0e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/InteractionImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.class
new file mode 100644
index 0000000..ea7a8a6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionImpl.class
new file mode 100644
index 0000000..acd5489
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.class
new file mode 100644
index 0000000..73dc2cf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/MappedRecordImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/MappedRecordImpl.class
new file mode 100644
index 0000000..1ba8854
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/MappedRecordImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/RecordFactoryImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/RecordFactoryImpl.class
new file mode 100644
index 0000000..2a87db4
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/RecordFactoryImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.class
new file mode 100644
index 0000000..dd35805
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/jni/JavaLoanApp.class b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/jni/JavaLoanApp.class
new file mode 100644
index 0000000..97e5df6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/build/classes/examples/jni/JavaLoanApp.class
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.properties b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.properties
new file mode 100644
index 0000000..ddf8b69
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.properties
@@ -0,0 +1,32 @@
+#
+# Common properties, included by common.xml
+# Edit this file to reflect your environment.
+
+# local configuration parameters
+admin.password=adminadmin
+admin.host=localhost
+appserver.instance=server
+appserver.instance.port=8080
+admin.user=admin
+admin.port=4848
+domain.name=domain1
+
+#jndi.port=3700
+#jndi.factory=com.sun.jndi.cosnaming.CNCtxFactory
+#jndi.factory=com.sun.jndi.fscontext.RefFSContextFactory
+#jndi.provider.url=corbaloc::${admin.host}:${jndi.port}/NameService
+#jndi.provider.url=file:c:
+
+
+# The path seperator for the platform
+# Unix - :
+# Note for windows add the drive after the seperator
+# Windows - ;C:
+pathsep=;
+
+# The directory seperator for the platform
+# Unix - /
+# Windows - \
+#
+dirsep=/
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.xml
new file mode 100644
index 0000000..a228986
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/etc/common.xml
@@ -0,0 +1,764 @@
+<!--
+Common ant targets for Mastering EJB 3.0,
+
+This file is included from each chapter's build.xml files
+and does not need to be edited. To adapt the build environment,
+edit common.properties only.
+-->
+
+<!-- ======================================================== -->
+<!-- Application Server Common Properties -->
+<!-- ======================================================== -->
+
+<property file="${basedir}/etc/common.properties"/>
+<property environment="env"/>
+
+
+
+<!-- -->
+<!-- JBoss-specific properties -->
+<!-- -->
+
+<property name="jboss.home" value="${env.JBOSS_HOME}"/>
+<property name="jboss.server.config" value="all"/>
+<!-- <property name="deploy.dir" value="${jboss.home}/server/${jboss.server.config}/deploy"/> -->
+<property name="vendor.lib.dir1" value="c:/Programme/jboss-EJB-3.0_RC1/lib/ejb3.deployer"/>
+<property name="vendor.lib.dir2" value="${env.JBOSS_HOME}/client"/>
+<property name="vendor.deploy.dir" value="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer"/>
+<property name="vendor.ejb3-1.jar" value="jboss-ejb3.jar" />
+<property name="vendor.ejb3-2.jar" value="jboss-ejb3x.jar" />
+
+<!-- -->
+<!-- Sun-specific properties -->
+<!-- -->
+
+<!-- Source file location. -->
+<property name="src" value="./src"/>
+<property name="generated.dir" value="${src.dir}/generated" />
+<property name="src.docroot" value="${src}/docroot"/>
+<property name="appserver.home" value="${env.GLASSFISH_HOME}"/>
+<property name="deploy.dir" value="${env.GLASSFISH_HOME}/domains/domain1/autodeploy"/>
+
+<!-- Destination directory for the build and assembly targets -->
+<property name="build" value="./build"/>
+<property name="descriptors" value="./descriptors"/>
+<property name="build.classesdir" value="${build}/classes"/>
+<property name="assemble" value="./assemble"/>
+<property name="assemble.jar" value="${assemble}/jar"/>
+<property name="assemble.par" value="${assemble}/par"/>
+<property name="assemble.ejbjar" value="${assemble}/ejbjar"/>
+<property name="assemble.ear" value="${assemble}/ear"/>
+<property name="assemble.clientjar" value="${assemble}/client"/>
+<property name="assemble.war" value="${assemble}/war"/>
+<property name="assemble.rar" value="${assemble}/rar"/>
+
+<property name="service.wsdl"
+ value="http://${admin.host}:${appserver.instance.port}/${ServiceName}/${PortType}?WSDL" />
+
+
+<!-- some common file names -->
+<property name="ear" value="${appname}.ear"/>
+<property name="jar" value="${appname}.jar"/>
+<property name="par" value="${appname}.par"/>
+<property name="war" value="${appname}.war"/>
+<property name="rar" value="${raname}.rar"/>
+<property name="ejbjar" value="${appname}Ejb.jar"/>
+<property name="clientjar" value="${appname}Client.jar"/>
+<property name="earDD" value="application.xml"/>
+<property name="jarDD" value="ejb-jar.xml"/>
+<property name="sunjarDD" value="sun-ejb-jar.xml"/>
+<property name="wsDD" value="webservices.xml"/>
+<property name="warDD" value="web.xml,sun-web.xml,sun-jaxws.xml"/>
+
+<!--Rima added this property for the timer's managed client example-->
+<property name="clientDD" value="application-client.xml"/>
+
+<!--Rima added the following properties for the connector example-->
+<property name="assemble.jnijar" value="${assemble}/jnijar"/>
+<property name="jnijar" value="${jnijarname}.jar"/>
+<property name="rarDD" value="ra.xml"/>
+
+<!-- classpath jar files location. -->
+<property name="sample.classpath.dir" value="${appserver.home}/lib"/>
+<property name="optional.taskdef.jar" value="sun-appserv-ant.jar"/>
+
+<target name="setup_env"
+ depends="init_common">
+ <property name="admin.host" value="${as.env.AS_ADMIN_HOST}"/>
+ <property name="admin.port" value="${as.env.AS_ADMIN_PORT}"/>
+ <property name="admin.user" value="${as.env.AS_ADMIN_USER}"/>
+ <property name="admin.password" value="${as.env.AS_ADMIN_PASSWORD}"/>
+ <property name="appserver.instance" value="${as.env.AS_ADMIN_INSTANCE}"/>
+</target>
+
+<target name="init_common" depends="build_cpath">
+ <property name="classpath.prefix" value="."/>
+ <property name="classpath.suffix" value="."/>
+ <property name="build.classpath"
+ value="${classpath.prefix}:${build.classesdir}:${appserver.cpath}:${classpath.suffix}:${java.home}/../lib/tools.jar"/>
+ <property name="run.classpath"
+ value="${build.classpath}:${assemble.clientjar}/${clientjar}"/>
+ <taskdef name="apt" classname="com.sun.tools.ws.ant.Apt" >
+ <classpath refid="sample_classpath_jars"/>
+</taskdef>
+
+<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport" >
+ <classpath refid="sample_classpath_jars"/>
+</taskdef>
+
+<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen" >
+ <classpath refid="sample_classpath_jars"/>
+</taskdef>
+</target>
+
+<target name="build_cpath" unless="appserver.cpath">
+ <path id="sample_classpath_jars">
+ <fileset dir="${appserver.home}/lib" includes="*.jar" />
+ <pathelement location="${assemble.clientjar}/${clientjar}"/>
+ </path>
+
+ <pathconvert pathsep=";" property="appserver.cpath"
+ refid="sample_classpath_jars"/>
+</target>
+
+
+
+
+<!-- =============================== -->
+<!-- Compile all classes -->
+<!-- =============================== -->
+
+<target name="compile_common" depends="init_common">
+ <mkdir dir="${build.classesdir}"/>
+ <mkdir dir="${src}/generated"/>
+ <echo message="${pack.dir}" />
+ <javac srcdir="${pack.dir}"
+ destdir="${build.classesdir}"
+ classpath="${build.classpath}"/>
+</target>
+
+
+
+<!-- ======================================================= -->
+<!-- Clean up various files and directories. -->
+<!-- ======================================================= -->
+<target name="clean_clientjar_common">
+ <delete dir="${assemble.clientjar}"/>
+</target>
+
+
+<target name="clean_war_common">
+ <delete dir="${assemble.war}"/>
+</target>
+
+
+<target name="clean_ear_common">
+ <delete dir="${assemble.ear}"/>
+</target>
+
+<target name="clean_ejbjar_common">
+ <delete dir="${assemble.ejbjar}"/>
+</target>
+
+<target name="clean_rar_common">
+ <delete dir="${assemble.rar}"/>
+</target>
+
+<target name="clean_jar_common">
+ <delete dir="${assemble.jar}"/>
+</target>
+
+
+<target name="clean_common" >
+ <delete dir="${build.dir}"/>
+ <delete dir="${generated.dir}"/>
+</target>
+
+<!-- Rima commented this target -->
+<!--<target name="create_client_jar">-->
+<!-- <jar destfile="${assemble.clientjar}/${clientjar}">-->
+<!-- <zipfileset dir="${assemble.clientjar}" -->
+<!-- includes="**/*.class" /> -->
+<!-- <metainf dir="." includes="${assemble}/${clientDD}"/>-->
+<!-- </jar>-->
+<!--</target>-->
+
+<!-- ======================================================= -->
+<!-- Assemble EAR module. -->
+<!-- ======================================================= -->
+<target name="mkdir_ear">
+ <mkdir dir="${assemble.ear}/META-INF"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble WAR module. -->
+<!-- ======================================================= -->
+<target name="check_warfile">
+ <available file="${build.classesdir}" type="dir"
+ property="warfiles.present"/>
+</target>
+
+<target name="mkdir_war">
+ <mkdir dir="${assemble.war}"/>
+</target>
+
+
+
+<target name="add_docroot" if="docroot.present">
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <fileset dir="${src.docroot}" excludes="CVS,annotation"/>
+ </jar>
+</target>
+
+<target name="add_classes" if="warfiles.present">
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${src}/jsp/" includes="*.jsp" />
+ </jar>
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${build.classesdir}/${war.pkg}/" includes="**/*Servlet.class"
+ prefix="WEB-INF/classes/${war.pkg}"/>
+ </jar>
+</target>
+
+
+<target name="add_ejbjar_war" if="ejbjar.done">
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${assemble.ejbjar}" includes="${ejbjar}"
+ prefix="WEB-INF/lib"/>
+ </jar>
+</target>
+
+
+<target name="mkdir_ear_dir">
+ <mkdir dir="${assemble.ear}"/>
+</target>
+
+<target name="add_ejbjar" if="ejbjar.done">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ </jar>
+</target>
+
+<target name="add_war" if="war.done">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.war}" includes="${war}"/>
+ </jar>
+</target>
+
+<target name="add_clientjar" if="clientjar.done">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.clientjar}" includes="${clientjar}"/>
+ </jar>
+</target>
+
+<target name="create_ear_common" depends="clean_ear_common,mkdir_ear_dir,add_clientjar,add_war">
+<echo message="${src.dir}/${package}/META-INF/${earDD}"/>
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ <fileset dir="${assemble.ejbjar}" includes="sun-application.xml"/>
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${earDD}"/>
+ </jar>
+
+ <delete file="../${ejbjar}" />
+ <delete file="../${clientjar}" />
+</target>
+
+<target name="create_ear_common_with_clientjar" depends="clean_ear_common,mkdir_ear_dir,add_clientjar,add_war">
+ <jar destfile="${assemble.ear}/${ear}" update="true">
+ <fileset dir="${assemble.ejbjar}" includes="${ejbjar}"/>
+ <fileset dir="${assemble.ejbjar}" includes="${sun-ejbjar}"/>
+ <metainf dir="${assemble}" includes="${earDD}"/>
+
+ <!-- Rima added below line to make sure that EAR's DD is included -->
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${earDD}"/>
+
+
+ <fileset dir="${assemble.clientjar}" includes="${clientjar}"/>
+ <metainf dir="${assemble}" includes="${clientDD}"/>
+ </jar>
+
+ <delete file="../${ejbjar}" />
+ <delete file="../${clientjar}" />
+</target>
+
+
+<target name="create_war_common"
+ depends="mkdir_war,create_ejbjar_common">
+
+ <jar destfile="${assemble.war}/${war}" update="true">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"/>
+ </jar>
+ <echo message="${src.dir}/${package}/WEB-INF/${warDD}" />
+ <jar destfile="${assemble.war}/${war}" update="true" >
+ <fileset dir="${src.dir}/${package}" includes="WEB-INF/*.xml" />
+ </jar>
+ <property name="war.done" value="true"/>
+</target>
+
+
+
+<!-- ======================================================= -->
+<!-- Assemble EJB JAR module. -->
+<!-- ======================================================= -->
+<target name="create_ejbjar_common" depends="clean_ejbjar_common">
+ <mkdir dir="${assemble.ejbjar}"/>
+ <jar destfile="${assemble.ejbjar}/${ejbjar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${jar.pkg}"/>
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${jarDD}"/>
+ <fileset dir="${generated.dir}" includes="**"/>
+ </jar>
+
+ <property name="ejbjar.done" value="true"/>
+</target>
+
+<target name="create_ejbjar_ws_common" depends="clean_ejbjar_common">
+ <mkdir dir="${assemble.ejbjar}"/>
+ <mkdir dir="${assemble}/wsdl"/>
+ <copy file="${assemble}/${appname}.wsdl" todir="${assemble}/wsdl" failonerror="false"/>
+ <copy file="${assemble}/mapping.xml" todir="${assemble}/wsdl" failonerror="false"/>
+ <copy file="${src}/${wsDD}" todir="${assemble}/" failonerror="false"/>
+ <jar destfile="${assemble.ejbjar}/${ejbjar}">
+ <zipfileset dir="${build.classesdir}/${jar.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${jar.pkg}"/>
+ <metainf dir="${assemble}" includes="${jarDD},${sunjarDD},${wsDD},wsdl/**"/>
+ </jar>
+ <copy file="${assemble.ejbjar}/${ejbjar}" tofile="../${ejbjar}"/>
+ <property name="ejbjar.done" value="true"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble Connector RAR module. -->
+<!-- ======================================================= -->
+<target name="create_rar_common" depends="clean_rar_common">
+ <mkdir dir="${assemble.rar}"/>
+ <jar destfile="${assemble.rar}/${rar}">
+ <zipfileset dir="${build.classesdir}/${rar.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${rar.pkg}"/>
+
+ <fileset dir="${src.dir}/${rar.pkg}" includes="META-INF/${rarDD}"/>
+ <fileset dir="${generated.dir}" includes="**"/>
+
+ <!--Also include JNI Jar within the RAR module-->
+ <fileset file="${assemble.jnijar}/${jnijar}" includes="**"/>
+ </jar>
+
+ <copy file="${assemble.rar}/${rar}" tofile="../${rar}"/>
+ <delete file="../${rar}" />
+
+ <property name="rar.done" value="true"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble client JAR module. -->
+<!-- ======================================================= -->
+
+<target name="clientjar_common" depends="clean_clientjar_common">
+ <rmic classname="${remote.interface}"
+ classpath="${build}:${appserver.home}/lib/j2ee.jar:${appserver.home}/lib/appserv-ext.jar"
+ iiop="yes"
+ base="${build}"/>
+
+ <rmic classname="${remote.home}"
+ classpath="${build}:${appserver.home}/lib/j2ee.jar:${appserver.home}/lib/appserv-ext.jar"
+ iiop="yes"
+ base="${build}"/>
+
+ <mkdir dir="${assemble.clientjar}"/>
+ <jar destfile="${assemble.clientjar}/${clientjar}">
+ <zipfileset dir="${build.classesdir}"
+ includes="**/*.class" excludes="**/*Bean.class"/>
+<!-- prefix="${app.pkg}"/> -->
+ <metainf dir="." includes="${assemble}/${clientDD}"/>
+ </jar>
+
+ <jar destfile="${assemble.clientjar}/${clientjar}" update="true">
+ <zipfileset dir="${assemble}" includes="${clientDD}" prefix="META-INF"/>
+ </jar>
+
+ <property name="clientjar.done" value="true"/>
+</target>
+
+
+<target name="base_clientjar_common" depends="clean_clientjar_common">
+ <mkdir dir="${assemble.clientjar}"/>
+ <jar destfile="${assemble.clientjar}/${clientjar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/"
+ includes="**/*.class" excludes="**/*Bean.class, **/*Home.class"
+ prefix="${app.pkg}"/>
+ <metainf dir="." includes="${clientDD}"/>
+ </jar>
+
+ <jar destfile="${assemble.clientjar}/${clientjar}" update="true">
+ <zipfileset dir="${assemble}" includes="${clientDD}" prefix="META-INF"/>
+ </jar>
+
+ <property name="clientjar.done" value="true"/>
+</target>
+
+<!-- Rima added the below target to enable packaging of Java EE application clients-->
+
+<target name="app_clientjar_common" depends="clean_clientjar_common">
+ <mkdir dir="${assemble.clientjar}"/>
+ <jar destfile="${assemble.clientjar}/${clientjar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/"
+ includes="**/*.class" excludes="**/*Bean.class, **/*Home.class"
+ prefix="${app.pkg}"/>
+ <metainf dir="." includes="${clientDD}"/>
+
+ <fileset dir="${src.dir}/${package}" includes="META-INF/${clientDD}"/>
+
+ <manifest>
+ <attribute name="Main-Class" value="${client.class}"/>
+ </manifest>
+ </jar>
+
+ <jar destfile="${assemble.clientjar}/${clientjar}" update="true">
+ <zipfileset dir="${assemble}" includes="${clientDD}" prefix="META-INF"/>
+ </jar>
+
+ <property name="clientjar.done" value="true"/>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Assemble Simple JAR file. -->
+<!-- ======================================================= -->
+<target name="create_jar_common" depends="clean_jar_common">
+ <mkdir dir="${assemble.jar}"/>
+ <jar destfile="${assemble.jar}/${jar}">
+ <zipfileset dir="${build.classesdir}/${app.pkg}/" includes="**/*.class"
+ prefix="${app.pkg}"/>
+ </jar>
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Deploy CLI support. -->
+<!-- ======================================================= -->
+
+<!-- Name of the asadmin commands -->
+<property name="s1as.admin" value="${appserver.home}/bin/asadmin"/>
+
+<!-- determine which OS is being utilized. -->
+<target name="checkPlatform" >
+ <condition property ="isUnixPlatform">
+ <os family="unix"/>
+ </condition>
+ <condition property ="isWindowsPlatform">
+ <os family="windows"/>
+ </condition>
+</target>
+
+<!-- configUnix will be invoked when ant is being run on
+ unix/Linux. It will configure the values for ${os}
+ and ${dir.sep}
+-->
+<target name="configUnix" depends="checkPlatform" if="isUnixPlatform" >
+ <echo message="on unix"/>
+ <property name="dir.sep" value="/"/>
+ <property name="os" value="unix"/>
+ <property name="exec.asadmin" value="${s1as.admin}" />
+ <property name="exec.asadmin.part2" value="" />
+</target>
+
+<!--
+configWindows will be invoked when ant is being run on
+windows. It will configure the values for ${os}
+and ${dir.sep}
+-->
+
+<target name="configWindows" depends="checkPlatform" if="isWindowsPlatform" >
+ <echo message="on windows"/>
+ <property name="dir.sep" value="\\"/>
+ <property name="os" value="windows"/>
+ <property name="exec.asadmin" value="cmd.exe" />
+ <property name="exec.asadmin.part2" value= " /c ${s1as.admin}" />
+</target>
+
+
+
+<!-- ======================================================= -->
+<!-- Update target. -->
+<!-- ======================================================= -->
+
+<target name="update_common" depends="setup_env">
+ <echo message="Updating ${deploy.file}."/>
+ <sun-appserv-update file="${deploy.file}"/>
+</target>
+
+<!-- ======================================================= -->
+<!-- Deploy CLI support. -->
+<!-- ======================================================= -->
+
+<!-- Name of the asadmin commands -->
+<property name="s1as.admin" value="${appserver.home}/bin/asadmin"/>
+<property name="s1as.domain.dir" value="${appserver.home}/domains"/>
+<property name="s1as.domain.name" value="${domain.name}"/>
+<property name="s1as.domain" value="${s1as.domain.dir}/${s1as.domain.name}"/>
+
+<target name="configPlatform"
+ depends="checkPlatform, configUnix, configWindows"/>
+
+
+
+<!-- ======================================================= -->
+<!-- Install targets. -->
+<!-- ======================================================= -->
+
+<target name="deploy_common"
+ depends="checkPlatform, configUnix, configWindows">
+ <echo message="Deploying ${deploy.file}."/>
+ <copy file="${assemble.dir}/${deploy.file}" todir="${deploy.dir}"/>
+ <waitfor maxwait="100" maxwaitunit="second">
+ <or>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_deployed"/>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_deployFailed"/>
+ </or>
+ </waitfor>
+</target>
+
+<target name="deploy_connector_common"
+ depends="checkPlatform, configUnix, configWindows">
+ <echo message="Deploying ${assemble.rar}/${raname}.rar."/>
+ <exec executable="${exec.asadmin}" >
+ <arg line="${exec.asadmin.part2}" />
+ <arg line=" deploy"/>
+ <arg line=" --user ${admin.user}"/>
+ <arg line=" --password ${admin.password}"/>
+ <arg line=" --host ${admin.host}"/>
+ <arg line=" --port ${admin.port}"/>
+ <arg line=" --virtualservers ${appserver.instance}"/>
+ <arg line=" --force=true"/>
+ <arg line=" --name ${raname}"/>
+ <arg line=" --upload=true"/>
+ <arg line="${assemble.rar}/${raname}.rar"/>
+ </exec>
+</target>
+
+<target name="deploy_retrieve_common" depends="setup_env, checkPlatform, configUnix, configWindows">
+ <echo message="Deploying ${deploy.file} and retrieving client stubs."/>
+ <exec executable="${exec.asadmin}" >
+ <arg line="${exec.asadmin.part2}" />
+ <arg line=" deploy"/>
+ <arg line=" --user ${admin.user}"/>
+ <arg line=" --password ${admin.password}"/>
+ <arg line=" --host ${admin.host}"/>
+ <arg line=" --port ${admin.port}"/>
+ <arg line=" --virtualservers ${appserver.instance}"/>
+ <arg line=" --force=true"/>
+ <arg line=" --name ${appname}"/>
+ <arg line=" --upload=true"/>
+ <arg line=" --retrieve="/>
+ <arg line="${deploy.file}"/>
+ </exec>
+</target>
+
+<!-- Run stand-alone client target -->
+
+<target name="run_client_standalone" depends="setup_env">
+ <java classname="${client.class}" classpath="${build.classesdir};${appserver.home}/lib/appserv-rt.jar;${appserver.home}/lib/appserv-admin.jar;${appserver.home}/lib/javaee.jar;" fork="yes">
+ </java>
+</target>
+
+<!-- Run client target -->
+
+<!-- Rima commented this target and substituted it with the new run_client target-->
+<!--<target name="run_client" depends="setup_env">-->
+<!-- <java classname="${client.class}" classpath="${appserver.home}/lib;${assemble.clientjar}/${clientjar};${appserver.home}/lib/j2ee.jar;${appserver.home}/lib/appserv-ext.jar" fork="yes">-->
+<!-- <sysproperty key="java.naming.provider.url" value="corbaloc::localhost:3700/NameService"/>-->
+<!-- <sysproperty key="java.naming.factory.initial" value="com.sun.jndi.cosnaming.CNCtxFactory"/> -->
+<!-- </java>-->
+<!--</target>-->
+
+<target name="run_client" depends="setup_env">
+ <java classname="${client.class}" classpath="${assemble.ejbjar}/${ejbjar};${assemble.clientjar}/${clientjar};${appserver.home}/lib/appserv-rt.jar;${appserver.home}/lib/javaee.jar" fork="yes"/>
+</target>
+
+<!-- Rima added this target to make the client run in a Java EE Application Client container for the timer example-->
+
+<target name="run_client_in_appcontainer" depends="setup_env">
+ <condition property="appclient.executable" value="${appserver.home}/bin/appclient.bat">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="appclient.executable" value="${appserver.home}/bin/appclient">
+ <not>
+ <os family="windows"/>
+ </not>
+ </condition>
+
+ <exec executable="${appclient.executable}" dir="${basedir}">
+ <arg line="-client ${assemble.clientjar}/${clientjar}" />
+ </exec>
+</target>
+
+<!-- ======================================================= -->
+<!-- Uninstall targets. -->
+<!-- ======================================================= -->
+
+<target name="undeploy_common" depends="init_common" >
+ <echo message="undeploying ${appserver.home}/domains/domain1/autodeploy/${deploy.file}" />
+ <delete file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}"/>
+ <waitfor maxwait="100" maxwaitunit="second">
+ <or>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_undeployed"/>
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}_undeployFailed"/>
+ </or>
+ </waitfor>
+ <condition property="undeploy_succeeded">
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}.jar_undeployed"/>
+ </condition>
+ <condition property="undeploy_failed">
+ <available file="${appserver.home}/domains/domain1/autodeploy/${deploy.file}.jar_undeployFailed"/>
+ </condition>
+ <fail if="undeploy_failed" message="undeployment failed"/>
+</target>
+
+
+
+
+<!-- ======================================================= -->
+<!-- Admin targets. -->
+<!-- ======================================================= -->
+<target name="admin_command_common" depends="setup_env">
+ <echo message="Doing admin task ${admin.command}"/>
+ <sun-appserv-admin
+ command="${admin.command}"
+ user="${admin.user}"
+ password="${admin.password}"
+ host="${admin.host}"
+ port="${admin.port}"
+ sunonehome="${appserver.home}" />
+</target>
+
+<target name="reconfig_common">
+</target>
+
+
+<!-- ======================================================= -->
+<!-- Verify Targets. -->
+<!-- ======================================================= -->
+<target name="verify_common" depends="init_common">
+ <echo message="Verifying Process for ${verify.file}" />
+ <java classname="com.sun.enterprise.tools.verifier.Verifier" fork="yes" dir="." failonerror="true">
+ <sysproperty key="appserver.home" value="${appserver.home}"/>
+ <sysproperty key="com.sun.aas.verifier.xsl" value="${appserver.home}/lib/verifier/" />
+ <!-- uncomment the following for verbose output -->
+ <!--<arg value="-v"/>-->
+ <arg value="${verify.file}"/>
+ <classpath path="${build.classpath}"/>
+ </java>
+</target>
+
+<!-- ======================================================= -->
+<!-- Rima added these other connector specific targets -->
+<!-- ======================================================= -->
+
+<target name="compile_jni_common" depends="init_common">
+ <mkdir dir="${build.classesdir}"/>
+ <mkdir dir="${src}/generated"/>
+ <echo message="${jni.pack.dir}" />
+ <javac srcdir="${jni.pack.dir}"
+ destdir="${build.classesdir}"
+ classpath="${build.classpath}"/>
+</target>
+
+<target name="create_jnijar_common" depends="clean_jnijar_common">
+ <mkdir dir="${assemble.jnijar}"/>
+ <jar destfile="${assemble.jnijar}/${jnijar}">
+ <zipfileset dir="${build.classesdir}/${jniapp.pkg}/" includes="**/*.class"
+ excludes="**/servlet/, **/client/" prefix="${jniapp.pkg}"/>
+ </jar>
+
+ <property name="jnijar.done" value="true"/>
+</target>
+
+<target name="clean_jnijar_common">
+ <delete dir="${assemble.jnijar}"/>
+</target>
+
+<target name="compile_connector_common" depends="init_common">
+ <mkdir dir="${build.classesdir}"/>
+ <mkdir dir="${src}/generated"/>
+ <echo message="${connector.pack.dir}" />
+ <javac srcdir="${connector.pack.dir}"
+ destdir="${build.classesdir}"
+ classpath="${build.classpath};${assemble.jnijar}/${jnijar}"/>
+</target>
+
+<target name="create-connector-connection-pool_common" unless="connector.connection.pool.exists.common" depends="setup_env">
+ <antcall target="admin_command_common">
+ <param name="admin.command" value="create-connector-connection-pool --raname ${raname} --connectiondefinition ${connector.connectiondefinition} ${connector.connection.pool.name}"/>
+ </antcall>
+</target>
+
+<target name="delete-connector-connection-pool_common">
+ <antcall target="admin_command_common">
+ <param name="admin.command" value="delete-connector-connection-pool ${connector.connection.pool.name} " />
+ </antcall>
+</target>
+
+<target name="create-connector-resource_common" unless="connector.resource.exists.common" depends="setup_env">
+ <antcall target="admin_command_common">
+ <param name="admin.command" value="create-connector-resource --poolname ${connector.connection.pool.name} ${connector.connection.pool.jndiname}"/>
+ </antcall>
+</target>
+
+<target name="delete-connector-resource_common">
+ <antcall target="admin_command_common">
+ <param name="admin.command" value="delete-connector-resource ${connector.connection.pool.jndiname}"/>
+ </antcall>
+</target>
+
+<target name= "deploy-connector-resource_common" depends = "verify_connector_connection_pool_exists_common, verify_connector_resource_exists_common" >
+ <antcall target="create-connector-connection-pool_common"/>
+ <antcall target="create-connector-resource_common"/>
+</target>
+
+<target name="undeploy_connector_common" depends="setup_env">
+ <echo message="Undeploying ${raname}."/>
+ <sun-appserv-undeploy
+ name="${raname}"
+ user="${admin.user}"
+ password="${admin.password}"
+ host="${admin.host}"
+ port="${admin.port}"
+ sunonehome="${appserver.home}" />
+</target>
+
+<target name= "undeploy_connector_resource_common">
+ <antcall target="delete-connector-resource_common"/>
+ <antcall target="delete-connector-connection-pool_common"/>
+</target>
+
+<target name="verify_connector_connection_pool_exists_common" depends="setup_env, checkPlatform, configUnix, configWindows">
+ <exec executable="${exec.asadmin}" outputproperty="list.connector.connection.pools" failonerror="true">
+ <arg line="${exec.asadmin.part2}" />
+ <arg line=" list-connector-connection-pools"/>
+ <arg line=" --user ${admin.user}"/>
+ <arg line=" --password ${admin.password}"/>
+ <arg line=" --host ${admin.host}"/>
+ <arg line=" --port ${admin.port}"/>
+ </exec>
+ <condition property="connector.connection.pool.exists.common" value="true">
+ <contains string="${list.connector.connection.pools}" substring="${connector.connection.pool.name}" casesensitive="false"/>
+ </condition>
+</target>
+
+<target name="verify_connector_resource_exists_common" depends="setup_env, checkPlatform, configUnix, configWindows">
+ <exec executable="${exec.asadmin}" outputproperty="list.connector.resources" failonerror="true">
+ <arg line="${exec.asadmin.part2}" />
+ <arg line=" list-connector-resources"/>
+ <arg line=" --user ${admin.user}"/>
+ <arg line=" --password ${admin.password}"/>
+ <arg line=" --host ${admin.host}"/>
+ <arg line=" --port ${admin.port}"/>
+ </exec>
+ <condition property="connector.resource.exists.common" value="true">
+ <contains string="${list.connector.resources}" substring="${connector.connection.pool.jndiname}" casesensitive="false"/>
+ </condition>
+</target> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/Readme.txt b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/Readme.txt
new file mode 100644
index 0000000..98c39f3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/Readme.txt
@@ -0,0 +1,61 @@
+J2EE Connector Example
+----------------------
+
+The following are the steps to build, deploy, and run this sample.
+Make sure that the Java EE 5 server is running before deployment.
+
+1) Make sure the following DLLs are in the system classpath
+ (ideally, in c:\winnt\system32):
+ mfc71d.dll
+ msvcr71d.dll
+
+ You can download these DLLs from:
+ http://www.dll-files.com/dllindex/dll-files.shtml?mfc71d
+ http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71d
+
+2) Copy /src/examples/jni/nativelib/LoanApp.dll to your C drive
+ (C:\LoanApp.dll).
+
+3) Make sure that the appropriate security permissions are granted to
+ the resource adapter for linking the dynamic library (LoanApp.dll)
+ by inserting the following line in the java.policy file under
+ <JDK Installation Directory>\jre\lib\security directory.
+
+ permission java.lang.RuntimePermission "loadLibrary.*";
+
+4) Compile and jar the JavaLoanApp.java, which uses JNI calls to
+ invoke functionality of LoanApp.dll library, by typing the following:
+
+ asant jnijar
+
+5) Compile the connector source files and and create the corresponding
+ connector RAR file by using the following target:
+
+ asant rar
+
+6) Deploy the connector, alongwith connector resources such as
+ connector connection pool and the associated JNDI name resource.
+
+ asant deploy_connector
+
+7) Now compile LoanRatesEJB files and create the corresponding ejbjar.
+
+ asant jar
+
+8) Deploy LoanRatesEjb.
+
+ asant deploy_common
+
+9) Compile and jar the LoanRatesEJB client application.
+
+ asant base_clientjar_common.
+
+10) Turn off the firewall, if any, and run the client now.
+
+ asant run_client
+
+11) Undeploy the connector and the EJB, and delete the build classes
+
+ asant undeploy_connector
+ asant undeploy_common
+ asant clean_all \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/build.xml
new file mode 100644
index 0000000..f42b509
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-integration" default="jar"
+ basedir="../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="appname" value="LoanApplication"/>
+ <property name="client.class" value="examples.integration.loanratesejb.LoanRatesClient"/>
+ <property name="app.pkg" value="examples/integration/loanratesejb"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/integration/loanratesejb"/>
+
+ <!-- Connector specific properties -->
+
+ <property name="jnijarname" value="JavaLoanApp"/>
+ <property name="jniapp.pkg" value="examples/jni"/>
+ <property name="jni.pack.dir" value="${src.dir}/examples/jni"/>
+
+ <property name="raname" value="OutboundLoanRa"/>
+ <property name="rar.pkg" value="examples/integration/out_loan_ra"/>
+ <property name="connector.pack.dir" value="${src.dir}/examples/integration/out_loan_ra"/>
+ <property name="connector.connection.pool.name" value="OutboundLoanRaPool"/>
+ <property name="connector.connection.pool.jndiname" value="OutboundLoanJNDIName"/>
+ <property name="connector.connectiondefinition" value="javax.resource.cci.ConnectionFactory"/>
+
+
+ <!-- Include common.xml -->
+ &include;
+
+ <property name="assemble.dir" value="${assemble.ejbjar}"/>
+ <property name="deploy.file" value="${ejbjar}"/>
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+ <target name="ear" depends="jar,create_ear_common"/>
+
+ <target name="clean_all" depends="clean_common, clean_ejbjar_common, clean_clientjar_common, clean_jnijar_common, clean_rar_common"/>
+
+ <!-- Targets pertaining to Connector -->
+ <target name="jnijar" depends="compile_jni_common,create_jnijar_common"/>
+ <target name="rar" depends="compile_connector_common,create_rar_common"/>
+ <target name="deploy_connector" depends="deploy_connector_common, deploy-connector-resource_common"/>
+ <target name="undeploy_connector" depends="undeploy_connector_resource_common, undeploy_connector_common"/>
+</project> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRates.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRates.java
new file mode 100644
index 0000000..39efddd
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRates.java
@@ -0,0 +1,9 @@
+package examples.integration.loanratesejb;
+
+public interface LoanRates{
+
+ public float getHomeEquityRate();
+}
+
+
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesBean.java
new file mode 100644
index 0000000..f01f25e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesBean.java
@@ -0,0 +1,46 @@
+package examples.integration.loanratesejb;
+
+import javax.resource.cci.*;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.annotation.*;
+
+@Stateless
+@Remote(LoanRates.class)
+@TransactionManagement(TransactionManagementType.BEAN)
+public class LoanRatesBean implements LoanRates{
+
+ @Resource (name="OutboundLoanJNDIName")
+ public javax.resource.cci.ConnectionFactory connFactory;
+
+ public float getHomeEquityRate() {
+ float retVal=0;
+
+ System.out.println("LoanRatesBean.getHomeEquityRate() called");
+
+ try {
+ javax.resource.cci.Connection myCon = connFactory.getConnection();
+ javax.resource.cci.Interaction interaction = myCon.createInteraction();
+ javax.resource.cci.MappedRecord recordIn = connFactory.getRecordFactory().createMappedRecord("");
+
+ recordIn.put("HomeEquityRate","");
+
+ javax.resource.cci.MappedRecord recordOut =
+ (javax.resource.cci.MappedRecord)interaction.execute(null, (javax.resource.cci.Record)recordIn);
+
+ myCon.close();
+
+ Object result = recordOut.get("HomeEquityRate");
+ retVal = ((Float)result).floatValue();
+
+ } catch(Exception e) {
+
+ e.printStackTrace();
+ }
+
+ return retVal;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesClient.java
new file mode 100644
index 0000000..8a10952
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/loanratesejb/LoanRatesClient.java
@@ -0,0 +1,18 @@
+package examples.integration.loanratesejb;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Hashtable;
+import javax.naming.*;
+
+public class LoanRatesClient {
+
+ public static void main(String[] args) throws Exception{
+
+ Context ctx = new InitialContext();
+
+ LoanRates loanRates = (LoanRates) ctx.lookup("examples.integration.loanratesejb.LoanRates");
+
+ System.out.println("getHomeEquityRate() returned: " + loanRates.getHomeEquityRate() + ". Take a look at application server log or console for messages from LoanRatesEJB and OutboundLoanRA.");
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionFactoryImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionFactoryImpl.java
new file mode 100644
index 0000000..02e4aaf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionFactoryImpl.java
@@ -0,0 +1,69 @@
+package examples.integration.out_loan_ra;
+
+import java.io.*;
+
+import javax.resource.Referenceable;
+import javax.resource.*;
+import javax.resource.spi.*;
+import javax.naming.Reference;
+import javax.resource.cci.*;
+
+public class ConnectionFactoryImpl implements ConnectionFactory, Serializable, Referenceable {
+
+ private ManagedConnectionFactory manConnFactory;
+ private ConnectionManager connManager;
+ private Reference ref;
+
+ public ConnectionFactoryImpl(ManagedConnectionFactory manConnFactory, ConnectionManager connManager) {
+
+ System.out.println("ConnectionFactoryImpl(ManagedConnectionFactory manConnFactory, ConnectionManager connManager) called");
+
+ this.manConnFactory = manConnFactory;
+
+ this.connManager = connManager;
+ }
+
+ public javax.resource.cci.Connection getConnection() throws ResourceException {
+
+ System.out.println("ConnectionFactoryImpl.getConnection() called");
+
+ javax.resource.cci.Connection conn = null;
+
+ conn = (javax.resource.cci.Connection) connManager.allocateConnection(manConnFactory, null);
+
+ return conn;
+ }
+
+ public javax.resource.cci.Connection getConnection(ConnectionSpec cSpec) throws ResourceException {
+
+ System.out.println("ConnectionFactoryImpl.getConnection(ConnectionSpec cSpec) called");
+
+ javax.resource.cci.Connection conn = null;
+
+ ConnectionRequestInfo connRequestInfo = new ConnectionRequestInfoImpl();
+
+ conn = (javax.resource.cci.Connection) connManager.allocateConnection(manConnFactory, connRequestInfo);
+
+ return conn;
+ }
+
+ public ResourceAdapterMetaData getMetaData() throws ResourceException {
+
+ return new ResourceAdapterMetaDataImpl();
+ }
+
+ public RecordFactory getRecordFactory() throws ResourceException {
+
+ return new RecordFactoryImpl();
+ }
+
+ public void setReference(Reference ref) {
+
+ this.ref = ref;
+ }
+
+ public Reference getReference() {
+
+ return ref;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionImpl.java
new file mode 100644
index 0000000..5cd6b72
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionImpl.java
@@ -0,0 +1,54 @@
+package examples.integration.out_loan_ra;
+
+import java.util.*;
+
+import javax.resource.cci.*;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.IllegalStateException;
+import javax.resource.spi.*;
+import javax.resource.NotSupportedException;
+
+public class ConnectionImpl implements javax.resource.cci.Connection {
+
+ private ManagedConnectionImpl manConn;
+
+ ConnectionImpl(ManagedConnectionImpl manConn) {
+
+ System.out.println("ConnectionImpl(ManagedConnectionImpl) called");
+
+ this.manConn = manConn;
+ }
+
+ public Interaction createInteraction() throws ResourceException {
+
+ return new InteractionImpl(this);
+ }
+
+ public javax.resource.cci.LocalTransaction getLocalTransaction() throws ResourceException {
+
+ throw new NotSupportedException("Local transactions are not supported.");
+ }
+
+ public ResultSetInfo getResultSetInfo() throws ResourceException {
+
+ throw new NotSupportedException("ResultSet records are not supported.");
+ }
+
+ public void close() throws ResourceException {
+
+ System.out.println("ConnectionImpl.close() called");
+
+ if (manConn == null)
+ return;
+
+ manConn.sendEvent(ConnectionEvent.CONNECTION_CLOSED, null, this);
+
+ manConn = null;
+ }
+
+ public ConnectionMetaData getMetaData() throws ResourceException {
+
+ return new ConnectionMetaDataImpl(manConn);
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionMetaDataImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionMetaDataImpl.java
new file mode 100644
index 0000000..e51860b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionMetaDataImpl.java
@@ -0,0 +1,31 @@
+package examples.integration.out_loan_ra;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.*;
+import javax.resource.spi.*;
+
+public class ConnectionMetaDataImpl implements ConnectionMetaData {
+
+ private ManagedConnectionImpl manConn;
+
+ public ConnectionMetaDataImpl (ManagedConnectionImpl manConn) {
+
+ this.manConn = manConn;
+ }
+
+ public String getEISProductName() throws ResourceException {
+
+ return "Loan Application DLL";
+ }
+
+ public String getEISProductVersion() throws ResourceException {
+
+ return "1.0";
+ }
+
+ public String getUserName() throws ResourceException {
+
+ return null;
+ }
+}
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.java
new file mode 100644
index 0000000..cbfa9d8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionRequestInfoImpl.java
@@ -0,0 +1,27 @@
+package examples.integration.out_loan_ra;
+
+import javax.resource.spi.ConnectionRequestInfo;
+
+public class ConnectionRequestInfoImpl implements ConnectionRequestInfo {
+
+ public ConnectionRequestInfoImpl() {
+ }
+
+ public boolean equals(Object object) {
+
+ if (object == null) return false;
+
+ if (object instanceof ConnectionRequestInfoImpl) {
+
+ return true;
+ } else {
+
+ return false;
+ }
+ }
+
+ public int hashCode() {
+
+ return (new String("ConnectionRequestInfoImpl")).hashCode();
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionSpecImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionSpecImpl.java
new file mode 100644
index 0000000..dd426f0
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ConnectionSpecImpl.java
@@ -0,0 +1,9 @@
+package examples.integration.out_loan_ra;
+
+import javax.resource.cci.*;
+
+public class ConnectionSpecImpl implements ConnectionSpec {
+
+ public ConnectionSpecImpl() {
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java
new file mode 100644
index 0000000..2f532f9
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/InteractionImpl.java
@@ -0,0 +1,96 @@
+package examples.integration.out_loan_ra;
+
+import examples.jni.JavaLoanApp;
+
+import java.util.*;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.IllegalStateException;
+import javax.resource.cci.*;
+import java.lang.reflect.*;
+import java.lang.*;
+
+public class InteractionImpl implements Interaction {
+
+ Connection conn = null;
+
+ public InteractionImpl(Connection conn) {
+
+ System.out.println("InteractionImpl(Connection conn) called");
+
+ this.conn = conn;
+ }
+
+ public javax.resource.cci.Connection getConnection() {
+
+ return conn;
+ }
+
+ public void close() throws ResourceException {
+
+ conn = null;
+ }
+
+ public boolean execute (InteractionSpec iSpec, Record in, Record out) throws ResourceException {
+
+ System.out.println ("InteractionImpl.execute(InteractionSpec iSpec, Record in, Record out) called");
+
+ out = exec((MappedRecord)in,(MappedRecord)out);
+
+ if (out != null) {
+
+ return true;
+ } else {
+
+ return false;
+ }
+ }
+
+ public Record execute (InteractionSpec iSpec, Record in) throws ResourceException {
+
+ System.out.println ("InteractionImpl.execute(InteractionSpec iSpec, Record in) called");
+
+ MappedRecord out = new MappedRecordImpl();
+
+ return exec((MappedRecord)in, out);
+ }
+
+ Record exec(MappedRecord in, MappedRecord out) throws ResourceException {
+
+ try {
+
+ System.out.println("InteractionImpl.exec(MappedRecord in, MappedRecord out) called");
+
+ Set keys = in.keySet();
+ Iterator iterator = keys.iterator();
+
+ while (iterator.hasNext()) {
+
+ String key = (String)iterator.next();
+
+ if (key.equalsIgnoreCase("HomeEquityRate")) {
+
+ JavaLoanApp jlaObj = new JavaLoanApp("C:\\LoanApp.dll");
+ float equityRate = jlaObj.getHomeEquityLoanRate();
+ System.out.println ("JNI Call Returned: " + equityRate);
+ out.put(key, new Float(equityRate));
+ }
+ }
+
+ return out;
+ }
+ catch(Exception e) {
+
+ throw new ResourceException(e.getMessage());
+ }
+ }
+
+ public ResourceWarning getWarnings() throws ResourceException {
+
+ return null;
+ }
+
+ public void clearWarnings() throws ResourceException {
+
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/META-INF/ra.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/META-INF/ra.xml
new file mode 100644
index 0000000..7e08c79
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/META-INF/ra.xml
@@ -0,0 +1,28 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<connector
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ version="1.5"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ >
+ <display-name>OutboundLoanRa</display-name>
+ <vendor-name>Vendor Name</vendor-name>
+ <eis-type>EIS Type</eis-type>
+ <resourceadapter-version>1.5</resourceadapter-version>
+ <license>
+ <license-required>false</license-required>
+ </license>
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>examples.integration.out_loan_ra.ManagedConnectionFactoryImpl</managedconnectionfactory-class>
+ <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>examples.integration.out_loan_ra.ConnectionFactoryImpl</connectionfactory-impl-class>
+ <connection-interface>javax.resource.cci.Connection</connection-interface>
+ <connection-impl-class>examples.integration.out_loan_ra.ConnectionImpl</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.java
new file mode 100644
index 0000000..3d3407e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionFactoryImpl.java
@@ -0,0 +1,100 @@
+package examples.integration.out_loan_ra;
+
+import java.io.*;
+import java.util.*;
+
+import javax.resource.*;
+import javax.resource.spi.*;
+import javax.resource.spi.security.PasswordCredential;
+import javax.resource.spi.SecurityException;
+import javax.security.auth.Subject;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+public class ManagedConnectionFactoryImpl implements ManagedConnectionFactory, Serializable {
+
+ private PrintWriter manConnLogWriter;
+
+ public ManagedConnectionFactoryImpl() {
+
+ System.out.println("ManagedConnectionFactoryImpl() called");
+ }
+
+ public Object createConnectionFactory(ConnectionManager connManager) throws ResourceException {
+
+ System.out.println("ManagedConnectionFactoryImpl.createConnectionFactory(ConnectionManager) called");
+
+ return new ConnectionFactoryImpl(this, connManager);
+ }
+
+ public Object createConnectionFactory() throws ResourceException {
+ throw new ResourceException ("How can you call this method in a managed environment?");
+ }
+
+
+ public ManagedConnection createManagedConnection (Subject subject, ConnectionRequestInfo connRequestInfo) {
+
+ System.out.println ("ManagedConnectionFactoryImpl.createManagedConnection (Subject, ConnectionRequestInfo) called");
+
+ return new ManagedConnectionImpl (this);
+ }
+
+
+ public ManagedConnection matchManagedConnections(Set connSet, Subject subject, ConnectionRequestInfo connRequestInfo)
+ throws ResourceException {
+
+ System.out.println("ManagedConnectionFactoryImpl.matchManagedConnections(Set, Subject, ConnectionRequestInfo) called");
+
+ Iterator iterator = connSet.iterator();
+
+ while (iterator.hasNext()) {
+
+ Object object = iterator.next();
+
+ if (object instanceof ManagedConnectionImpl) {
+
+ ManagedConnectionImpl manConn = (ManagedConnectionImpl) object;
+ ManagedConnectionFactory manConnFactory = manConn.getManagedConnectionFactory();
+
+ if (manConnFactory.equals(this)) {
+
+ System.out.println("From ManagedConnectionFactoryImpl.matchManagedConnections() -> Connection matched");
+
+ return manConn;
+ }
+ }
+ }
+
+ System.out.println("From ManagedConnectionFactoryImpl.matchManagedConnections() -> Connection did not match");
+
+ return null;
+ }
+
+ public void setLogWriter(PrintWriter manConnLogWriter) {
+
+ this.manConnLogWriter = manConnLogWriter;
+ }
+
+ public PrintWriter getLogWriter() {
+
+ return manConnLogWriter;
+ }
+
+ public boolean equals(Object object) {
+
+ if (object == null) return false;
+
+ if (object instanceof ManagedConnectionFactoryImpl) {
+
+ return true;
+ } else {
+
+ return false;
+ }
+ }
+
+ public int hashCode() {
+
+ return (new String("ManagedConnectionFactoryImpl")).hashCode();
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionImpl.java
new file mode 100644
index 0000000..2087172
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionImpl.java
@@ -0,0 +1,135 @@
+package examples.integration.out_loan_ra;
+
+import java.io.*;
+import java.util.*;
+
+import javax.resource.*;
+import javax.resource.spi.*;
+import javax.resource.spi.security.PasswordCredential;
+import javax.resource.spi.IllegalStateException;
+import javax.resource.spi.SecurityException;
+import javax.resource.NotSupportedException;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+public class ManagedConnectionImpl implements ManagedConnection {
+
+ private ConnectionEventListener connEventListener;
+ private ManagedConnectionFactory manConnFactory;
+ private boolean isDestroyed;
+ private PrintWriter manConnLogWriter;
+
+ ManagedConnectionImpl (ManagedConnectionFactory manConnFactory) {
+
+ System.out.println("ManagedConnectionImpl(ManagedConnectionFactory) called");
+
+ this.manConnFactory = manConnFactory;
+ }
+
+ public Object getConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo)
+ throws ResourceException {
+
+ System.out.println("ManagedConnectionImpl.getConnection(Subject, ConnectionRequestInfo) called");
+
+ ConnectionImpl conn = new ConnectionImpl(this);
+
+ return conn;
+ }
+
+ public void destroy() throws ResourceException {
+
+ System.out.println("ManagedConnectionImpl.destroy() called");
+
+ isDestroyed=true;
+
+ cleanup();
+ }
+
+ public void cleanup() throws ResourceException {
+
+ System.out.println("ManagedConnectionImpl.cleanup() called");
+ }
+
+ public void associateConnection(Object connection) throws ResourceException {
+
+ throw new NotSupportedException("ManagedConnectionImpl.associateConnection() not supported.");
+ }
+
+ public void addConnectionEventListener(ConnectionEventListener connEventListener) {
+
+ System.out.println("ManagedConnectionImpl.addConnectionEventListener(ConnectionEventListener) called");
+
+ this.connEventListener = connEventListener;
+ }
+
+ public void removeConnectionEventListener (ConnectionEventListener connEventListener) {
+
+ }
+
+ public XAResource getXAResource() throws ResourceException {
+
+ throw new NotSupportedException("Global transactions are not supported");
+ }
+
+ public LocalTransaction getLocalTransaction() throws ResourceException {
+
+ throw new NotSupportedException("Local transactions are not supported");
+ }
+
+ public ManagedConnectionMetaData getMetaData() throws ResourceException {
+
+ if (isDestroyed)
+ throw new ResourceException ("Managed connection has already been closed.");
+
+ return new ManagedConnectionMetaDataImpl (this);
+ }
+
+ public void setLogWriter(PrintWriter manConnLogWriter) {
+
+ this.manConnLogWriter = manConnLogWriter;
+ }
+
+ public PrintWriter getLogWriter() {
+
+ return manConnLogWriter;
+ }
+
+ void sendEvent(int eventType, Exception e, Object connHandle) {
+
+ System.out.println("ManagedConnectionImpl.sendEvent(int, e, connHandle) called");
+
+ ConnectionEvent connEvent = null;
+
+ if (e == null)
+ connEvent = new ConnectionEvent(this, eventType);
+ else
+ connEvent = new ConnectionEvent(this, eventType, e);
+
+ connEvent.setConnectionHandle(connHandle);
+
+ switch (connEvent.getId()) {
+ case ConnectionEvent.CONNECTION_CLOSED:
+ this.connEventListener.connectionClosed(connEvent);
+ break;
+ case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
+ this.connEventListener.localTransactionStarted(connEvent);
+ break;
+ case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
+ this.connEventListener.localTransactionCommitted(connEvent);
+ break;
+ case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
+ this.connEventListener.localTransactionRolledback(connEvent);
+ break;
+ case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
+ this.connEventListener.connectionErrorOccurred(connEvent);
+ break;
+ default:
+ throw new IllegalArgumentException("Unsupported event: " + connEvent.getId());
+ }
+ }
+
+ ManagedConnectionFactory getManagedConnectionFactory() {
+
+ return manConnFactory;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.java
new file mode 100644
index 0000000..cc47162
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ManagedConnectionMetaDataImpl.java
@@ -0,0 +1,35 @@
+package examples.integration.out_loan_ra;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.IllegalStateException;
+import javax.resource.spi.*;
+
+public class ManagedConnectionMetaDataImpl implements ManagedConnectionMetaData {
+
+ private ManagedConnectionImpl manConn;
+
+ public ManagedConnectionMetaDataImpl(ManagedConnectionImpl manConn) {
+
+ this.manConn = manConn;
+ }
+
+ public String getEISProductName() throws ResourceException {
+
+ return "Loan Application DLL";
+ }
+
+ public String getEISProductVersion() throws ResourceException {
+
+ return "1.0";
+ }
+
+ public int getMaxConnections() throws ResourceException {
+
+ return 1;
+ }
+
+ public String getUserName() throws ResourceException {
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/MappedRecordImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/MappedRecordImpl.java
new file mode 100644
index 0000000..7ade217
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/MappedRecordImpl.java
@@ -0,0 +1,121 @@
+package examples.integration.out_loan_ra;
+
+import java.util.*;
+
+public class MappedRecordImpl implements javax.resource.cci.MappedRecord {
+
+ private String recordName;
+ private String recordDescription;
+ private HashMap mappedRecord;
+
+ public MappedRecordImpl() {
+
+ mappedRecord = new HashMap();
+ }
+
+ public MappedRecordImpl (String recordName) {
+
+ mappedRecord = new HashMap();
+ this.recordName = recordName;
+ }
+
+ public String getRecordName() {
+
+ return this.recordName;
+ }
+
+ public void setRecordName(String recordName) {
+
+ this.recordName = recordName;
+ }
+
+ public String getRecordShortDescription() {
+
+ return recordDescription;
+ }
+
+ public void setRecordShortDescription(String recordDescription) {
+
+ this.recordDescription = recordDescription;
+ }
+
+ public boolean equals(Object object) {
+
+ if(!(object instanceof MappedRecordImpl))
+ return false;
+
+ MappedRecordImpl mappedRecordObject = (MappedRecordImpl)object;
+
+ return (recordName == mappedRecordObject.recordName) && mappedRecord.equals(mappedRecordObject.mappedRecord);
+ }
+
+ public int hashCode() {
+
+ return (new String("MappedRecordImpl")).hashCode();
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+
+ return this.clone();
+ }
+
+ public void clear() {
+
+ mappedRecord.clear();
+ }
+
+ public boolean containsKey(Object key) {
+
+ return mappedRecord.containsKey(key);
+ }
+
+ public boolean containsValue(Object value) {
+
+ return mappedRecord.containsValue(value);
+ }
+
+ public Set entrySet() {
+
+ return mappedRecord.entrySet();
+ }
+
+ public Object get(Object object) {
+
+ return mappedRecord.get(object);
+ }
+
+ public boolean isEmpty(){
+
+ return mappedRecord.isEmpty();
+ }
+
+ public Set keySet(){
+
+ return mappedRecord.keySet();
+ }
+
+ public Object put(Object key, Object value) {
+
+ return mappedRecord.put(key, value);
+ }
+
+ public void putAll(Map map) {
+
+ mappedRecord.putAll (map);
+ }
+
+ public Object remove(Object object) {
+
+ return mappedRecord.remove(object);
+ }
+
+ public int size() {
+
+ return mappedRecord.size();
+ }
+
+ public Collection values() {
+
+ return mappedRecord.values();
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/RecordFactoryImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/RecordFactoryImpl.java
new file mode 100644
index 0000000..d3f051a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/RecordFactoryImpl.java
@@ -0,0 +1,20 @@
+package examples.integration.out_loan_ra;
+
+import javax.resource.cci.*;
+import java.util.Map;
+import java.util.Collection;
+import javax.resource.ResourceException;
+import javax.resource.NotSupportedException;
+
+public class RecordFactoryImpl implements javax.resource.cci.RecordFactory{
+
+ public MappedRecord createMappedRecord(String recordName) throws ResourceException {
+
+ return new MappedRecordImpl(recordName);
+ }
+
+ public IndexedRecord createIndexedRecord(String recordName) throws ResourceException {
+
+ throw new NotSupportedException("IndexedRecords are not supported.");
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.java
new file mode 100644
index 0000000..44c153f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/integration/out_loan_ra/ResourceAdapterMetaDataImpl.java
@@ -0,0 +1,124 @@
+package examples.integration.out_loan_ra;
+
+import java.io.*;
+
+import javax.resource.Referenceable;
+import javax.resource.*;
+import javax.resource.spi.*;
+import javax.naming.Reference;
+import javax.resource.cci.*;
+
+public class ResourceAdapterMetaDataImpl implements ResourceAdapterMetaData {
+
+ private String adapterName;
+ private String adapterShortDescription;
+ private String adapterVendorName;
+ private String adapterVersion;
+ private String[] interactionSpecsSupported;
+ private String specVersion;
+ private boolean supportsExecuteWithInputAndOutputRecord;
+ private boolean supportsExecuteWithInputRecordOnly;
+ private boolean supportsLocalTransactionDemarcation;
+
+ // Additional properties
+ private boolean supportsGlobalTransactions;
+ private boolean supportsLifecycleManagement;
+ private boolean supportsMessageInflow;
+ private boolean supportsTransactionInflow;
+ private boolean supportsConnectionManagement;
+ private boolean supportsSecurityManagement;
+
+ public ResourceAdapterMetaDataImpl() {
+
+ adapterName = "Loan Application Resource Adapter";
+ adapterShortDescription = "Loan Application Resource Adapter provides connectivity to Loan Application DLL";
+ adapterVendorName = "Connectors Inc.";
+ adapterVersion = "1.0";
+ interactionSpecsSupported[0] = "InteractionImpl";
+ specVersion = "1.5";
+ supportsExecuteWithInputAndOutputRecord = true;
+ supportsExecuteWithInputRecordOnly = true;
+ supportsLocalTransactionDemarcation = false;
+ supportsGlobalTransactions = false;
+ supportsLifecycleManagement = false;
+ supportsMessageInflow = false;
+ supportsTransactionInflow = false;
+ supportsConnectionManagement = true;
+ supportsSecurityManagement = false;
+ }
+
+ public String getAdapterName() {
+
+ return adapterName;
+ }
+
+ public String getAdapterShortDescription() {
+
+ return adapterShortDescription;
+ }
+
+ public String getAdapterVendorName() {
+
+ return adapterVendorName;
+ }
+
+ public String getAdapterVersion() {
+
+ return adapterVersion;
+ }
+
+ public String[] getInteractionSpecsSupported() {
+
+ return interactionSpecsSupported;
+ }
+
+ public String getSpecVersion() {
+
+ return specVersion;
+ }
+
+ public boolean supportsExecuteWithInputAndOutputRecord() {
+
+ return supportsExecuteWithInputAndOutputRecord;
+ }
+
+ public boolean supportsExecuteWithInputRecordOnly() {
+
+ return supportsExecuteWithInputRecordOnly;
+ }
+
+ public boolean supportsLocalTransactionDemarcation() {
+
+ return supportsLocalTransactionDemarcation;
+ }
+
+ public boolean supportsGlobalTransactions() {
+
+ return supportsGlobalTransactions;
+ }
+
+ public boolean supportsLifecycleManagement() {
+
+ return supportsLifecycleManagement;
+ }
+
+ public boolean supportsMessageInflow() {
+
+ return supportsMessageInflow;
+ }
+
+ public boolean supportsTransactionInflow() {
+
+ return supportsTransactionInflow;
+ }
+
+ public boolean supportsConnectionManagement() {
+
+ return supportsConnectionManagement;
+ }
+
+ public boolean supportsSecurityManagement() {
+
+ return supportsSecurityManagement;
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/JavaLoanApp.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/JavaLoanApp.java
new file mode 100644
index 0000000..4a23e0d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/JavaLoanApp.java
@@ -0,0 +1,20 @@
+package examples.jni;
+
+public class JavaLoanApp
+{
+
+ public JavaLoanApp(String libPath) {
+
+ System.load(libPath);
+ }
+
+ /* Use this function to unit test whether the library is being loaded properly */
+ /*
+ public static void main(String args[])
+ {
+ JavaLoanApp jla = new JavaLoanApp("c:\\LoanApp.dll");
+ System.out.println ("Here is the output from the JNI call: " + jla.getHomeEquityLoanRate());
+ }*/
+
+ public native float getHomeEquityLoanRate();
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/BuildLog.htm b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/BuildLog.htm
new file mode 100644
index 0000000..86c5e67
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/BuildLog.htm
@@ -0,0 +1,52 @@
+<html>
+<head>
+<META HTTP-EQUIV="Content-Type" content="text/html; charset=Windows-1252">
+</head>
+<body>
+<pre>
+<table width=100% bgcolor=#CFCFE5><tr> <td> <font face=arial size=+3>
+Build Log
+</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
+<h3>------- Build started: Project: LoanApp, Configuration: Debug|Win32 -------
+</h3>
+</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
+Command Lines
+</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Creating temporary file "c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\RSP000001.rsp" with contents
+[
+/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Zc:wchar_t /Yu"stdafx.h" /Fp"Debug/LoanApp.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP /I "C:\Sun\J2SDKEE1.4\jdk\include"
+/I "C:\Sun\J2SDKEE1.4\jdk\include\win32"
+.\LoanApp.cpp
+]
+Creating command line "cl.exe @c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\RSP000001.rsp /nologo"
+Creating temporary file "c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\RSP000002.rsp" with contents
+[
+/Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Zc:wchar_t /Yc"stdafx.h" /Fp"Debug/LoanApp.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP /I "C:\Sun\J2SDKEE1.4\jdk\include"
+/I "C:\Sun\J2SDKEE1.4\jdk\include\win32"
+.\stdafx.cpp
+]
+Creating command line "cl.exe @c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\RSP000002.rsp /nologo"
+Creating command line "rc.exe /d "_DEBUG" /d "_AFXDLL" /l 0x409 /I "Debug" /fo"Debug/LoanApp.res" .\LoanApp.rc"
+Creating temporary file "c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\RSP000003.rsp" with contents
+[
+/OUT:"Debug/LoanApp.dll" /INCREMENTAL /NOLOGO /DLL /DEF:".\LoanApp.def" /DEBUG /PDB:"Debug/LoanApp.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"Debug/LoanApp.lib" /MACHINE:X86
+.\Debug\LoanApp.obj
+.\Debug\stdafx.obj
+.\Debug\LoanApp.res
+]
+Creating command line "link.exe @c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\RSP000003.rsp"
+</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
+Output Window
+</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>Compiling...
+stdafx.cpp
+Compiling...
+LoanApp.cpp
+c:\temp\3eCode\Integration\src\examples\jni\LoanApp\LoanApp.h(33) : warning C4305: 'return' : truncation from 'double' to 'jfloat'
+Compiling resources...
+Linking...
+ Creating library Debug/LoanApp.lib and object Debug/LoanApp.exp
+</pre></table><table width=100% bgcolor=#DFDFE5><tr><td><font face=arial size=+2>
+Results
+</font></table><table width=* cellspacing=0 cellpadding=0><tr><td width=0 bgcolor=#EDEDF5>&nbsp;</td><td width=0 bgcolor=#FFFFFF>&nbsp;</td><td width=*><pre>
+Build log was saved at "file://c:\temp\3eCode\Integration\src\examples\jni\LoanApp\Debug\BuildLog.htm"
+LoanApp - 0 error(s), 1 warning(s)</pre></table><table width=100% height=20 bgcolor=#CFCFE5><tr><td><font face=arial size=+2>
+</font></table></body></html> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.dll b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.dll
new file mode 100644
index 0000000..a288419
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.dll
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.exp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.exp
new file mode 100644
index 0000000..d4ffd8d
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.exp
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.ilk b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.ilk
new file mode 100644
index 0000000..a87dd3b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.ilk
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.lib b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.lib
new file mode 100644
index 0000000..774cb22
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.lib
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.obj b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.obj
new file mode 100644
index 0000000..b6f3a3f
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.obj
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pch b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pch
new file mode 100644
index 0000000..8da2235
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pch
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pdb b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pdb
new file mode 100644
index 0000000..715d9d6
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.pdb
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.res b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.res
new file mode 100644
index 0000000..cefd6e4
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/LoanApp.res
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/stdafx.obj b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/stdafx.obj
new file mode 100644
index 0000000..2c8bca3
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/stdafx.obj
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.idb b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.idb
new file mode 100644
index 0000000..afd4952
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.idb
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.pdb b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.pdb
new file mode 100644
index 0000000..e390469
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Debug/vc70.pdb
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.cpp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.cpp
new file mode 100644
index 0000000..fc447b2
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.cpp
@@ -0,0 +1,65 @@
+// LoanApp.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include "LoanApp.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+// Note!
+//
+// If this DLL is dynamically linked against the MFC
+// DLLs, any functions exported from this DLL which
+// call into MFC must have the AFX_MANAGE_STATE macro
+// added at the very beginning of the function.
+//
+// For example:
+//
+// extern "C" BOOL PASCAL EXPORT ExportedFunction()
+// {
+// AFX_MANAGE_STATE(AfxGetStaticModuleState());
+// // normal function body here
+// }
+//
+// It is very important that this macro appear in each
+// function, prior to any calls into MFC. This means that
+// it must appear as the first statement within the
+// function, even before any object variable declarations
+// as their constructors may generate calls into the MFC
+// DLL.
+//
+// Please see MFC Technical Notes 33 and 58 for additional
+// details.
+//
+
+// CLoanAppApp
+
+BEGIN_MESSAGE_MAP(CLoanAppApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CLoanAppApp construction
+
+CLoanAppApp::CLoanAppApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CLoanAppApp object
+
+CLoanAppApp theApp;
+
+
+// CLoanAppApp initialization
+
+BOOL CLoanAppApp::InitInstance()
+{
+ CWinApp::InitInstance();
+
+ return TRUE;
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.def b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.def
new file mode 100644
index 0000000..382f22e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.def
@@ -0,0 +1,6 @@
+; LoanApp.def : Declares the module parameters for the DLL.
+
+LIBRARY "LoanApp"
+
+EXPORTS
+ ; Explicit exports can go here
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.h b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.h
new file mode 100644
index 0000000..db9c166
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.h
@@ -0,0 +1,34 @@
+// LoanApp.h : main header file for the LoanApp DLL
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CLoanAppApp
+// See LoanApp.cpp for the implementation of this class
+//
+
+#include "examples_jni_JavaLoanApp.h"
+
+class CLoanAppApp : public CWinApp
+{
+public:
+ CLoanAppApp();
+
+// Overrides
+public:
+ virtual BOOL InitInstance();
+
+ DECLARE_MESSAGE_MAP()
+};
+
+JNIEXPORT jfloat JNICALL Java_examples_jni_JavaLoanApp_getHomeEquityLoanRate(JNIEnv *, jobject)
+{
+ return 5.64;
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.ncb b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.ncb
new file mode 100644
index 0000000..f3c2323
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.ncb
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.rc b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.rc
new file mode 100644
index 0000000..c6f0a3b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\LoanApp.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // APSTUDIO_INVOKED
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "TODO: <Company name>"
+ VALUE "FileDescription", "TODO: <File description>"
+ VALUE "FileVersion", "1.0.0.1"
+ VALUE "InternalName", "LoanApp.dll"
+ VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved."
+ VALUE "OriginalFilename","LoanApp.dll"
+ VALUE "ProductName", "TODO: <Product name>"
+ VALUE "ProductVersion", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 1252
+ END
+END
+
+#endif
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\\LoanApp.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.sln b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.sln
new file mode 100644
index 0000000..19e9621
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoanApp", "LoanApp.vcproj", "{7D0EA7E6-4A2E-4BA9-ACAC-1DFD08836FCA}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {7D0EA7E6-4A2E-4BA9-ACAC-1DFD08836FCA}.Debug.ActiveCfg = Debug|Win32
+ {7D0EA7E6-4A2E-4BA9-ACAC-1DFD08836FCA}.Debug.Build.0 = Debug|Win32
+ {7D0EA7E6-4A2E-4BA9-ACAC-1DFD08836FCA}.Release.ActiveCfg = Release|Win32
+ {7D0EA7E6-4A2E-4BA9-ACAC-1DFD08836FCA}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.suo b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.suo
new file mode 100644
index 0000000..c036b6e
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.suo
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.vcproj b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.vcproj
new file mode 100644
index 0000000..b9de1bd
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/LoanApp.vcproj
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="LoanApp"
+ ProjectGUID="{7D0EA7E6-4A2E-4BA9-ACAC-1DFD08836FCA}"
+ Keyword="MFCDLLProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/I &quot;C:\Sun\J2SDKEE1.4\jdk\include&quot;
+/I &quot;C:\Sun\J2SDKEE1.4\jdk\include\win32&quot;"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/LoanApp.dll"
+ LinkIncremental="2"
+ ModuleDefinitionFile=".\LoanApp.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/LoanApp.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/LoanApp.dll"
+ LinkIncremental="1"
+ ModuleDefinitionFile=".\LoanApp.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/LoanApp.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\LoanApp.cpp">
+ </File>
+ <File
+ RelativePath=".\LoanApp.def">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\LoanApp.h">
+ </File>
+ <File
+ RelativePath=".\Resource.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ <File
+ RelativePath=".\LoanApp.rc">
+ </File>
+ <File
+ RelativePath=".\res\LoanApp.rc2">
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/ReadMe.txt b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/ReadMe.txt
new file mode 100644
index 0000000..54d2076
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/ReadMe.txt
@@ -0,0 +1,59 @@
+========================================================================
+ MICROSOFT FOUNDATION CLASS LIBRARY : LoanApp Project Overview
+========================================================================
+
+
+AppWizard has created this LoanApp DLL for you. This DLL not only
+demonstrates the basics of using the Microsoft Foundation classes but
+is also a starting point for writing your DLL.
+
+This file contains a summary of what you will find in each of the files that
+make up your LoanApp DLL.
+
+LoanApp.vcproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+LoanApp.h
+ This is the main header file for the DLL. It declares the
+ CLoanAppApp class.
+
+LoanApp.cpp
+ This is the main DLL source file. It contains the class CLoanAppApp.
+LoanApp.rc
+ This is a listing of all of the Microsoft Windows resources that the
+ program uses. It includes the icons, bitmaps, and cursors that are stored
+ in the RES subdirectory. This file can be directly edited in Microsoft
+ Visual C++.
+
+res\LoanApp.rc2
+ This file contains resources that are not edited by Microsoft
+ Visual C++. You should place all resources not editable by
+ the resource editor in this file.
+
+LoanApp.def
+ This file contains information about the DLL that must be
+ provided to run with Microsoft Windows. It defines parameters
+ such as the name and description of the DLL. It also exports
+ functions from the DLL.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named LoanApp.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+ This is the standard header file, which defines new resource IDs.
+ Microsoft Visual C++ reads and updates this file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Resource.h b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Resource.h
new file mode 100644
index 0000000..4f1e958
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by LoanApp.RC
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE 1000
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 1000
+#define _APS_NEXT_COMMAND_VALUE 32771
+#endif
+#endif
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/examples_jni_JavaLoanApp.h b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/examples_jni_JavaLoanApp.h
new file mode 100644
index 0000000..5fa7ae1
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/examples_jni_JavaLoanApp.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class examples_jni_JavaLoanApp */
+
+#ifndef _Included_examples_jni_JavaLoanApp
+#define _Included_examples_jni_JavaLoanApp
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: examples_jni_JavaLoanApp
+ * Method: getHomeEquityLoanRate
+ * Signature: ()F
+ */
+JNIEXPORT jfloat JNICALL Java_examples_jni_JavaLoanApp_getHomeEquityLoanRate
+ (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/res/LoanApp.rc2 b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/res/LoanApp.rc2
new file mode 100644
index 0000000..dba29d8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/res/LoanApp.rc2
@@ -0,0 +1,13 @@
+//
+// LoanApp.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.cpp b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.cpp
new file mode 100644
index 0000000..637e68b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : source file that includes just the standard includes
+// LoanApp.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.h b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.h
new file mode 100644
index 0000000..38a65bb
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/LoanApp/stdafx.h
@@ -0,0 +1,52 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h> // MFC OLE classes
+#include <afxodlgs.h> // MFC OLE dialog classes
+#include <afxdisp.h> // MFC Automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h> // MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h> // MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/nativelib/LoanApp.dll b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/nativelib/LoanApp.dll
new file mode 100644
index 0000000..a288419
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/jni/nativelib/LoanApp.dll
Binary files differ
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Hello.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Hello.java
new file mode 100644
index 0000000..fa4648b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Hello.java
@@ -0,0 +1,13 @@
+package examples.session.stateless;
+
+/**
+ * This is the Hello business interface.
+ */
+
+public interface Hello {
+
+ /**
+ * @return a greeting to the client.
+ */
+ public String hello();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloBean.java
new file mode 100644
index 0000000..10e6baf
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloBean.java
@@ -0,0 +1,16 @@
+package examples.session.stateless;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * Demonstration stateless session bean.
+ */
+@Stateless
+@Remote(Hello.class)
+public class HelloBean implements Hello {
+ public String hello() {
+ System.out.println("hello()");
+ return "Hello, World!";
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java
new file mode 100644
index 0000000..9becd53
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java
@@ -0,0 +1,59 @@
+package examples.session.stateless;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Hashtable;
+
+// The following import should be removed.
+
+import examples.session.stateless.*;
+import javax.naming.*;
+
+/**
+ * This class is an example of client code which invokes
+ * methods on a simple, remote stateless session bean.
+ */
+public class HelloClient {
+
+ public static void main(String[] args) throws Exception {
+ /*
+ * Obtain the JNDI initial context.
+ *
+ * The initial context is a starting point for
+ * connecting to a JNDI tree. We choose our JNDI
+ * driver, the network location of the server, etc
+ * by passing in the environment properties.
+ */
+
+ System.out.println("about to create initialcontext");
+
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
+ env.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
+ env.put("java.naming.provider.url","localhost:3700");
+ Context ctx = new InitialContext();
+
+ //System.out.println ("Trying to get the name of this context: " + ctx.getNameInNamespace());
+
+ System.out.println("Got initial context ... yeah ");
+
+ /*
+ * Get a reference to a bean instance, looked up by class name
+ */
+ NamingEnumeration ne = ctx.list("");
+ System.out.println("Got list... ");
+ while(ne.hasMore())
+ {
+ NameClassPair nc = (NameClassPair)ne.next();
+ System.out.println("Entry is ... "+nc.getName()+" -- "+nc.getClassName());
+ }
+
+ Hello hello = (Hello) ctx.lookup("examples.session.stateless.Hello");
+
+ /*
+ * Call the hello() method on the bean.
+ * We then print the result to the screen.
+ */
+ System.out.println(hello.hello());
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original
new file mode 100644
index 0000000..f90a759
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/HelloClient.java.original
@@ -0,0 +1,41 @@
+package examples.session.stateless;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * This class is an example of client code which invokes
+ * methods on a simple, remote stateless session bean.
+ */
+public class HelloClient {
+
+ public static void main(String[] args) throws Exception {
+ /*
+ * Obtain the JNDI initial context.
+ *
+ * The initial context is a starting point for
+ * connecting to a JNDI tree. We choose our JNDI
+ * driver, the network location of the server, etc
+ * by passing in the environment properties.
+ */
+
+ System.out.println("about to create initialcontext");
+ //Context ctx = new InitialContext(System.getProperties());
+ Context ctx = new InitialContext();
+
+ //System.out.println ("Trying to get the name of this context: " + ctx.getNameInNamespace());
+
+ System.out.println("Got initial context ... yeah ");
+
+ /*
+ * Get a reference to a bean instance, looked up by class name
+ */
+ Hello hello = (Hello) ctx.lookup("HelloBean");
+
+ /*
+ * Call the hello() method on the bean.
+ * We then print the result to the screen.
+ */
+ System.out.println(hello.hello());
+ }
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..9503e74
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/META-INF/ejb-jar.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <ejb-jar>
+ <enterprise-beans>
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Readme.txt b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Readme.txt
new file mode 100644
index 0000000..a35bbb5
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/Readme.txt
@@ -0,0 +1,13 @@
+1) asant jar
+
+2) asant deploy_common
+
+3) asant base_clientjar_common
+
+4) Turn off the firewall right before running the client (for Glassfish)
+
+asant run_client
+
+5) asant undeploy_common
+
+6) asant clean_all \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/build.xml
new file mode 100644
index 0000000..7fbd159
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/session/stateless/build.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-session-stateless" default="jar"
+ basedir="../../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="StatelessSession"/>
+ <property name="client.class" value="examples.session.stateless.HelloClient"/>
+ <property name="app.pkg" value="examples/session/stateless"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/session/stateless"/>
+
+
+ <!-- Include common.xml -->
+ &include;
+
+ <property name="assemble.dir" value="${assemble.ejbjar}"/>
+ <property name="deploy.file" value="${ejbjar}"/>
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+ <target name="ear" depends="jar,create_ear_common"/>
+
+ <target name="clean_all" depends="clean_common, clean_ejbjar_common, clean_clientjar_common"/>
+</project>
+
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrders.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrders.java
new file mode 100644
index 0000000..55df678
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrders.java
@@ -0,0 +1,13 @@
+package examples.timer;
+
+import javax.ejb.Remote;
+import javax.ejb.Timer;
+
+
+/**
+ * This is the business interface for CleanDayLimitOrders enterprise bean.
+ */
+@Remote
+public interface CleanDayLimitOrders {
+ public void cleanPeriodicallyDayLimitOrders();
+}
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersBean.java
new file mode 100644
index 0000000..1f90550
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersBean.java
@@ -0,0 +1,67 @@
+package examples.timer;
+
+import javax.ejb.*;
+import javax.annotation.Resource;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.SimpleTimeZone;
+import java.util.GregorianCalendar;
+import java.util.Date;
+
+@Stateless
+public class CleanDayLimitOrdersBean implements CleanDayLimitOrders {
+
+ @Resource private SessionContext ctx;
+
+ public void cleanPeriodicallyDayLimitOrders()
+ {
+ // Get hold of the eastern time zone assuming that the securities are being
+ // traded on NYSE and NASDAQ exchanges.
+ String[] timezoneIDs = TimeZone.getAvailableIDs (-5 * 60 * 60 * 1000);
+
+ SimpleTimeZone est = new SimpleTimeZone (-5 * 60 * 60 * 1000, timezoneIDs[0]);
+
+ // Provide the rules for start and end days of daylight savings time.
+ est.setStartRule (Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
+ est.setEndRule (Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
+
+ // Get hold of a calendar instance for the eastern time zone.
+ Calendar cal = new GregorianCalendar(est);
+
+ // Set the calendar to the current time.
+ cal.setTime (new Date ());
+
+ // Calculate the difference between now and market close i.e. 4 PM Eastern.
+ int hourofday = cal.get (cal.HOUR_OF_DAY);
+ int minuteofhour = cal.get (cal.MINUTE);
+
+ // If this method is invoked after the market close, then set the timer expiration
+ // immediately i.e. start=0. Otherwise, calculate the milliseconds that needs
+ // to elapse until first timer expiration.
+ long start = 0;
+ if (hourofday < 16)
+ {
+ int hourdiff = 16 - hourofday - 1;
+ int mindiff = 60 - minuteofhour;
+
+ start = (hourdiff * 60 * 60 * 1000) + (mindiff * 60 * 1000);
+ }
+
+ // Finally, get hold of the timer service instance from EJBContext object and create the
+ // recurrent expiration timer.
+ TimerService timerService = ctx.getTimerService();
+ Timer timer = timerService.createTimer(start, 86400000, null);
+
+ System.out.println("CleanDayLimitOrdersBean: Timer created to first expire after " + start + " milliseconds.");
+ }
+
+ @Timeout
+ public void handleTimeout(Timer timer)
+ {
+ System.out.println("CleanDayLimitOrdersBean: handleTimeout called.");
+
+ // Put here the code for cleaning the database of day limit orders that have
+ // not been executed.
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersClient.java
new file mode 100644
index 0000000..749de86
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/CleanDayLimitOrdersClient.java
@@ -0,0 +1,19 @@
+package examples.timer;
+
+import javax.ejb.EJB;
+
+public class CleanDayLimitOrdersClient {
+ @EJB
+ private static CleanDayLimitOrders cleanDayLimitOrders;
+
+ public static void main(String[] args) {
+ try {
+ cleanDayLimitOrders.cleanPeriodicallyDayLimitOrders();
+
+ System.out.println ("cleanPeriodicallyDayLimitOrders() returned successfully. Take a look at the application server log or console for messages from bean.");
+ } catch (Exception ex) {
+ System.err.println("Caught an unexpected exception!");
+ ex.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application-client.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application-client.xml
new file mode 100644
index 0000000..7e232d8
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application-client.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-client xmlns='http://java.sun.com/xml/ns/javaee'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_5.xsd'
+ version="5">
+ <display-name>CleanDayLimitOrdersClient</display-name>
+</application-client>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application.xml
new file mode 100644
index 0000000..8fc0433
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/application.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
+ <display-name>CleanDayLimitOrdersApp</display-name>
+ <module>
+ <ejb>CleanDayLimitOrdersEjb.jar</ejb>
+ </module>
+ <module>
+ <java>CleanDayLimitOrdersClient.jar</java>
+ </module>
+</application>
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/ejb-jar.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/ejb-jar.xml
new file mode 100644
index 0000000..a358d5a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/META-INF/ejb-jar.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" full="false" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+ <enterprise-beans>
+ <session>
+ <display-name>CleanDayLimitOrdersBean</display-name>
+ <ejb-name>CleanDayLimitOrdersBean</ejb-name>
+ <business-remote>examples.timer.CleanDayLimitOrders</business-remote>
+ <ejb-class>examples.timer.CleanDayLimitOrdersBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <timeout-method>
+ <method-name>handleTimeout</method-name>
+ <method-params>
+ <method-param>javax.ejb.Timer</method-param>
+ </method-params>
+ </timeout-method>
+ <transaction-type>Container</transaction-type>
+ <security-identity>
+ <use-caller-identity/>
+ </security-identity>
+ </session>
+ </enterprise-beans>
+</ejb-jar> \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/Readme.txt b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/Readme.txt
new file mode 100644
index 0000000..6e5d1aa
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/Readme.txt
@@ -0,0 +1,15 @@
+1) asant jar
+
+2) asant app_clientjar_common
+
+3) asant create_ear_common_with_clientjar
+
+4) asant deploy_common
+
+5) Turn off the firewall right before running the client (for Glassfish)
+
+6) asant run_client_in_appcontainer
+
+5) asant undeploy_common
+
+6) asant clean_all \ No newline at end of file
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/build.xml b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/build.xml
new file mode 100644
index 0000000..7030d4a
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Rima Examples/src/examples/timer/build.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [ <!ENTITY include SYSTEM "../../../etc/common.xml"> ]>
+
+<project name="ejb3-examples-session-stateless" default="jar"
+ basedir="../../..">
+
+ <!-- basic settings -->
+ <property name="src.dir" value="${basedir}/src"/>
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="appname" value="CleanDayLimitOrders"/>
+ <property name="client.class" value="examples.timer.CleanDayLimitOrdersClient"/>
+ <property name="app.pkg" value="examples/timer"/>
+ <property name="package" value="${app.pkg}"/>
+ <property name="pack.dir" value="${src.dir}/${app.pkg}"/>
+ <property name="jar.pkg" value="examples/timer"/>
+
+
+ <!-- Include common.xml -->
+ &include;
+
+ <property name="assemble.dir" value="${assemble.ear}"/>
+ <property name="deploy.file" value="${ear}"/>
+
+ <target name="jar" depends="compile_common, create_ejbjar_common"/>
+ <target name="ear" depends="jar,create_ear_common"/>
+
+ <target name="clean_all" depends="clean_common, clean_ejbjar_common, clean_clientjar_common"/>
+</project> \ No newline at end of file