diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java | |
| download | Studium-master.tar.gz Studium-master.tar.bz2 | |
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java')
| -rw-r--r-- | Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/single_table/client/RoadVehicleClient.java | 54 |
1 files changed, 54 insertions, 0 deletions
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();
+ }
+ }
+}
|
