Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
jvx:reference [2020/06/15 09:50]
cduncan [Anatomy of a remote JVx application]
jvx:reference [2020/06/15 09:57]
cduncan [Accessing the Data With Strings]
Line 584: Line 584:
 This example demonstrates how a simple launcher is implemented and why it is necessary to have a launcher in the first place. Compared with the “[[#​jvx|JVx]] are of course a lot more complex than these examples, that is because they implement all the required functionality and also take care of a lot of boiler plate operations. It is taking care of all technology specific code and allows to keep your application free from knowing about the platform it runs on. This example demonstrates how a simple launcher is implemented and why it is necessary to have a launcher in the first place. Compared with the “[[#​jvx|JVx]] are of course a lot more complex than these examples, that is because they implement all the required functionality and also take care of a lot of boiler plate operations. It is taking care of all technology specific code and allows to keep your application free from knowing about the platform it runs on.
  
-====== ​Data Books ======+====== ​Databooks ​======
  
-Let’s talk about data books, which allow access to data without any effort.+Let’s talk about databooks, which allow access to data without any effort.
  
 ===== What is it? ===== ===== What is it? =====
  
-DataBooks ​are an active model, which allow you to directly query and manipulate the data. Contrary to many other systems, [[https://​sourceforge.net/​projects/​jvx/​|JVx]] does not map the data into objects, but allows you to directly access it in a table-like fashion exposing columns, rows, and values.+Databooks ​are an active model that allow you to directly query and manipulate the data. Contrary to many other systems, [[https://​sourceforge.net/​projects/​jvx/​|JVx]] does not map the data into objects, but allows you to directly access it in a table-like fashion exposing columns, rows, and values.
  
 One could say that it is like a three dimensional array with these dimensions: One could say that it is like a three dimensional array with these dimensions:
Line 606: Line 606:
 The row definition defines what columns are available in the row and stores some additional information about them, like the names of the [[https://​en.wikipedia.org/​wiki/​Unique_key|primary key]] columns. You can think of the row definition as the headers of a table. The row definition defines what columns are available in the row and stores some additional information about them, like the names of the [[https://​en.wikipedia.org/​wiki/​Unique_key|primary key]] columns. You can think of the row definition as the headers of a table.
  
-Its creation and usage is rather simple, and, if you’re working with RemoteDataBooks there is no need to create one at all, as it is automatically created when the data book is opened. A row definition holds and manages column definitions,​ which define the columns.+Its creation and usage is rather simple, and, if you’re working with RemoteDataBooks there is no need to create one at all, as it is automatically created when the databook ​is opened. A row definition holds and manages column definitions,​ which define the columns.
  
 <code java> <code java>
Line 657: Line 657:
 The data page is basically a list of data rows. It also holds its own row definition, which is shared with all the contained data rows. The data page is basically a list of data rows. It also holds its own row definition, which is shared with all the contained data rows.
  
-The main usage of data pages is to allow paging in a master/​detail relationship. If the master selects a different row, the detail ​data book selects the related data page.+The main usage of data pages is to allow paging in a master/​detail relationship. If the master selects a different row, the detail ​databook ​selects the related data page.
  
-===== Data Book =====+===== Databook ​=====
  
-The data book is the main model of [[https://​sourceforge.net/​projects/​jvx/​|JVx]],​ it provides direct access to its current data page and data row by extending from IDataRow and IDataPage.+The databook ​is the main model of [[https://​sourceforge.net/​projects/​jvx/​|JVx]],​ it provides direct access to its current data page and data row by extending from IDataRow and IDataPage.
  
-By default, the data book holds one data page and only has multiple data pages if it is the detail in a master/​detail relationship.+By default, the databook ​holds one data page and only has multiple data pages if it is the detail in a master/​detail relationship.
  
 ===== Usage Example ===== ===== Usage Example =====
Line 706: Line 706:
 ==== Accessing the Data With Strings ==== ==== Accessing the Data With Strings ====
  
-One of the major advantages of the data book concept is that there is no need to create new classes to represent each table, view, or query result. One can always use the data book directly and easily, and model changes don’t necessitate changes on the client side. The downside to this approach is that we lose compile time checks because we access the data dynamically. However, this can be mitigated by using [[https://​marketplace.eclipse.org/​content/​eplug-jvx|EPlug,​ an Eclipse plugin]] which provides compile time checks and many more features.+One of the major advantages of the databook ​concept is that there is no need to create new classes to represent each table, view, or query result. One can always use the databook ​directly and easily, and model changes don’t necessitate changes on the client side. The downside to this approach is that we lose compile time checks because we access the data dynamically. However, this can be mitigated by using [[https://​marketplace.eclipse.org/​content/​eplug-jvx|EPlug,​ an Eclipse plugin]] which provides compile time checks and many more features.
  
 ==== No Primitives, Objects Only ==== ==== No Primitives, Objects Only ====
Line 831: Line 831:
 What you are seeing here is a rough sketch of how the architecture of [[https://​sourceforge.net/​projects/​jvx/​|JVx]] looks like. Let’s walk through the image step by step. We will look at each successive layer and work our way from the database on the server to the data book on the client. What you are seeing here is a rough sketch of how the architecture of [[https://​sourceforge.net/​projects/​jvx/​|JVx]] looks like. Let’s walk through the image step by step. We will look at each successive layer and work our way from the database on the server to the data book on the client.
  
-==== DBAccess, ​accessing ​database ​====+==== DBAccess, ​Accessing ​Database ​====
  
 Accessing a database is easy when using ''​%%DBAccess%%''​. All we must do is to set the [[https://​en.wikipedia.org/​wiki/​Java_Database_Connectivity|JDBC]] URL of the server and connect to it: Accessing a database is easy when using ''​%%DBAccess%%''​. All we must do is to set the [[https://​en.wikipedia.org/​wiki/​Java_Database_Connectivity|JDBC]] URL of the server and connect to it:
Line 842: Line 842:
 dbAccess.open();​ dbAccess.open();​
 </​code>​ </​code>​
-As a note, the instance returned by ''​%%getDBAccess(...)%%''​ is the database specific ''​%%DBAccess%%''​ extension, which does know how to handle its database.+As a note, the instance returned by ''​%%getDBAccess(...)%%''​ is the database-specific ''​%%DBAccess%%''​ extension, which knows how to handle its database.
  
-We can of course use ''​%%DBAccess%%''​ to directly access the database:+We canof courseuse ''​%%DBAccess%%''​ to directly access the database:
  
 <code java> <code java>
Line 853: Line 853:
 List<​Bean>​ data = dbAccess.executeQuery("​select * from SOME_TABLE"​);​ List<​Bean>​ data = dbAccess.executeQuery("​select * from SOME_TABLE"​);​
 </​code>​ </​code>​
-…or manipulate the database, ​or query information about the database ​or execute procedures or do anything else.+…or manipulate the database, query information about the databaseexecute proceduresor anything else!
  
-==== DBStorage, ​preparing ​the database access ​for databooks ​====+==== DBStorage, ​Preparing ​the Database Access ​for Databooks ​====
  
-The downside of using DBAccess is that everything must be database specific. To become database ​agnostic ​we must use ''​%%DBStorage%%''​. ''​%%DBStorage%%''​ does not care which database it is connected to and can operate on any of them:+The downside of using DBAccess is that everything must be database-specific. To become database-neutral, ​we must use ''​%%DBStorage%%''​. ''​%%DBStorage%%''​ does not care which database it is connected to and can operate on any of them:
  
 <code java> <code java>
Line 865: Line 865:
 storage.open();​ storage.open();​
 </​code>​ </​code>​
-We can use this to insert, update, delete and fetch data. Additionally the ''​%%DBStorage%%''​ does retrieve and manage the metadata of the table we’ve set, which means that we can query all column names, what type they are, we can even access the indexes and the default values. Short, the ''​%%DBStorage%%''​ leaves little to be desired when it comes to operating on a database.+We can use this to insert, update, delete and fetch data. Additionallythe ''​%%DBStorage%%''​ does retrieve and manage the metadata of the table we’ve set, which means that we can query all column names, what type they are, we can even access the indexes and the default values. Short, the ''​%%DBStorage%%''​ leaves little to be desired when it comes to operating on a database.
  
-If we query data from the ''​%%DBStorage%%''​ we receive a List of rows. The rows are are either represented as ''​%%Object%%''​ array, ''​%%IBean%%''​ or a POJO and we can easily manipulate the data, like this:+If we query data from the ''​%%DBStorage%%''​we receive a list of rows. The rows are either represented as ''​%%Object%%''​ array, ''​%%IBean%%''​or a POJOand we can easily manipulate the data, like this:
  
 <code java> <code java>
Line 876: Line 876:
 } }
 </​code>​ </​code>​
-As one can see, it looks quite familiar to the DataBook, which isn’t a coincidence. The ''​%%DBStorage%%''​ “powers” the DataBooks ​on the server side, a DataBook ​will get its data from and will send its modified data to the ''​%%DBStorage%%''​.+As one can see, it looks quite familiar to the DataBook, which isn’t a coincidence. The ''​%%DBStorage%%''​ “powers” the databooks ​on the server side, a databook ​will get its data from and will send its modified data to the ''​%%DBStorage%%''​.
  
-I’ve been using the ''​%%DBStorage%%''​ here as an example, but actually the Storage ​is not dependent on a database. ''​%%IStorage%%''​ can be implemented to provide any sort of data provider, like reading from an XML or JSON file, scraping data from a website, fetching data from a different process or reading it directly from a hardware sensor.+I’ve been using the ''​%%DBStorage%%''​ here as an example, but actually the storage ​is not dependent on a database. ''​%%IStorage%%''​ can be implemented to provide any sort of data provider, like reading from an XML or JSON file, scraping data from a website, fetching data from a different processor reading it directly from a hardware sensor.
  
 ==== Life Cycle Objects, the business objects with all the logic ==== ==== Life Cycle Objects, the business objects with all the logic ====
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information