Ofbiz 2.0 streamline application is analogist

zhaozj2021-02-12  178

Ofbiz 2.0 streamline application is analogist

OFBIZ2 Research - Software Engineering Group of Internet Software Technology Laboratory Software Institute of Social Sciences

Leihui@intec.iscas.ac.cn) [2003-4-28]

1 Reason for using OFBIZ 1.1 What is OFBIZOFBIZ is one of the most famous open source projects maintained by SourceForge, providing creation based on the latest J2EE / XML specification and technical standards, build large enterprise, cross-platform, cross-database, cross-use servers Framework of multi-slice, distributed e-commerce web application system. The OFBIZ's web application framework is built in MVC mode, which has adopted a lot of design patterns that are recognized by most enterprise-level applications. Business Tier and Integration Tier. Many representation tier's design patterns are also introduced into OFBIZ, but is only embodied in the servlet controller, not included in the entity engine. The design pattern used in the entity engine includes: Business Delegate, Value Object, Compliance Entity (Value Object Assembler, Service Locator (Service Locator ) And data access objects (Data Access Object). OFBIZ is planning to gradually introduce other design patterns and improve the implementation of design patterns that have been introduced. Using OFBIZ's framework and components, it can greatly shorten the progress and cost of the development enterprise-level web application system. For details, please see: http://sourceforge.net/project/ofbiz. 1.2 Ofbiz and other projects have a lot of projects similar to the OFBIZ. OFBIZ and the most important differences in these projects are OFBIZ provides a set of components and tools developed based on Java-based web applications. A excellent web application should be at least three layers: representing a layer, a business logic layer, and a data layer. Most application frameworks, such as Struts, Cocoon, and Velocity set the main energy to the representation. For example, Struts, follow the (MVC) architecture, communicate with the JSP page using the Java Bean and the Action class. Struts is a good web application framework, but it does not provide components that access the database, and there is no components that control the workflow. If you want to use, you must create these components yourself. If you are already using other application frames (such as Struts), you can easily add OFBIZ components into your own project. Compared to other similar open source projects, OFBIZ is an enterprise-level web application system with blood meat containing compiled package deployment tools, application components, sample applications, and other content to implement a framework. 1.3 Open source advantage OFBIZ is an open source project, which is maintained by a few cattle people, which has all the advantages of open source projects, such as free (download); market-style development method; thousands of people are maintenance, also testing and many more. There is also all the shortcomings of open source projects. If there is no technical documentation, the submitted system has no comprehensive test; unstable, etc., but in any case, we must clearly recognize: 1. OFBIZ is an open source project. 2, OFBIZ is only limited to system developers. 1.4 Perfect Entity Engine The OFBIZ entity engine provides a set of tools and design patterns to model and manage specific entities (data objects) in the real world. In the context environment of the system, an entity is a data object composed of a plurality of data fields and the relationship between the entity and other entities.

This definition comes from the standard definition of the relational database to the entity relationship model (entity-rate model ". The object of the entity engine is to simplify a large number of operations of entity data (corresponding relational database tables) in enterprise applications, including definition, maintenance, general operation (increasing, deletion, reform, check entity and entity) development work. The entity engine uses many design patterns that are recognized by most enterprise applications. Business Tier and Integration Tier. Many representation tier's design patterns are also introduced into OFBIZ, but is only embodied in the servlet controller, not included in the entity engine. The design pattern used in the entity engine includes: Business Delegate, Value Object, Compliance Entity (Value Object Assembler, Service Locator (Service Locator ) And data access objects (Data Access Object). OFBIZ is planning to gradually introduce other design patterns and improve the implementation of design patterns that have been introduced. One of the main objects of the entity engine is to provide a common code structure as much as possible to eliminate all the code of the Hard Code during the event handling of each entity. The problem of this system abstraction is different from the report management or similar system that extracts data from the database and outputs the report and display processing in the form of a report, but similar to a lot of things per day. The processing of commercial applications, the physical engine can save a large number of development costs similar to application systems and dramatic reduction because the system has a large number of written transaction processing code generated by bugs. This type of application is currently achieved in OFBIZ, such as e-commerce, storage, outstanding account management, task allocation resource management, etc. These tools can be used to report and analyze the system, but it does not mean that it can include a 10,000-different customer application needs. In practical applications, we can do some secondary development based on it. In order to achieve as little as possible in the system, the object structure of the storage entity attribute value must be designed to store all domains of the entity (also called fields or fields or fields). Attributes, distinguish which entities are distinguished by the name of the entity. According to the name of the field, the value of a field is read or written from the value object in the value object, and it is also possible to verify that the field of the given name is a legitimate field of the value object. A agreement is established between the entity engine and the application system (reflecting the implementation of the real structure definition file and field type, the Java data type, the definition of the SQL field type mapping relationship), which is defined in a specific XML file to reduce this Flexibility may have an unfavorable risk of system (such as data type problems may cause database system crash, etc.). Instead, one of the methods that do not write the code for a particular entity operation is to put the definition of the entity in the XML file. When the system is started, the entity engine is responsible for loading these structures to load into memory, and in the application And the data source (usually refers to a database or other resource) to establish some use rules for these definitions.

In these XML entity definitions, a mapping relationship is established for the entities and their domains, and a mapping relationship is established in some rules and tables in the database. Moreover, the relationship between the entity and the entity, the physical domain data type, the data type of the Java language, the mapping between the SQL data type, is also defined in the XML file. The relationship between the entity can also be named to distinguish between a specific relationship between different entity combinations. Based on the abstraction layer of the entity engine, the writing of code related to a particular entity is easily created and modified. Use the APIs provided by the entity engine to write the code for practical persistence (increase, delete, change, check), can be configured in different ways to facilitate the implementation of persistence (increasing, deleting, changing, check) When changing, you may not change the code itself because it is not written. This abstract typical application scenario is that you can use both JDBC direct connection, or by calling the entity bean (Entity Beans) of the EJB server or in other ways, even in the framework provided by the system. The user uses its own expansion to complete changes in entity persistence, and so on. These different ways switches do not need to make any changes to the code, just modify the configuration file. OFBIZ has fully implemented a set of entity engines designed to use them directly. The advantage of the entity engine is as follows:

Previous problem background. 1. You need to maintain the existing or newly added database structure (definition and update of library structure, table results, etc.) with tools or newly added databases. How to do it if you want to modify the table structure and definition? 2, assuming that your application involves 200 tables (entities), assuming that each table (entity) is increased, deleted, changed, check, you need to static construction (hardcod) 800 SQL statements in your application. 3. Suppose there is 100 relationships between 200 tables, maintaining each relationship, deleting, changing, checking, and requires 400 still-constructed SQL statements. 4. Suppose these SQL statements are constructed from 10 different levels of programmers, and constructed SQL statements may have a huge difference in performance performance, and the form is different. 5, these hard-coded SQL statements are distributed in the various corners of a large number of Java programs, once the structure of a table changes or modifies a word name or table name, what does it mean? Means confusion!

Ofbiz how to solve these problems: OFBIZ refuses this confusion, a set of EntityEngine mechanisms easily solve all of the above problems. 1, involving 1 table (entity) increase, delete, change, check, it provides a handling mechanism (less than 12 classes, about 5 thousand lines of code), the size of the application is 10,000 tables, it still set The processing mechanism (less than 12 classes, about 5 thousand lines of code), and these processing mechanisms are generated and maintained by the Java program, which guarantees their rationality, reliability, and security. 2, EntityEngine provides a mechanism for constructing complex SQL manipulation, you can construct any complex SQL statement as needed to complete what you want, so you can modify your database definition in the development process, OFBIZ The inconsistency and reference integrity in the database are automatically loaded and detected in the system startup. 3, the entity engine greatly simplifies the management and maintenance of the relational database, but this is just a small piece of benefits, the big advantage is that when you implement a complex demand, the physical engine is used as a few class solutions. All your questions, realize any complex data inventory to take business and business logic, and have nothing to do with the complexity and quantity of the demand. 4, the advantage is too much, in the process of use, will further experience. 1.5 The service engine service framework (Services framework) of the Jack is the added content of OFBIZ2.0. Services is defined into a relatively independent logic processing unit (atomicity with service logic processing), which can be flexible into different forms to achieve different business logic requirements. Services have multiple types of implementations: Workflow, (Rules) Rules, Java Program (Java), Simple Object Access Control Protocol (SOAP), Lightweight Java Program Script Language Interpreter (Beanshell), and more. If a service is defined as a "java" type, it means that the mechanism for implementing the service may be a Static method of the Java class, and the service framework provided by the OFBIZ is not limited to use in a web-based application system. The service needs to enter a MAP-form parameter. After the service is processed, the returned result set is also a MAP form. This idea is very good because the data format of the MAP type is easily serialized (serialized, serialized into byte stream), and stores and transmits via HTTP (or SOAP) protocol. In the OFBIZ, the service is defined in the XML file, and the defined service is assigned to a specific service engine (Service Engine). The service engine is responsible for the definition, management, and calling of services in a suitable manner. Because the service does not necessarily be bound to a web-based application running environment, the result of the service processing will not be associated with the response reponse of an ERQUEST request, so that the service can be pre-set in advance and Time Time Time Touch (because it does not need an HTTP Request request), it is generally triggered by the work schedule manager (Job Scheduler) provided by the system (using the timer to control the call to the service). The service can also be called calls, ie a service is set to call any other services.

In this way, we can use smaller granularity that has been defined into a service chain to complete a relatively large task, and this combination is arbitrary, it is easy to repay it from the defined service itself. use. Using services in different application systems, you can only define a "global service definition file" (because the service itself implements a specific business logic, it and the specific application should be loose), of course The service can also be used by some restrictions to be used as specific applications. In a web-based application-based application, the service can be used to implement web events, using service implementation event processing, which can be used to rearlance some of the relatively fixed business logic in the service framework. Moreover, the service can also be defined as an exportable, which means that they can be remotely accessed by things (possibly an application or other). The system implements an event processor based on Simple Object Access Control Protocol (SOAP), which allows external applications to remotely access the service (or defined) on it through the SOAP protocol. In the future, there will be more remote call forms that are added to the service frame 1.6 dual-tuples have advantageous engines and service engines, in practical applications, the service engine and the entity engine can be used, and the physical engine is mainly used for processing. Entity (enttive) objects, deletion, change, check, and service engines are mainly used to process business logic. The definition of this business logic does not meet the requirements of the above-mentioned request returns a service definition. (This can be processed using the entity engine). The service engine can use the business logic between cross-platform, cross-operative systems, and cross-use systems. Combine the entity engine and service engine, which can solve the details of the techniques involved in the most demand of the enterprise web application system. 1.7 Other Sweets Ofbiz's ambition is too big, almost eating all the latest technology about enterprise, multi-layer, distributed application systems. In addition to the most mature entity engine and service engine, it also involves the following system implementation engine. 1, workflow engine 2, rule engine 3, message engine, in addition to the workflow engine is outside the Alpha version, the other two are in construction, it seems that these people have been tired enough. 1.8 Mainstream technology uses and tracks the most advanced mainstream development technology web application system build technology in the framework of OFBIZ, such as Xerces (XML.Apache.org); Xalan (XML.Apache.org); Axis (XML.Apache .org; jakarta.apache.org; CaStor (www.exolab.org); oro (jakarta.apache.org); beanshell (beanshell.org); J2EE1.3, XML1.2, etc., and the entire system In the original basis, constantly being reconstructed and revised. 1.9 The system framework provided by the extensibility and portability OFBIZ is a pure Java application that adopts good design patterns in the specific implementation. It is fully compliant with almost all requirements of object-oriented design principles. In addition to using J2EE core design patterns, outside database design modes, in the implementation code of OFBIZ, a large number of Java design patterns, the application system itself has no problem.

Ofbiz Developers maintain and compatible with Web and App application servers from 16 vendors such as WebLogic, Tomcat, JBoss, Resin, Orion .Ofbiz Developers maintain compatibility with Oracle, MySQL, Sybase, PostgreSQL, HSQL and other database products , Including compilation, packaging, deployment to the operating environment of these database products or application server products. The Ofbiz Developer has developed and tested on both UNIX and WINDIWS operating systems and features all cross-platform features of the Java application system. With these, for the specific, specific implementation of large enterprise application systems, you have confidence to achieve so-called "once development, run everywhere". 1.10 Improved transaction processing function Current OFBIZ provides 4 database connection support (configured in the "EntityEngine.xml" file, which is loaded into memory by "EntityConfig AutiTil". Use in: GenericDelegator -> generichelper.Generichelper -> generichelperdaogenerichelperdao -> genericdaoGenericdao -> SQLProcessorsqlProcessor -> ConnectionFactory class Get Collection () method Get database connection. Then construct prepaareStatement to implement database operations. Ofbiz2.0 improves GenericDao and SqlProcessor, integrated transaction management functions using JDBC transaction management and application servers implement multi-slice step-by-step transaction management feature, because different entity operations can correspond to different entity engines (pass through EntityEngine.xml The group is located configured), which can implement access operations to the remote data source in the main operating environment of the OFBIZ, and once the remote data source is connected, OFBIZ provides a set of mechanisms to facilitate local And the operation of the remote data source is incorporated into the same transaction management scope to achieve distributed transaction processing. Ofbiz uses JDBC's database operating transaction management API (Commit, Rollback, etc.) and third-party tools implemented by the Database Operation Transaction Management API to implement the OFBIZ's physical engine for transactions. 2 Reasons for not using OFBIZ 2.1 The system is too complicated !! It uses XXX, XXX, XXX standards, reflects XXX, XXX, XXX technology, maintains many concepts, ideas, including so many design patterns, light There are more than 30 configuration files, and the configuration items involved are not 200 species. It uses a lot of tools. This reason is enough to make most people look! OFBIZ is too complex, mixing the foundation, common things and special applications, especially when the entity is defined (considering the relationship).

2.2 夫 If you make OFBIZ, if you do the sun, people who use OFBIZ are prince, because once you use OFBIZ, it will tempted you, keep track, keep synchronize, and it keeps synchronize, It means that you have to charge, and the XXX, XXX, XXX specification is consistent; and the XXX, XXX, XXX standards are consistent; and XXX, XXX, XXX tools are consistent, so you will be tired, then I wrote with JDK Easy things are easy to protect? But use JDK, what else can you write? 2.3 It is not suitable for my application size, if you are developing one. . . . ,or. . . . or. . . . It's notbiz, OFBIZ is in what scale (everyone understands yourself). 2.4 About the application of Ofbiz comes with the application of OFBIZ, there are too many American things, the application background and our gap are too large. In addition to user management, system maintenance, knowledge management, other blocks, other uses. 2.5 Is it bug? Congratulations, you have discovered a bug of OFBIZ, but this is the most common problem of open source projects. You can think about it, then look at "Open source project maintenance method", these bugs itself is hope You find and correct (or modify the suggestion), so BUG is not a big event. In the use of open source projects to shorten the development cycle and reduce development costs, there is more idea of ​​"Yang Shen". 2.6 It doesn't even have a forum? Ofbiz's developers did not expect enterprise applications to pay attention to a forum? This is not what they care about, and you can use everything provided by OFBIZ, and quickly build a forum (provided that the requirements must be clear). 2.7 Other reasons consider, OpenSource's things may exist, such as copyright issues? Agreement issues, etc. This seems to be a problem for us. 3 Simplify OFBIZ2.0 In the purpose of the actual application, I am simplified on the basis of OFBIZ's latest version, mainly including the following measures. 3.1 Data Model Reconstruction 1, data model only reserves: Common, Content, Party, Security. 2, transform all entity definition files, contain the DTD in each file. 3, first organize the entityGroup.xml file, determine the entity definition to be deleted, including the reserved data model package and the delete unnecessary in the reserved package, as follows: (1) Common and security have not moved. (2) Content, retain most of the content (such as document management, entity, other deletions), other deletions, delete content.preference, content.subscription, content.Website. (3) Party. Delete a part and Party-independent entity model definition, such as Party.agreement, Party.communication, Party.Need, etc.

4, according to the deleted entity name, the query determines all the associations that are deleted (including entities and basic data definitions, Java files, JSP, XML, where these entities in the Properties file are cleared and transformed one by one) 5, modify EntityEngine.xml, delete the loaded entity definition file (Eccomerence) 6, delete the loaded service definition file. 7. Modify ServiceEngine.xml, delete loaded service definition files, delete loaded underlying data (related to application). 3.2 Delete Special Applications 1, delete Accounting; Catalog; Ecommerce; Facility; Marketing; PartyMgr; Workeffort Application and Program files in Core and CommonApp are related to applications. The CommonApp / src directory only reserves: Common, Party, Content, Security. If there is an application background similar to deleted applications, consider introduction. 2, modify the setup / offbiz / build.xml file, clear all the contents of these special applications, move the ImageS application from the ECommerce application to the Content application. 3. Modify the Setup / CataLina41 / Conf / Server.xml file. 4. Modify the deployment environment, keep the best deployment environment for OFBIZ support: BEA, JBoss, Resin, Catalina41. Other later. 3.3 Simplified system actually simplifies the system, OFBIZ's kernel is not moving, just deletes it all the applications (including all traces related to the application), but retains the commonly used application 1, kernel management system - -CommonApp application. 2. User Management - Partymgr Application. 3, knowledge management - talk through the Internet. 4, System Maintenance Tool - Webtools Application. The streamlined kernel framework has the following functions (1) full support for EntityEngine, ServiceEngine; WorkflowEngine. (2) Support user management, authority management, knowledge management (information publishing is small), contact information management, and some general basic data definitions and data itself. This is the function we must have "J2EE / XML technology multi-level, branch enterprise-level web application system" we are facing or will facing. A simplified or framework can be used as an original kernel we have applied. Based on the original core, our own application can be quickly developed and deployed. This and the study of the OFBIZ version of the training system does not conflict, but also on the same. The benefits of simplifying, directly reflected in the system scale, system appearance complexity is greatly reduced, and we are implicit in the system, but may always use garbbits to be basically cleared. 3.4 System Scale Statistics Rules: 80 bytes per line, 10% space rate. 3.4.1 Simplify the JSP Java File, a total of 6405083 bytes. Java file, a total of 4197776 bytes. About 4.7225 million lines of code; 497 tables 24 views. 3.4.2 Simplified JSP Java file, a total of 3104918 Bytes. Java file, a total of 4197776 bytes. About 2.8772 million lines of code; 107 tables 8 views.

4 Class and interface needs to understand the classes and interfaces If there is a complete OFBIZ2.0-based development process definition and the foundation of the OFBIZ senior consultant, developers in a development team only need to understand the interfaces provided by the following classes. On the basis of the OFBIZ2.0 framework, develop the applications based on the entity engine and service engine. 4.1 Entity Engine core application class (Client API) involving 12 categories, GenericDelegator, GenericValue, GenericPK, EntityCondition, EntityExpr, EntityFieldMap, EntityConditionList, EntityWhereString, EntityOperator, EntityOperator, EntityListIterator, these classes are for GenericDelegator interface services. All interactions between users and databases are mostly done by "genericDelegator". 4.2 Service Engine Application Class (Server API) involves 6 classes such as LocalDispatcher, GenericDispatcher; ServiceUTIL; DispatchContext; ServiceConfigutil. 4.3 Common Tools Tools is mainly in the package org.ofbiz.core.util. 1. Property File Access Tool Class: UtilProperties. 2, MAP, List Object Operation Tools: Utilmisc. 3, utilformatout: General Format Output Tool class (mainly in JSP file or view helper). 4, UtilURL: Get the URL address class of the file stream. 5, Utilcache: Cache Management Class. 6, utilvalidate: General Data Enter Output Data Check (legitimacy and validity) class, can be expanded. .7, utildatetime: java.util.date and java.sql.date format date / time handling classes. 8, Stringutil: Enhanced string processing classes. 9, Utilxml: Enhanced XML parser processing tool class in accordance with JAXP & DOM specification. 10, SITEDEFS: Constant definition class, define all WEB programs and environmentally related constants. 11, Debug: Format the output program debug information class. 12, httpclient: Simulate an HTTPSERVLET request class. 13, httprequestfileupload: Accept a file tool class uploaded by HTTP. 14, sendmailsmtp: Mail Send Processing class that meets the SMTP protocol (functionality to send a mail server). 4.4 Others As a primary developer, use the above-mentioned classes to form the definition of OFBIZ-based development process; but for a developer that really uses Ofbiz, it is much more than these, need to be fully understood and mastered OFBIZ process, framework and code. This article is designed to throw bricks and jade, which allows more web application developers to benefit from the intensiveness, and the idea of ​​opening sources, and the responsibility and research concept of our software engineering group.

The Internet Software Technology Laboratory of Software Institute of Chinese Academy of Sciences was established in 1998. It is the direct research and development department of the software. It has a system support software technology, digital technology, software engineering and software quality assurance technology, and Internet technology is the main research field. Scientific research and development team. The development team where the author starts tracking and using J2EE / XML technology from 2001, and implements the Beijing Software Industrial Base Public Technical Support System - Integrated Service Management Platform (www.bsw.net.cn) on the basis of OFBIZ1.0 ). It starts to establish a research team from February this year, track and study the development framework based on OFBIZ2.0.0-based general Web application system. The simplified version has been tested. If you are interested, you can contact your or research group to request a simplified version of the source code and overall introduction documentation. Contact: leihui@intec.iscas.ac.cn. Lei Hui

Studies Group Other Personnel: Wu Zhanchun, Yu Lei, Liu Ruang, Xue Yunzhi, Chen Wei, Wu Rui, Yuan Feng, etc. Research areas: focus on software engineering and related software development technology, and provide project management, process management, quality management, configuration management, demand management, test management, and J2EE / XML technology, UML construction Business consulting and technical training services in the model, Java design models.

Training consulting Contact: Wushan Chun Tel: (010) 62329606-16

For details, please see www.cnsqa.com

转载请注明原文地址:https://www.9cbs.com/read-6271.html

New Post(0)