space
Previous Page | Next Page

Deploying Components

Managing Classes with Resources

A RESOURCE entry, or simply resource, stores information about a set of classes. This information controls the classes that can be instantiated by a frame when that frame is initialized. Therefore, when you browse, edit, or execute a frame, it must be able to access the RESOURCE entry that was used when the frame was created.

SAS/AF software also uses resources to load classes efficiently. When a resource is loaded with a frame, SAS performs a single catalog I/O operation to load all appropriate class information into memory. If you were to instantiate each class at run time using separate LOADCLASS or _NEW_ functions, SAS would perform a catalog I/O operation for every class.

The SAS/AF classes are stored in sashelp.fsp.AFComponents.resource, and the SAS/AF legacy classes are stored in sashelp.fsp.build.resource.

Organizing and manipulating resources and the classes that they contain is an important part of project management. You can create custom RESOURCE entries to

Multiple resources help you maintain and organize class libraries for development in SAS/AF software. For example, you could use the RESOURCE entry containing the standard classes provided by SAS (sashelp.fsp.AFComponents.resource), the resource containing SAS legacy classes (sashelp.fsp.build.resource), a resource entry containing classes that were developed for a particular project, and a resource containing classes that you are developing. When you are ready to deploy the components, however, you could create a single resource that contains only those classes used by the application.

You can use the Resource Editor to create, organize, and manipulate resources, as well as the classes that the resources contain. The Resource Editor is invoked when you open an existing RESOURCE entry or when you create a new RESOURCE entry.

You can also use the Resource Editor to specify which classes in a resource you want to display when the resource is displayed in the Components window. You can select a class and toggle its display status by selecting the Toggle Display Status check box. Although the resource should contain all classes that the application will use, only those components that can be dropped onto a frame should be set to display. For more information about resources and the Components window, see Associating Resources with FRAME Entries.

For complete information about working with the Resource Editor, see the SAS/AF online help.


Synchronizing Resources

Each RESOURCE entry contains a complete, static copy of its classes, which means that a resource does not reread the underlying class information as it loads them. To update information in a resource when you change one of its classes, you must synchronize the RESOURCE entry. Synchronizing a resource requires the class metadata of the original classes, updating the version of the class that is stored within the resource. You must synchronize a resource whenever you change a class name, location, or description, or whenever you change property metadata information that is stored in a CLASS entry, such as an attribute's valid values or the location of SCL method code. You do not have to synchronize a resource if you modify the SCL code of methods on a class.

For example, suppose you create a resource that includes a class named mylib.myclasses.Demo.class and then save that resource and close the Resource Editor. You then edit the class to add a method. After you save the class, you need to synchronize the resource so that the changes you made to the class are included.

To synchronize a RESOURCE entry from within the Resource Editor, select Tools [arrow] Synchronize.

You can also edit a class directly from the Resource Editor, which enables you to automatically synchronize the class and the resource after you commit the changes to the CLASS entry. That is, if you edit a class from within the Resource Editor, you do not have to synchronize the resource. To edit a class from within the Resource Editor, selectEdit [arrow] Edit Class or click the Edit toolbar icon.


Analyzing Resources

The Resource Editor enables you to analyze a resource by displaying all of the classes that the resource contains, their ancestors, and the search path that is needed to find the classes. To analyze a resource in the Resource Editor, select Tools [arrow] Analyze.

Here is a sample analysis of a simple resource as it appears in the SAS log:

Analysis of resource entry: SASUSER.TESTCATALOG.TESTRES.RESOURCE

SASHELP.CLASSES.CHECKBOX_C.CLASS
     Parent = SASHELP.CLASSES.AFCONTROL.CLASS
     Parent = SASHELP.FSP.WIDGET.CLASS
     Parent = SASHELP.FSP.OBJECT.CLASS

SASUSER.TESTCATALOG.NBUTTON.CLASS
     Parent = SASHELP.CLASSES.PUSHBUTTON_C.CLASS
     Parent = SASHELP.CLASSES.AFCONTROL.CLASS
     Parent = SASHELP.FSP.WIDGET.CLASS
     Parent = SASHELP.FSP.OBJECT.CLASS

Current search path is:
      SASHELP.CLASSES
      SASUSER.TESTCATALOG


Merging Resources

The Resource Editor enables you to merge classes that are referenced by another resource into the currently open resource. Merging several smaller resources into a single, larger resource can help improve performance by reducing the catalog I/O that SAS/AF performs. Note that the actual class information is merged, not the copy of the class information in the merged resource.

To merge resources from within the Resource Editor, select Tools [arrow] Merge Resource then select the resource you want to merge.

Classes with identical aliases are not merged. An alias is a reference that is used by a RESOURCE entry. It is created by concatenating the class name and its closest abstract parent class. As a result, when resources reside in different libraries and/or catalogs and two classes have the same name and type, the resulting aliases will be identical. If you try to merge classes that have identical aliases, the class in the imported resource will not be merged.


Renaming Class Catalogs and Libraries in a Resource

A resource must accurately reflect all CLASS entry information, as well as the library and catalog in which the class is stored. If you move or copy the classes that are referenced in a resource to another catalog or library, you will need to change the class information in the resource to the new location. To rename the library and catalog references for a resource using the Resource Editor, select Rename Libraries or Rename Catalogs from the pop-up menu in the Resource Editor window.

You can use the Resource Editor not only to rename the library and catalog references for its classes, but also to update the library and catalog references in all affected CLASS entries. To apply the rename action to all classes in the resource, check the Apply changes to class entries check box in the Rename Libraries or Rename Catalogs dialog box.

Note:   Applying renamed library and catalog references to classes via the Resource Editor does not update any hard-coded object references or other library and catalog names in the method SCL for a class. If you use SCL to create classes with the CLASS/ENDCLASS syntax, the library and catalog names in the SCL also are not affected by changes in the Resource Editor.  [cautionend]

You can also use the CATNAME statement to logically combine one or more catalogs by associating them with a catref (shortcut name). See Setting Up the Development Environment for more information.

space
Previous Page | Next Page | Top of Page