Establish and deploy PowerBuilder components
(Shi Wei, July 20, 2001) 17:56) 1. Before you introduce how to deploy PB components to the JAGUAR CTS server, first describe how to develop a component using PowerBuilder 7. This step is very important because many options are set here, and these options will eventually affect the deployment of PB components. The JAGUAR component developed by PB is a special PB non-visual object (NVO) with some special events and properties. In addition to writing code and setting some properties in the PB, you also need to set some special options in Jaguar to control the behavior of the component, and these options can be set by manual settings through PB JAGUAR Component Wizard to set a large part of them. Using the JAGUAR Component Wizard to create components, you need to answer a range of questions and set some options, which is very important for these settings and options, because it directly affects the behavior of components deployed into the JAGUAR server. When you create a JAGUAR component with PowerBuilder, you generally use the Juguar Component Wizard, which boots you complete a range of settings to create a new Jaguar component. The value entered during the wizard boot process will eventually affect the event, attributes, and deployment options of the component. So during the wizard, you must pay attention to the values of these options and properties. Let's start using the Component Wizard to create a JAGUAR component and describe all options and properties involved. Select "File | New" menu or select "New" directly in the toolbar. PowerBuilder pops up a dialog that consists of many tags. Select "Start Wizards" tab, then select "Jaguar Component", then click the "OK" button, the Jaguar component wizard is started. The above steps are required when creating the components for the first time, once a component application is created with this wizard, and only the additional components are created under the "Object" tab. The first screen of the wizard first introduces the functionality of the wizard and how to access the Jaugar object through the client application. Click the "Next" button, the next dialog appears, this dialog summarizes all the information required by the wizard and the problem that will answer, click the "Next" button, and the dialog box shown in Figure 1 appears. This dialog prompts the user into the name and library path. Here you can take an application name that reflects the functionality function, or you can use the default name "GenApp", finally confirm the library path, and click the "Next" button. The next screen display library path, if needed, you can change it, click the "Next" button to pop up the dialog box shown in Figure 2. The dialog requires the user to enter the name and description of the non-visual components of PowerBuilder, and the system defaults to the application name before adding "N_" prefix. Click the "Next" button to bring up the next dialog. The dialog requires the user to enter the JAGUAR component name. This name is the same as the PowerBuilder object name but the user can change it. Click the "Next" button, the next screen requires the user to enter some information to connect the JAGUAR server, as shown in Figure 3. PowerBuilder needs this information to obtain and servers when deploying components to JAGUAR servers. If the JAGUAR component server runs on the local machine, fill in LocalHost at the "Server Name", if the component server is not running locally, you will need to enter the name of the server or its IP address. The port number is the listener port number specified when the JAGUAR server is created, which is indeed 9000. The login account defaults to jagadmin, the password defaults (the JAGUAR server administrator can change the default login account and password), click the "Next" button.
Figure 1 Specifies the new application name and library Figure 2 Specify the component name and description information
Figure 3 Specifying the server information The next screen requires the user to specify a package name for the component. What is a package? In general, a package is a set of functions related to objects. All components deployed to the JAGUAR server require a package name. Here you can manually enter a package name, you can also take a package name on the JAGUAR server, click the "Next" button. The next screen requires the user to select the type of component. Here are three types of options: standard (general components), shared instances (shared instances), and service types (in server startup, perform background services for Jaguar clients or components). The "Sharing" property of a shared component is set to True. Service components are not only marked as sharing, but there are other methods such as running, start and stop. Select the required component type and click the "Next" button. The next screen is used to specify an instance buffer option, as shown in Figure 4. In the case where "Not Supported" is selected, the component instance can be supported by adding a code in the "CanBepooled" event of the component. You can also change the buffer properties of the components in JAGUAR Manager. Select the required buffer properties and click the "Next" button.
Figure 4 Specify the instance buffer Option of the component The next screen is used to specify transaction support and auto demarcation / deactivation options. These two properties can also be set directly through Jaugar Manager. The following is explained below several transactions.
"NOT Supported": Refers to the component outside the transaction; "Supports Transaction": Refers to the execution, the component is executed in this transaction, otherwise the component will be outside the transaction. carried out. "Requires Transaction": It means that components will have been executed inside a transaction. If the client issues a service request to a component, a new transaction begins. If a component is requested by another component that has already been run in a transaction, the component will use another component of the transaction. "Requires New Transaction": After a component is initialized, a new transaction starts. If the "Automatic Direction / Clear" option is selected, it means that the component is automatically enactive after any of its methods; otherwise, the component is not active until it receives a setabort or setcomplete call. After selecting, click the "Next" button, the next screen is used to specify the interface option, which allows you to modify the component interface. Here you emphasize a little unless you have a special need for components or have a very clear understanding of these options, do not change these options to keep the default. Click the "Next" button. The next screen is used to select Remote Debugging and live editing. Remote debugging options are very useful during development, but when you get the final release code, don't select this option, otherwise, users can see your component code. On-site editing refers to PowerBuilder automatically deploy components to jaguar each time you change the component drawing board. Select the required option and click the "Next" button. Some options for PBD generated will be made below. If you select the first item, PowerBuilder creates a single merged PBD from the PBD in all library lists, and then requires some options for this merged PBD. If there are some dynamic references in the component's data window (such as using the data window), the second option should be selected (including the include unreference Objects). Enter a merged PBD name and the name of the resource file PBR used, this resource file enables components to have the same functionality as the usual PowerBuilder application. Click the "Next" button. Finally, the wizard shows all options and generate a "Work Plan (TO_DO) list for this component, click on the" Finish "button, and the component will be generated. Second, modify the PB object to the component sometimes need to upgrade a already existing PB object to a component. At this time, you need to add some events and you also need to create a project for deploying the component. 1. Adding an event Upgrade a traditional PB object to a JAGUAR component, you need additional events, including activate, deactivate, and optional CANBEPOOLED events.
Activate - This event is mapped to "PBM_component_activate". The event code is executed each time the component is activated. It should be noted here that the mapping event is "PBM_Component_Activate" instead of the PBM_Activate that is very familiar. DEACTIVATE - This event is mapped to "PBM_Component_Deactivate". This event is activated when the component is inactive. Canbepooled - This event is mapped to "PBM_component_canbepooled". It is used to program the instance buffer of the component. When 1 is returned, the instance buffer is allowed to return 0, and instance buffers are prohibited. 2. Creating a deployment project Once you upgrade a traditional PowerBuilder object to a JAGUAR component, you also need to create a deployment project, which is discussed in detail in the next section. Third, the process and options of deployment components must be deployed to an application server before the client application uses components. In Powerbuilder 7, you can use the integrated features of PB and JAGUAR, and you will be deployed to the JAGUAR server each time you modify the components in the PB. This feature is called Live Editing in PB, which is very helpful in development and test environments, but it cannot be applied to the actual application environment. 1. Composition of PB components Powerbuilder PBDS A deployed PowerBuilder component has many elements. The first is the compiled PB code, stored in one or more PBDs. The path to these component libraries must be specified in the operating system, so PowerBuilder's PBDS can be accessed by the PowerBuilder running time library engine in Jaugar. In addition to the PowerBuilder code, IDL also requires an interface description, which is used when applying services to components in the server. These interface information describe the interface definition language (IDL). Resources resources are bitmaps or data windows required for component dynamic applications, which are saved in the PBR file. 2. When deploying a PowerBuilder component to the Jaugar server, you will perform those operations when you deploy a PowerBuilder component to the Jaugar server. Generally deploying a component includes setting some files and properties in the JAGUAR Knowledge Base, so that the component can be found, positioning, and execute when a client application request is requested. It is important to note that it is best not to manually operate files in the JAGUAR knowledge base, but if you know more about these attribute files, you can edit these attribute files directly, which is very convenient and fast.
JAGUAR Knowledge Base (Repository) In the Jaguar CTS directory, there is a folder called "repository". This directory includes all related files that deployed to the PB component of the server. The executable code of the Java component (.calss file) is not in the Repository directory in the JAGUAR CTS 3.5 / Java / Classes directory.
Adding Components and Packages Properties to Knowledge Bases Each component or package has a series of related property properties files. In the Repository directory, there is a file containing a ".props" suffix, which saves Jaugar installation (including all aspects of the package, and components. All properties seen in Jaugar Manager are these .props files. The Repository directory is organized, and each PowerBuilder component property file is in the component directory in the package directory, the properties of the package are in the .props file below the package directory.
Add PowerBuilder code to Repository-compiled PowerBuilder code will be added to the "Components" directory under the Knowledge library repository directory. Every package deployed to Jaugar has a subdirectory in the Componets directory, and each component in the package has a directory stored below the package directory. If the component is a PowerBuilder component, there will be a series of directories starting with "C" in the Components directory. Generate IDL and add to the repository IDL to describe how a component is called by the client. In the IDL directory under the Repository directory, you can see the IDL of the JAGUAR component. The IDL file is organized in units, and each package has a subdirectory in the IDL directory, which contains the IDL files of all components in all packages.
About "cookies" Whenever a PowerBuilder component is deployed to the JAGUAR server, it is placed in a new directory in the repository directory, which is named in the C1 start order, can be seen in the committributs directory in the repository directory. These directories, each of which contains a compiled PowerBuilder code. JAGUAR's management of these directorys is through the properties of the component - "COM.SYBASE.JAGUAR.Component.pb.cookie", the value of this property is "cookie" currently used, that is, the subdirectory number. We can delete all numbers than its small directory without any impact on components, which can release many disk space. Third, JAUGAR Engineering Wizard 1. After creating a JAUGAR project to create a component, you need a JAGUAR project to deploy components. The process of creating a JAGUAR project is similar to the process of creating a component that creating a component. Select "File | New" in PowerBuilder, then select "Jaguar Component Wizard" in the "Projects" tab, and the Component Wizard is different in the Projects tab, and the Component Wizard is in the object (Objects) tab. After establishing a deployment project, you can open this project in PowerBuilder to select the "Design | Build Project" menu to deploy components to the JAGUAR server. 2. On-site editing You can select "Live Editing" option when you create a component for the first time you create a component. However, if this option is not selected when the component is created for the first time, will there be a way to choose this option later? The answer is of course, which can be valid by the following steps.
Select components in the Jaguar project; open the components in PowerBuilder. This option can be modified in the property section. 3. Deploying the Powerbuiler component to another server in actual development, often encountering such problems, using the development version to deploy the Powerbuiler component to another server, often unmatched issues. The main reason may be: 1. Want to access business servers in the PowerBuilder development environment. "On-site Editing" option is a very useful option in the development environment, but it is not suitable for working on business servers. Imagine that if each developer has deployed access to the business server, a small error of any one of the individuals will result in very serious consequences. 2. The remote address is another case to deploy the component to the remote network server of this unit, which means that the current PB development environment does not have access to the target remote server. Fourth, the package deployment is relatively deployed from the PowerBuilder, and there is a way to deploy components is the package deployment, that is, from the development server to a file, then import it into the target server. 1. Creating an export document using Jaugar Manager, JAGUAR Manager provides a feature to file a package to file, which contains all related files and information related to the component, and saves in a .jar (Java document) file format. The following is the specific steps: Start JAGUAR Server Manager and log in. The default login user is jagadmin, the password is empty, if the JAGUAR server runs on the local development machine, the hostname (hostname) is localhost, otherwise the remote machine name or IP address, the default port number is 9000. Under the tree directory on the left of Jaugar Manager, you can see a number of package names in the Server / Jaguar / Installed Package directory, including the package submitted from the PB component project, find the package that contains the export component. To the right mouse button on the package directory, select "Export Package" and pop up an export dialog. Select "Export As Jaguar Package Jar File" and select the path exported to the package, and finally click on the "Export" button. In the directory you selected, Jaguar Manager will create a file called "Package .jar", package name displayed in Jaguar Manager. 2. Once the installation component creates a file named JAR, you can install it to any JAGUAR server. The installation method is as follows:
Copy the JAR file to the target JAGUAR server, can be accessed by the JAGUAR Manager, find the "Installed Packages" directory in the tree view on the left; on the "Installed Packages" directory, click the right mouse button, select "Import"; In the pop-up dialog box, "Deploy from Jaguar Package Jar File" is selected, find the JAR file that needs to be imported, and finally click the "OK" button. The selected JAR file is imported into the target JAGUAR server. V. Method for the package deployment in the previous introduction of the synchronous deployment component is a very simple and effective way, but there are some shortcomings. If there are some large-scale deployment, it seems to be very suitable, very cumbersome. In this large-scale deployment, another method called synchronization (SYNCHRONIZATION) shows its superiority. Synchronization, you can operate at the Cluster and Server (Server) levels. Synchronization can be performed on any server that can be connected or executed on a server server. Cluster synchronization must be performed on the primary server of the cluster. Below is the step of synchronizing the deployment component: Start Jaguar Manager, connect to the primary server. Here's the concept of the primary server is the server where the components and packages are located; in the "Servers" directory, select a server, package, or one component, then right click on "Synchronize"; enter the connected remote server or cluster User name and password. It should be noted here that if you want to connect to multiple servers or multiple servers on a cluster, all servers must have the same username and password; if you want to sync on all servers of a cluster, click on the "Cluster" selection box, Enter the cluster name in the edit box next to it. Note that these operations must be performed on the primary server connected to the cluster. Enter the address (URL or IP address) of the target server you need to synchronize in the "Servers" edit box; in the "Options" page, there are some selection boxes, which will be explained below.
"All Cluster Files": Copy all cluster properties to the target server; "All Package Files": Copy all the package files on all source servers to the target server. This includes all IDL files, attribute files, execution files (such as PBD files) and component definition files, etc .; "All servlet files": Copy all servlets to remote target servers; "verbose": Detailed in synchronous operation Information; "New Primary": Specify the source server as the primary server in the cluster. Be very careful when selecting this option, after selecting this option, all configurations of the change will begin to work; "New Version": Specify a new cluster version number when synchronizing a cluster; "refresh": in the last last Perform a refresh operation. "Restart": Restart the remote server after the synchronization is complete. The time finger-in-THEN WAIT dialog box is waiting for the remote server to restart.