Red Hat Web ApplicationFramework 6.1WAF Developer Guide
iv Introduction to the WAF Developer GuideWarningBe careful to remove only the necessary Red Hat Applications partitions. Removing other partitionscou
86 Chapter 9. Persistence TutorialString firstName;String lastName;String groupName;do{select *from users, groups, membershipwhere users.user_id = mem
Chapter 9. Persistence Tutorial 87from (select level l, related_category_idfrom (select related_category_id, category_idfrom cat_category_category_map
88 Chapter 9. Persistence Tutorial9.5.4. How it WorksYou may be wondering how to add filters and bind variables after retrieving the query. The persist
Chapter 9. Persistence Tutorial 899.6.3. Incorrect Attribute MappingsWhen you receive an error indicating that an attribute cannot be found or an attr
90 Chapter 9. Persistence TutorialData Model Problem Likely Cause in PDLMissing foreign keys Object Model doesn’t use associations, but datamodel does
Chapter 9. Persistence Tutorial 919.7.2. Manual Transaction ManagementWhen you manage your transactions locally, your starting point is the SessionMan
92 Chapter 9. Persistence Tutorial9.8. Link AttributesWhen modeling many real-world problems, it is common to encounter situations that require associ
Chapter 9. Persistence Tutorial 93String[1..1] name = groups.name;// ...}object type User {BigInteger[1..1] id = users.user_id;String[1..1] name = use
94 Chapter 9. Persistence Tutorial9.8.2.1. Creating and Initializing LinksThe DataAssociation.add(DataObject object) method is used when creating a li
Chapter 9. Persistence Tutorial 95System.out.println(email + ": " + membershipDate);}9.8.2.3. Updating Link AttributesThe DataAssociationCur
Introduction to the WAF Developer Guide vPermissionDescriptor perm =new PermissionDescriptor(PrivilegeDescriptor.READ,acsObject, party);PermissionServ
96 Chapter 9. Persistence Tutorial// Get the members association.DataAssociation members = (DataAssociation) group.get("members");// Iterate
Chapter 9. Persistence Tutorial 973. Generates the events for storing information in the schema in memory so that the ObjectTypereturned can be used w
98 Chapter 9. Persistence TutorialIn addition, there are numerous examples that one could concoct where an EJB server (at leastinitially) could be dee
Chapter 9. Persistence Tutorial 992. Developer Specific Questions2.1. I am new to the persistence API. Where do I start?Start with this book’s table of
100 Chapter 9. Persistence TutorialSuppose you are defining an object type named "ChewingGum" that extends ACSObject. Tospecify that an objec
Chapter 9. Persistence Tutorial 1012.9. How do I retrieve a DataQuery, DataCollection, or DataAssociation in the orderI want (e.g., there is a sort_or
102 Chapter 9. Persistence Tutorial
Chapter 10.Kernel TutorialThis chapter discusses how to use permissioning and domain objects, answers frequently-asked ques-tions about the WAF securi
104 Chapter 10. Kernel Tutorial10.1.2. Revoking AccessRevoking a privilege on an object from a party is accomplished by creating a PermissionDescrip-t
Chapter 10. Kernel Tutorial 105OID party = new OID("com.arsdigita.kernel.User", new BigDecimal(100));PermissionDescriptor perm =new Permissi
vi Introduction to the WAF Developer Guide
106 Chapter 10. Kernel TutorialDataCollection objects = SessionManager.getSession().retrieve("example.MyACSObject");OID party = new OID(&quo
Chapter 10. Kernel Tutorial 10710.2.1.1. Starting the ClassA domain object starts off as a standard Java class that extends one of the four domain obj
108 Chapter 10. Kernel Tutorial*/protected String getBaseDataObjectType() {return BASE_DATA_OBJECT_TYPE; (4)}}(1) The AuditedACSObject is imported fro
Chapter 10. Kernel Tutorial 109public class Note extends AuditedACSObject {/*** BASE_DATA_OBJECT_TYPE represents the full objectType name for the* Not
110 Chapter 10. Kernel Tutorial* DataObject.** @see AuditedACSObject#AuditedACSObject(OID)* @see com.arsdigita.persistence.DataObject* @see com.arsdig
Chapter 10. Kernel Tutorial 111* new instance.** @see com.arsdigita.persistence.Session#create(String)* @see com.arsdigita.persistence.DataObject* @se
112 Chapter 10. Kernel Tutorial}m_dataObject = s.retrieve(oid);if (m_dataObject == null) {throw new DataObjectNotFoundException("Could not retrie
Chapter 10. Kernel Tutorial 113}...}(1) These constructors are used to create an empty data object. The Session class is used look upthe metadata that
114 Chapter 10. Kernel Tutorial10.2.1.4. DomainObject MethodsSeveral methods are inherited from DomainObject that are useful for building other method
Chapter 10. Kernel Tutorial 115* Called from base class constructors (DomainObject constructors).*/protected void initialize() {super.initialize();if
I. WAF ConceptsThis section covers the concepts of WAF. The intention is to provide both a very high-level architec-tural view and a closer review of
116 Chapter 10. Kernel TutorialNote that the Message class only support bodies with a primary MIME type of text. The Mes-sageType interface defines leg
Chapter 10. Kernel Tutorial 117Note that the above two examples do not explicitly set a MIME type for the content. This is determinedautomatically whe
118 Chapter 10. Kernel Tutorialmsg[1].setRefersTo(anchor);msg[2] = msg[0].replyTo(from,body);msg[3] = msg[0].replyTo(from,body);msg[4] = msg[2].replyT
Chapter 10. Kernel Tutorial 119KernelHelper.getCurrentUser(request) is a convenience method that returns the currentUser object if available, returns
120 Chapter 10. Kernel Tutorial8. How do I log in a user using a username and password?KernelHelper.getKernelRequestContext(request).getUserContext().
Chapter 10. Kernel Tutorial 12112. How do I set a user’s password?Given the user’s UserAuthentication object, auth.setPassword(password) sets the user
122 Chapter 10. Kernel Tutorial10.4. Extending the Authentication SystemThe main strength of PAM is that the system may be extended with new authentic
Chapter 11.Services TutorialsThese tutorials build upon the discussion in Chapter 4 WAF Component: Services.11.1. Categorization TutorialThis section
124 Chapter 11. Services TutorialsFigure 11-1. Categorization schemeIn the above diagram, the default parent of Televised Events is TV Shows. Its seco
Chapter 11. Services Tutorials 125An application may own more than one category root. Each association may be labeled with a uniquestring, called a co
126 Chapter 11. Services Tutorials• removeChild(ACSObject object) is used to delete a mapping with a child.http://rhea.redhat.com/documentation/api/cc
Chapter 11. Services Tutorials 127Category movies = new Category("Movies", "long television shows");// Create the Romantic Comedie
128 Chapter 11. Services TutorialsFigure 11-4. Category hierarchy before and after code executionAdding the "Titanic" category to two catego
Chapter 11. Services Tutorials 129Figure 11-5. Category hierarchy before and after deleting a categoryYou can delete a category in the following ways:
130 Chapter 11. Services TutorialsCategory b = new Category(new OID(124));Category c = new Category(new OID(125));if ( a != null && b != null
Chapter 11. Services Tutorials 131Figure 11-7. Category Hierarchy before and after removing parent categories11.2.5. Retrieving all Subcategories of a
132 Chapter 11. Services TutorialsSystem.out.println("object = " + object.getObject());Iterator parents = object.getParentCategories().itera
Chapter 11. Services Tutorials 133// Attach some content fetched from a URLURL url = new URL("http://www.yahoo.com/");MessagePart part = new
134 Chapter 11. Services Tutorials11.3.4. Email AlertsThe examples above assume that applications will simply need to notify users of some event via e
Chapter 11. Services Tutorials 135an email alert going out to 1000 users will occupy the same amount of space in the database as a singleemail.11.4. W
Chapter 1.WAF OverviewThis chapter is an overview of the Web Application Framework architecture. This high-level viewpointis especially useful for gai
136 Chapter 11. Services Tutorialspublic HelloWorldTask(OID oid) throwsDataObjectNotFoundException {super(oid);}public HelloWorldTask(BigDecimal id) t
Chapter 11. Services Tutorials 137super;}update {super;}delete {super;}}4. In your package initializer section, create and add a new instantiator.Doma
138 Chapter 11. Services Tutorials11.4.2. Adding a Task to a WorkflowTo add a task, you call the addTask method in workflow. The task is inactive when c
Chapter 11. Services Tutorials 139versioned object type Quux {BigInteger[1..1] id = quuces.id INTEGER;String[1..1] name = quuces.name VARCHAR;object k
140 Chapter 11. Services Tutorials11.5.3. Recoverable typesThe case of compound attributes like country is a little more complex. Let’s look at Exampl
Chapter 11. Services Tutorials 14111.5.5. PDL SyntaxTo specify which object types should be versioned, developers can use the keywords versionedand un
142 Chapter 11. Services Tutorials}versioned object type VTC3 {BigInteger[1..1] id = t_vtc3.id INTEGER;object key(id);}object type C2 {BigInteger[1..1
Chapter 11. Services Tutorials 143Figure 11-8. PDL definition graph
144 Chapter 11. Services TutorialsBased on Figure 11-8, the versioning service decides which object types should be versioned,recoverable, or simply i
Chapter 11. Services Tutorials 145Gray nodes represent types that are ignored by the versioning service.There are two kinds of edges in Figure 11-9:1.
2 Chapter 1. WAF Overview1.1. General ArchitectureThe WAF architecture described in Figure 1-1 follows the standard n-tier design pattern, with separa
146 Chapter 11. Services TutorialsString[1..1] name = frobs.frob_name VARCHARA;}In the above example, the versioning system will ignore changes to the
Chapter 11. Services Tutorials 147public String getSummary(DomainObject dobj) {Note note = (Note)dobj;// Truncate body text & remove any HTML.retu
148 Chapter 11. Services Tutorials11.6.1.3. Content provisionThe remaining method to be implemented in the MetadataProvider interface is the onethat a
Chapter 11. Services Tutorials 149public String getTag() {return "Body Text";}public ContentType getType() {return ContentType.RAW;}public b
150 Chapter 11. Services Tutorialspackage com.example.binder;import com.arsdigita.runtime.CompoundInitializer;import com.arsdigita.runtime.DomainInitE
Chapter 11. Services Tutorials 15111.6.2.2. Displaying resultsThe next stage is to add functionality for processing the query specification and display
152 Chapter 11. Services Tutorialsprivate QueryComponent m_query;private FilterComponent m_typeFilter;private ResultsPane m_results;public NoteSearchC
Chapter 12.Presentation (Bebop) TutorialThis chapter provides useful tutorials for learning and exercising the presentation system using Bebop,as intr
154 Chapter 12. Presentation (Bebop) Tutorialstream from an outside source. This section discusses methods for handling this pre-formatted textintelli
Chapter 12. Presentation (Bebop) Tutorial 15512.3. Site-Wide Master PagesUsually the pages within the scope of a single application share a common lay
Chapter 1. WAF Overview 31.1.1.1. Presentation LayerThe Presentation Layer is responsible for presenting information to the end user. The presentation
156 Chapter 12. Presentation (Bebop) Tutorialprotected void addContents(Element layout, PageState ps) {Element topPanel =new Element("socksite:to
Chapter 12. Presentation (Bebop) Tutorial 157You would use this Page like any other, for example, Page p = new SockPuppetPage();p.add(...); ... Howev
158 Chapter 12. Presentation (Bebop) Tutorial/tablexsl:apply-templates select="bebop:bottom"//xsl:templateThis template must be associated w
Chapter 12. Presentation (Bebop) Tutorial 159*/private class BannerAd extends SimpleComponent {public void generateXML(PageState ps, Element parent) {
160 Chapter 12. Presentation (Bebop) TutorialHttpServletRequest req,HttpServletResponse resp)throws IOException, ServletException {RequestContext rctx
Chapter 12. Presentation (Bebop) Tutorial 161only certain components of PermissionsPane, you must subclass it and overwrite the followingpublic method
162 Chapter 12. Presentation (Bebop) Tutorial12.7.1. Implementing and Registering a Process ListenerYour process listener must be a named Java class i
Chapter 12. Presentation (Bebop) Tutorial 163Page applicationPage = new Page();applicationPage.add(new MetaForm() {public MetaForm() {super("appl
164 Chapter 12. Presentation (Bebop) Tutorial
Chapter 13.Web Applications Tutorial13.1. Support for GlobalizationThis section discusses the internationalization (I18n) features of Java and WAF, an
4 Chapter 1. WAF OverviewFigure 1-3. Basic Configuration1.2.2. ServicesServices are building blocks that address generic requirements common to most WA
166 Chapter 13. Web Applications TutorialNoteIf an application built on WAF relies on a service provided by another package, that package mustalso be
Chapter 13. Web Applications Tutorial 167For example, PropertyResourceBundles might appear as follows for a HelloWorld application,in English, Spanish
168 Chapter 13. Web Applications Tutorial3class. It also contains a localize(java.util.Locale) method, which is used to localize theresource to a part
Chapter 13. Web Applications Tutorial 169// print in English:System.out.println((String) message.localize(new Locale("en", "", &qu
170 Chapter 13. Web Applications Tutorialimport com.arsdigita.dispatcher.Dispatcher;import com.arsdigita.globalization.GlobalizedMessage;public class
Chapter 13. Web Applications Tutorial 171msg.send();Sending Rich Text MessagesRich text messages (i.e. HTML) require using the setBody(html,alternate)
172 Chapter 13. Web Applications Tutorial
Chapter 14.ReferencesThe following references are pointers to additional information that is relevant to WAF but beyond thescope of this guide.Martin
174 Chapter 14. References
III. AppendixesTable of ContentsA. Bebop Tag Library Reference...
Chapter 1. WAF Overview 5Figure 1-4. Basic ConfigurationAs shown in Figure 1-4, all services follow the n-tier design pattern discussed in Section 1.1
Appendix A.Bebop Tag Library ReferenceA.1. Bebop/JSPTag Descriptionshow:all/ Simplifies showing all the components of apage. One such directive is the
178 Appendix A. Bebop Tag Library ReferenceA.2. Available Page Definition TagsCautionThese tags are highly experimental.Tag Descriptiondefine:page name
Appendix A. Bebop Tag Library Reference 179Tag Descriptiondefine:option name=... [value=...][selected=...] [bundle=...] /defines an option within a sel
180 Appendix A. Bebop Tag Library Reference
Appendix B.PL/SQL StandardsLike any other part of WAF, PL/SQL code must be maintainable and professional. This means thatit must be consistent and the
182 Appendix B. PL/SQL Standards4. Always qualify end statements. The end statement for a package should be endpackage_name ;, not just end;. The same
Appendix B. PL/SQL Standards 183The function above takes the optional argument object_id. Do this to allow people to use thesame API call when they ar
184 Appendix B. PL/SQL Standards2. Truncate the column name until it fits.create table example_topics (topic_id integerconstraint example_topics_topic_
Appendix B. PL/SQL Standards 185Execution Plan----------------------------------------------------------0 SELECT STATEMENT Optimizer=CHOOSE1 0 NESTED
Red Hat Web Application Framework 6.1: WAF Developer GuideCopyright © 2004 by Red Hat, Inc.Red Hat, Inc.1801 Varsity DriveRaleigh NC 27606-2072 USAPho
6 Chapter 1. WAF Overview1.2.3. InfrastructureInfrastructure contains software to support the mechanics of application building at each layer ofthe ar
186 Appendix B. PL/SQL StandardsExtending this process farther, there should be a single upgrade script for all of WAF per version. Thisupgrade script
Appendix C.Java StandardsA good developer knows that there is more todevelopment than programming. A great de-veloper knows that there is more to deve
188 Appendix C. Java Standards5. Acronyms, such as JDBC or URL, should always be capitalized when used. For instance, writeJDBCLoader instead of JdbcL
Appendix D.PDL SyntaxThis chapter introduces the syntax for the Persistence Definition Language.D.1. PDL GrammarThe following is an Extended Backus-Nau
190 Appendix D. PDL Syntaxproperty :=( <IMMEDIATE> )?( ( <VERSIONED> | <UNVERSIONED> ) )?( <UNIQUE> )?( ( <COMPONENT> |
Appendix D. PDL Syntax 191idpath := id ( <DOT> id )*id := <ID>integer := <INT>D.2. PDL Reserved WordsD.2.1. PDL KeywordsThe followin
192 Appendix D. PDL SyntaxIMPORT = importINSERT = insertJOIN = joinMAP = mapMODEL = modelOBJECTKEY = object <WS> keyOBJECTTYPE = object <WS&g
Appendix D. PDL Syntax 193• component — this word is reserved for future use.• composite — used to signify a definition of a composite relationship bet
194 Appendix D. PDL Syntax• retrieve — used to signify the beginning of the block of code defining the retrieve event. Oneexample of this would be a co
Appendix D. PDL Syntax 195model tutorial;object type Publication {BigDecimal id = publications.publication_id INTEGER;String name = publications.name
Chapter 1. WAF Overview 7Figure 1-5. Basic ConfigurationAgain, each application follows the same n-tier design pattern, and builds upon the kernel and
196 Appendix D. PDL Syntaxobject type screenName {BigDecimal id = screen_names.name_id INTEGER;String screenName = screen_names.screen_name VARCHAR(70
Appendix D. PDL Syntax 197and magazine_article_map.article_id =article_author_map.article_idand article_author_map.author_id = authors.author_id} map
198 Appendix D. PDL SyntaxBigDecimal articleID;options {WRAP_QUERIES = false;}do {select max(article_id) from articles} map {articleID = articles.arti
Appendix D. PDL Syntax 199where relation_type = :relationType)connect by prior related_category_id = category_idstart with category_id = :categoryID)
200 Appendix D. PDL Syntaxcreate table paragraphs (paragraph_id integerconstraint paragraphs_paragraph_id_pkprimary keyconstraint paragraphs_paragraph
Appendix D. PDL Syntax 201DataQueryPLSQLFunction(v_article_id in integer)return numberisv_title varchar(700);beginselect title into v_title from artic
202 Appendix D. PDL Syntax
Persistence GlossaryThe terms used by the persistence system are largely based upon the Unified Modeling Language(UML) terminology. For background info
204 Persistence GlossaryDomain ObjectDomain objects are not part of the persistence layer, but since they are the most common wayto access a Data Obje
Persistence Glossary 205Link AttributesA Link is the path from one object to another. Associations are types of links. A Link Attributeis a property o
8 Chapter 1. WAF Overview
206 Persistence Glossaryselect code and tables herewhere secondtable.second_object_id_one = firsttable.object_id_oneand secondtable.second_object_id_t
Persistence Glossary 207UML ClassA UML Class is a description of a set of objects that share the same attributes, operations, andrelationships. A UML
208 Persistence Glossary
IndexAacronymspresentation, 19ACSObjectbase permissioning class, 11APImail, 16appenderscustom WAF, 47logging, 47ApplicationBaseServlet defined, 31prope
210logging concepts, 42problems with System.out.println(), 43with Eclipse, 41with log4j, 43deployingwith Eclipse, 40Derived Associations, 203developer
211JJava coding standards, 187references, 188JavaServer Pages(See JSP)Join Element, 204Join Path, 204Join Paths, 89JSPBebop integration, 28dynamic pag
212OObjectPersistence, 9Object KeyDefined, 206Example, 65Object TypeInheritance, 69Model, 65Object-RelationalMapping, 9OrderingExamples, 79How-To, 85ou
213Ssearchservice concept, 17serviceauditing, concepts of, 13categorization, concepts of, 13formbuilder, concepts of, 14globalization, concepts of, 15
214XXSLPresentation Conventions, 20XSLTBebop, using with, 153globalization, 170implementing, 153overriding default stylesheet, 159using with WAF, 20
ColophonThe Red Hat Applications manuals are written in DocBook SGML v4.1 format. The HTML and PDFformats are produced using custom DSSSL stylesheets
Chapter 2.WAF Component: PersistenceThis chapter discusses the persistence layer in the overall Web Application Framework. This wasoriginally discusse
216
10 Chapter 2. WAF Component: PersistenceFor a listing of PDL terms, see Appendix D PDL Syntax. Examples of PDL usage can be found inChapter 9 Persiste
Chapter 3.WAF Component: KernelThis chapter discusses the kernel layer, which provides services used by several parts of the WAFsystem. This component
12 Chapter 3. WAF Component: Kernel• What parties have a particular privilege on a particular object?• What privileges does a particular party have on
Chapter 4.WAF Component: ServicesWAF provides a number of generic services that can be used in developing a WAF application. Ser-vices leverage the bu
14 Chapter 4. WAF Component: Services• Entertainment• Music• Movies• Television Shows• Education• Literacy• Testing• Home Schooling• Theories• Sports•
Chapter 4. WAF Component: Services 15introduced to the market. Rather than requiring programming for this straightforward functionality,WAF provides t
Table of ContentsIntroduction to the WAF Developer Guide... i1. A
16 Chapter 4. WAF Component: Servicesas reported by the user’s browser, and compares them to the list of languages and locales thatthe system is config
Chapter 4. WAF Component: Services 171. The message body should have a MIME type of text/plain or text/html.2. Each attachment to the message can have
18 Chapter 4. WAF Component: Services4.10. Workflow ServiceWorkflows allow specialized members of a group to collaborate using a standard process. Devel
Chapter 5.WAF Component: PresentationInformation in the database ultimately needs to be presented to the user for viewing and manipulating.The Web App
20 Chapter 5. WAF Component: Presentation• JavaServer Pages (JSP) is a J2EE standard for scripting dynamic web pages. JSPs typically produceHTML, thou
Chapter 5. WAF Component: Presentation 21BasePresentationManager or swap it out with its own to use a different algorithm for choosing astylesheet for
22 Chapter 5. WAF Component: Presentationcom.arsdigita.templating.PatternStylesheetResolver class is the new preferredresolver and now the default set
Chapter 5. WAF Component: Presentation 235.2.2.3. Pattern GeneratorsThe com.arsdigita.templating.PatternGenerator interface provides the mechanism for
24 Chapter 5. WAF Component: PresentationlocaleThis pattern generator expands to the current kernel execution context locale. ie the value re-turned b
Chapter 5. WAF Component: Presentation 255.3. JavaServer Pages (JSP)JSP technology is a J2EE standard for presentation. JSP pages have full access to
8.4. Build Tools... 508.5. Modeling Your Appli
26 Chapter 5. WAF Component: PresentationFigure 5-1. Tabbed Pane Using Bebop Components5.4.1. Working With BebopChapter 12 Presentation (Bebop) Tutori
Chapter 5. WAF Component: Presentation 27TabbedPane tabs = new TabbedPane();page.add(tabs);tabs.addTab("Browse", new BrowsePane());tabs.addT
28 Chapter 5. WAF Component: Presentation5. Fire the control event.When a client sends a request to a Bebop page (e.g. a mouse-click on a tab); only o
Chapter 5. WAF Component: Presentation 291. The requested JSP obtains an XML document from a Bebop page object and the current requeststate.2. The tag
30 Chapter 5. WAF Component: Presentationdefine:option label=" %= rtexpr % " value=" %= expr % "/% } %/define:radioGroupThis is es
Chapter 6.WAF Component: WebThe Web component of WAF makes the persistent data and domain logic of your application availableto others over protocols
32 Chapter 6. WAF Component: Web• Request context — The BaseServlet packages certain facts about the request, such as the currentuser, current applica
II. Equipping DevelopersThis section provides information needed to develop on the Web Application Framework. Includedis a chapter on setting up a dev
Chapter 7.Developing with WAFThis chapter introduces prerequisites to working with WAF as well as the tools that are available tothe developer.It is p
B.3. Coding Style... 183B.4. Constraint Naming Stan
36 Chapter 7. Developing with WAFincludes a secure telnet replacement and a secure file-copy utility (scp). Both open source and propri-etary implement
Chapter 7. Developing with WAF 37It is possible to have Developer Support enabled and not running. This still provides a measurableperformance hit bec
38 Chapter 7. Developing with WAFShow Hits To Developer SupportThe Show hits to developer support link on the Developer Support index page toggles the
Chapter 7. Developing with WAF 39TipIt is recommended to only select Warning for the options:• Methods overridden but not package visible• Methods wit
40 Chapter 7. Developing with WAFCMS and Other ProjectsTo add CMS or other projects to Eclipse, follow the same steps as for adding WAF, with thefollo
Chapter 7. Developing with WAF 41#cleancd $CCM_HOMEant clean#buildcd $CCM_HOMEant deploy#javadoccd $CCM_HOMEant javadocant deploy-apiExample 7-1. Shel
42 Chapter 7. Developing with WAFWAF Debugging SetupIn Eclipse, select Run = Debug. In the dialog box, select Remote Java Application and thenclick on
Chapter 7. Developing with WAF 437.5.1. Log4JUsing System.out.println() for logging has numerous drawbacks.1. It degrades performance. There is no eas
44 Chapter 7. Developing with WAFgreater than or equal to the current level of the logger. For example, if you set the foo.bar.bazlogger’s level to wa
Chapter 7. Developing with WAF 45try {doSomething();} catch (FooException ex) {s_log.debug(ex);}Example 7-4. Swallowed stack trace anti-patternThere i
46 Chapter 7. Developing with WAFpackage foo.bar;import org.apache.log4j.Logger;public class Baz {private final static Logger s_log = Logger.getLogger
Chapter 7. Developing with WAF 47}Example 7-9. Adjusting logging level temporarilyIn the above example, you end up enabling the PreparedStatement logg
48 Chapter 7. Developing with WAFWhat kind of I/O does log4j use: buffered or unbuffered? It depends on how the particular appenderis configured. In th
Chapter 8.WAF Application Development TutorialThis tutorial introduces the concepts and techniques needed to create your own application in the RedHat
50 Chapter 8. WAF Application Development TutorialThe standard layout of files in the build environment of a WAF application follows the guidelinesset
Chapter 8. WAF Application Development Tutorial 518.5. Modeling Your ApplicationA new application is represented by a persistent Application object. A
52 Chapter 8. WAF Application Development Tutorial8.7. Java Domain ObjectsEach object type will have a corresponding domain class written in Java. The
Chapter 8. WAF Application Development Tutorial 53/*** Removes <code>note</code> from the set of notes tracked by this* <code>Binder
54 Chapter 8. WAF Application Development Tutorialpackage com.example.binder;import com.arsdigita.db.Sequences;import com.arsdigita.domain.DomainObjec
Chapter 8. WAF Application Development Tutorial 55/*** Sets the title of the note.** @param title The <code>String</code> title; it cannot
Introduction to the WAF Developer GuideThe Red Hat Web Application Framework is a platform for writing database-backed web applicationsin Sun’s Java®.
56 Chapter 8. WAF Application Development TutorialIn many ways, Note.java is just like Binder.java. It declares its data object type; it defines aninst
Chapter 8. WAF Application Development Tutorial 57** @return The <code>String</code> title; it cannot be null*/public final String getTitl
58 Chapter 8. WAF Application Development Tutoriale.getFactory().registerInstantiator(Binder.BASE_DATA_OBJECT_TYPE,new DomainObjectInstantiator() {pro
Chapter 8. WAF Application Development Tutorial 59/*** A servlet to serve pages of the binder application.** @see com.example.binder.Binder* @author J
60 Chapter 8. WAF Application Development Tutorial8.10. Integrating Your Package With CCM ToolsThe WAF environment includes a set of tools for loading
Chapter 8. WAF Application Development Tutorial 61Creating A ccm Tool Upgrade Script in Java1. Create arbitrary Java code that is accessible via a sta
62 Chapter 8. WAF Application Development Tutorial
Chapter 9.Persistence TutorialThis chapter presents a tutorial for using the persistence system. It presumes you are familiar with theconcepts covered
64 Chapter 9. Persistence Tutorial• A database schema to handle the storage of the Data Objects.Some designers may feel more comfortable starting with
Chapter 9. Persistence Tutorial 659.2.3.2. Model and Object TypeWhen creating a PDL file, the first line of the file must be the name of the model that d
ii Introduction to the WAF Developer GuideapplicationThis style indicates that the program is an end-user application (as opposed to system software).
66 Chapter 9. Persistence TutorialThis object type definition almost models the SQL that we have defined above but it is missing anymention of the uniqu
Chapter 9. Persistence Tutorial 67• SessionManager — http://rhea.redhat.com/doc/waf/6.0/api/com/arsdigita/persistence/\ Session-Manager.html.This clas
68 Chapter 9. Persistence Tutorial• PersistenceException — http://rhea.redhat.com/doc/waf/6.0/api/com/arsdigita/persistence/\PersistenceException.html
Chapter 9. Persistence Tutorial 69DataCollections are also useful when it is necessary to perform certain tasks on a large numberof Data Objects. Supp
70 Chapter 9. Persistence Tutorial// a "reference key" declaration and "id" is not defined// as one of the attributesreference key
Chapter 9. Persistence Tutorial 71NoteThe order of the join path is important. The information that the developer has must come first.That is, when the
72 Chapter 9. Persistence Tutorial}9.3.3. Role ReferencesDevelopers ofen only need to be able to obtain associated information in a single direction.
Chapter 9. Persistence Tutorial 73// create the mapping table with the page_number column.BigDecimal pageNumber = magazine_article_map.page_number INT
74 Chapter 9. Persistence Tutorialassociation has a Multiplicity of 0..1 or 1..1 (or any upper bound = 1) then developers should usethe setAssociation
Chapter 9. Persistence Tutorial 75To accomplish the task of retrieving the paragraphs as mentioned above, you could declare the fol-lowing DataQuery i
Introduction to the WAF Developer Guide iii$#[stephen@maturin stephen]$leopard login:user inputText that the user has to type, either on the command l
76 Chapter 9. Persistence TutorialThe PDL is simply a Data Query with extra Attribute definitions (remove the "\" and make it all oneline).qu
Chapter 9. Persistence Tutorial 779.4.2.1. Executing Arbitrary DMLData Operations are similiar to DataQueries in both structure and use. However, whil
78 Chapter 9. Persistence Tutorialselect nvl(max(magazine_id), 0) + 1, :title from magazine_id;end;/show errorsTo do this, first include the above stat
Chapter 9. Persistence Tutorial 79NoteThe do call and OUT parameters are not available for Postgres because Postgres has not yet imple-mented Callable
80 Chapter 9. Persistence Tutorial9.5.1. Filtering9.5.1.1. OverviewThe filtering system is complex, in that it allows developers to create complex expr
Chapter 9. Persistence Tutorial 81}To retrieve all users whose last name is "Smith", do the following:DataQuery query = session.retrieveQuer
82 Chapter 9. Persistence TutorialSystem.out.println("First name = " + query.get("firstName") +"; Last name = " + query.
Chapter 9. Persistence Tutorial 83query retrieveAllUsers {User myUser;do {select user_id, first_name, last_name from users} map {user.id = users.user_
84 Chapter 9. Persistence Tutorialselect article_idfrom authors, author_article_mapwhere authors.author_id = author_article_map.author_idand lower(las
Chapter 9. Persistence Tutorial 859.5.1.6. Filtering Using FunctionsThe filtering methods discussed so far work well when the developer only needs to fi
Komentáře k této Příručce