|
|
(30 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | A general introduction and some high-level concepts for OSBP DSLs can be found in [[OSBP DSL Documentation]].
| |
| | | |
− | Please note that you can only make use of the Datainterchange DSL by downloading its packages from the [http://dev.osbee.org/free-download/ download section] of our [http://dev.osbee.org/home/ website].
| |
− |
| |
− | ==Purpose==
| |
− |
| |
− | The Data Interchange DSL (datainterchange for short) is made for defining data exchange models that can be used to import data from various formats (CSV, XML, EDI, etc.), map the data to entities, store them into database, or export them back into other formats.
| |
− |
| |
− | You only need to define the ''relationship'' between the file and the bean, not the import / export process themselves. Once defined, these models can be used in e.g. action DSL to define actions which, when triggered, execute the actual import / export process, which are generated automatically by the OSBP based on the model.
| |
− |
| |
− | ==Overview==
| |
− |
| |
− | [[File:Datainterchange.png|center|''Figure 1 - Data Interchange Structure.'']]
| |
− |
| |
− | As shown in Figure 1, the DSL inferrer will generate various views and In/Export component according to model described by datainterchange DSL (and action DSL, in the case of ActionButtons). The action buttons, when clicked, will trigger their corresponding In/Export processes by putting WorkerThreadRunnable jobs into the executor job pool within the TriggerView (prefixed with datainterchang name), buttons (and toolbar / menus containing them) are further included in the perspective.
| |
− |
| |
− | The main semantic elements of the Compex Data Interchange DSL are the following:
| |
− |
| |
− | * <code>package</code>
| |
− | ::- specify the datainterchange package, which acts as a namespace. It should have the form <code>net.osbee.sample.<applicationname>.datainterchanges</code> by convention.
| |
− | * titletext
| |
− | ::- the name of the datainterchange package. This name will be used for code generation and should thus be unique if there are multiple datainterchange packages.
| |
− | * interchangename
| |
− |
| |
− |
| |
− | ==Data Interchange Model File==
| |
− |
| |
− | Datainterchange DSL model files end with the <code>.data</code> extension. Data Interchange models may be split into several <code>.data</code> files, as long as they have the same package declaration.
| |
− |
| |
− |
| |
− | ===Reserved Keywords===
| |
− | In the following we’ll dive deeper into the description and the usage of Datainterchange related and reserved keywords.
| |
− |
| |
− | ====import====
| |
− | In the import section are all entities to be found - as full qualified names – that are currently used in the DSL and automatically imported/added (OXImportDeclaration) by editing it.
| |
− | import ns net.osbee.sample.<ApplicationName>.entities.SampleEntity1
| |
− | import ns net.osbee.sample.<ApplicationName>.entities.SampleEntity2
| |
− | import ns net.osbee.sample.<ApplicationName>.entities.SampleEntity3
| |
− |
| |
− |
| |
− | ====package====
| |
− |
| |
− | Datainterchange DSL model files must start with a package declaration. Packages are the root element of the DSL grammar and must be defined as follow package <PackageName> for example
| |
− |
| |
− | package net.osbee.sample.ApplicationName.datainterchanges { }
| |
− |
| |
− | Data Interchange models may be split into several .data files, as long as they have the same package declaration.
| |
− |
| |
− |
| |
− | <syntaxhighlight lang="java">
| |
− | package net.osbee.sample.<applicationname>.datainterchanges title "<titletext>" {
| |
− | interchange <interchangename> persist file
| |
− | <fileformat> "<filepath>" [<further specifications>]
| |
− | beans {
| |
− | <entity relationships>
| |
− | }
| |
− | }
| |
− | </syntaxhighlight>
| |
− |
| |
− | ====titel====
| |
− | With the keyword title you can give a name to the corresponding TriggerView dialog inside your application.
| |
− | For example the definition of the same datainterchanges package from above with the title DataInterchange
| |
− | package net.osbee.sample.foodmart.datainterchanges title "DataInterchange" {}
| |
− |
| |
− | You can get more details about the TriggerView in the section below.
| |
− |
| |
− |
| |
− | ====interchange====
| |
− | All interchange units have to be defined in the package followed by the Entity they are referencing/applied to.
| |
− | interchange <EntityName> <EntityManagerMode> <FileFormat> {}
| |
− |
| |
− |
| |
− | ====describedBy====
| |
− | With this keyword you get to set the optional description of an interchange unit as shown below.
| |
− | interchange <EntityName> describedBy "This is a description of the Datainterchange DSL Unit EntityName" … {}
| |
− |
| |
− |
| |
− | ====persist, merge, remove====
| |
− | With those keywords defined inside the Enum Entity Manager Mode, you set how the data have to be process by inserting then into a database.
| |
− | interchange <EntityName> <EntityManagerMode> … {}
| |
− |
| |
− | Example 1: interchange SampleEntity1 merge … {}
| |
− | Example 2: interchange SampleEntity2 persist … {}
| |
− | Example 3: interchange SampleEntity3 remove … {}
| |
− |
| |
− |
| |
− | ====file====
| |
− | With the keyword file you are able to set the file format of the files you intent to process with you interchange unit.
| |
− | interchange <EntityName> <EntityManagerMode> file <FileNameFormat> {}
| |
− |
| |
− | The current supported file formats are CSV, EDI and XML followed by the name of the file you want to process, given its full path location in the system.
| |
− | Example 1: interchange SampleEntity1 merge file CSV "C:/temp/testFile.csv” {}
| |
− | Example 2: interchange SampleEntity2 persist file XML "C:/temp/testFile.xml” {}
| |
− | Example 3: interchange SampleEntity3 merge file EDI "C:/temp/testFile.edi” {}
| |
− |
| |
− | After choosing the file format you can either give the file name in a String value as shown here above or press the buttons Ctrl + Space to get the option of opening a File Chooser/Picker to specify the file you want to work with.
| |
− | [[File:Example.jpg]]
| |
− |
| |
− | ====elementSize====
| |
− | With the keyword elementSize followed by a number between 0 and 100 ? you set the average size of the file (or set of data).
| |
− | Example: interchange SampleEntity1 merge elementSize 50 file CSV "C:/temp/testFile.csv” {}
| |
− |
| |
− |
| |
− | ====delimiter====
| |
− | With the keyword delimiter you set the delimiter/separation character of the file.
| |
− | Example: interchange SampleEntity1 merge elementSize 50 file CSV "C:/temp/testFile.csv” delimiter ";" {}
| |
− |
| |
− |
| |
− | ====skipLines====
| |
− | With the keyword skipLines followed by a number you specify the number of line to be skipped or not to be considered in the processing of the selected file.
| |
− | Example: interchange SampleEntity1 merge elementSize 50 file CSV "C:/temp/testFile.csv” delimiter ";" skipLines 1 {}
| |
− |
| |
− |
| |
− | ====report====
| |
− |
| |
− |
| |
− |
| |
− | ====indent====
| |
− |
| |
− | ====quoteCharacter====
| |
− |
| |
− |
| |
− | ====strict====
| |
− |
| |
− | ====beans====
| |
− |
| |
− | ====entity====
| |
− |
| |
− | ====createOn====
| |
− |
| |
− | ====element====
| |
− |
| |
− | ====expression -> assign | copy | with...as====
| |
− |
| |
− | ====format====
| |
− |
| |
− | ====keys -> key====
| |
− |
| |
− | ====list====
| |
− |
| |
− | ====mapping -> map...to====
| |
− |
| |
− | ====lookup====
| |
− |
| |
− | ====marker====
| |
− |
| |
− | ==Enums==
| |
− | ===PredefinedBeanEnum===
| |
− | ===PredefinedBeanTypeEnum===
| |
− | ===ProgessBarStyleEnum===
| |
− | ===EntityManagerMode===
| |
− |
| |
− | ==Configuration Settings / Smooks Framework (A small introduction)==
| |
− |
| |
− | ==Annotations==
| |
− |
| |
− | ==Comments==
| |
− |
| |
− | ==Smooks (Extended)==
| |
− | just links???
| |
− |
| |
− | ==WorkerThread (Runnable)==
| |
− |
| |
− | ==TriggerView & Executorservice==
| |
− |
| |
− | ==DSL Inferrer==
| |
− |
| |
− | ==DSL Scope Provider==
| |
− |
| |
− | ==DSL Proposal Provider==
| |
− |
| |
− | ==DSL Validator==
| |
− |
| |
− | == Copyright Notice ==
| |
− | {{Copyright Notice}}
| |