The ComponentX backend for the contacts samples is organized around one main component, the appServer component. This contains all the subcomponents of the application as at the highest level maps to a web page submission and the corresponding reply. The component that achieves this is the subscriber component.
Each component contained within the appServer component consists of a subscriber component linked to other components that actually do the required processing. The subscriber acts somewhat like a router in that it accepts only requests coming from a source external to the ComponentX studio that are addressed to the specific subscriber. Once the subscriber passes the request it is transformed as needed by other components and then forwarded to a dataSource component to actually perform some action on one or more of the databases and then the result is returned via the subscriber back to the browser.
If we examine one of the components within appServer more closely the basic design of the application can be seen. If the addEmployee component is opened you will see that it contains four components.
The first component is the subscriber that provides the point that data enters and exits the addEmployee component. The subscriber has 3 properties that make it function. The fist property is role, this is a parameter that is passed in by the external source as part of its request and is conceptually like an application name, in this case "contacts". The second property is the tag and this refers to the root tag of the xml document received. These two properties together make a unique "address" for the publisher component to send the incoming document to the correct subscriber. The third property is the xsl property which is used when the subscriber replies to the incoming request. The subscriber will place an xsl link in the reply document for the xsl document named in the xsl property.
The second component is the addEmployeeTransform component. This component contains several components that transform the incoming xml request into a standardized form that the dataSource component can process. These processes include stripping out empty nodes from the document and inserting the appropriate instructions for the dataSource component. There is also a custom component that generates a unique identifier number for each new record.
The third component is the employeeDS component. This component is used by many other components and is a generic dataSource component configured to work with the employee database. The employeeDS is configured by providing a DSN to link to a database using jdbc and odbc and then linking the fields in the database to types with ComponentX.
The final component is an xml constant component. The dataSource component does not produce an output document when adding (or deleting or modifying) records but the browser is expecting some sort of reply back. The xml constant returns a simple xml document to the browser when the completed pin fires on the employeeDS component when a record is sucessfuly saved, otherwise an error document is returned to the browser. It is assumed in the contacts example that any request must answered with some sort of response even if the response is an error document.
All of the other components within the appServer component are structured in a similar way with the appropriate subscriber, transformation components and dataSource and some output components.