stargeek
PHP news website logo.
home    PHP scripts    articles    seo tools    links    search    contact    shop    realtors


Enterprise Java Beans - Part 2, Implementing Your First EJBs







Enterprise Java Beans - Part 2,
Implementing Your First EJBs

Enterprise Java Beans - Part 2,
Implementing Your First EJBs
11/14/2003 03:33 AM

WebmasterBase Nov 14 2003 2:36AM ET




This is a GrokNews Entry: (what is grok?)





Similar Items

Enterprise Java Beans - Part 2, Implementing Your First EJBs

Grok Headline matches for Enterprise Java Beans - Part 2, Implementing Your First EJBs

Enterprise Java Beans, A Primer: Part 2,
Implement Your First EJBs


Enterprise Java Beans, A Primer: Part 2,
Implement Your First EJBs
11/17/2003 12:59 AM
WebmasterBase Nov 16 2003 11:32PM ET

Eclipse to Get a Hand in Enterprise Java
Beans


Eclipse to Get a Hand in Enterprise Java
Beans
04/13/2005 03:18 PM

Implementing CSS (Part 1)


Implementing CSS (Part 1) 06/05/2005 11:17 PM

One of the most interesting problems (to me at least) in browser layout engines is how to implement a style system that can determine the style information for elements on a page efficiently. I worked on this extensively in the Gecko layout engine during my time at AOL and I've also done a lot of work on it for WebCore at Apple. My ideal implementation would actually be a hybrid of the two systems, since some of the optimizations I've done exist only in one engine or the other.

When dealing with style information like font size or text color, you have both the concept of back end information, what was specified in the style rule, and the concept of front end information, the computed result that you'll actually use when rendering. The interesting problem is how to compute this front end information for a given element efficiently.

Back end information can be specified in two different ways. It can either be specified using CSS syntax, whether in a stylesheet or in an inline style attribute on the element itself, or it is implicitly present because another attribute on the element specified presentational information. An example of such an attribute would be the color attribute on the font tag. Both WebCore and Gecko use the term mapped attribute to describe an attribute whose value (or even mere presence) maps to some implicit style declaration.

A rule in CSS consists of two pieces. There is the selector, that bit of information that says under what conditions the rule should match a given element, and there is the declaration, a list of property/value pairs that should be applied to the element should the selector be matched.

All back end information can ultimately be thought of as supplying a declaration. A normal rule in a stylesheet that is matched has the declaration specified as part of the rule. An inline style attribute on an element has no selector and is simply a declaration that always applies to that element. Similarly each individual mapped attribute (like the color and face attributes on the font tag) can be thought of as supplying a declaration as well.

Therefore the process of computing the style information for an element can be broken down into two phases. The first phase is to determine what set of declarations apply to an element. Once that back end information has been determined, the second phase is to take that back end information and quickly determine the information that should be used when rendering.

WebCore (in upcoming Safari releases) has a really cool optimization that I came up with to avoid even having to compute the set of declarations that apply to an element. This optimization in practice results in not even having to match style for about 60% of the elements on your page.

The idea behind the optimization is to recognize when two elements in a page are going to have the same style through DOM (and other state) inspection and to simply share the front end style information between those two elements whenever possible.

There are a number of conditions that must be met in order for this sharing to be possible:
(1) The elements must be in the same mouse state (e.g., one can't be in :hover while the other isn't)
(2) Neither element should have an id
(3) The tag names should match
(4) The class attributes should match
(5) The set of mapped attributes must be identical
(6) The link states must match
(7) The focus states must match
(8) Neither element should be affected by attribute selectors, where affected is defined as having any selector match that uses an attribute selector in any position within the selector at all
(9) There must be no inline style attribute on the elements
(10) There must be no sibling selectors in use at all. WebCore simply throws a global switch when any sibling selector is encountered and disables style sharing for the entire document when they are present. This includes the + selector and selectors like :first-child and :last-child.

The algorithm to locate a shared style then goes something like this. You walk through your previous siblings and for each one see if the above 10 conditions are met. If you find a match, then simply share your style information with the other element. Such a system obviously assumes a reference counting model for your front end style information.

Where this optimization kicks into high gear, however, is that it doesn't have to give up if no siblings can be located. Because the detection of identical style contexts is essentially O(1), nothing more than a straight pointer comparison, you can easily look for cousins of your element and still share style with those elements.

The way this works is that if you can't locate a sibling, you can go up to a parent element and attempt to find a sibling or cousin of the parent element that has the same style pointer. If you find such an element, you can then drill back down into its children and attempt to find a match.

This means that for HTML like the following:

<table>
<tr class='row'>
<td class='cell' width=300 nowrap>Cell One</td>
</tr>
<tr class='row'>
<td class='cell' width=300 nowrap>Cell Two</td>
</tr>

In the above example, not only do the two rows share the same style information, but the two cells do as well. This optimization works extremely well for both old-school HTML (in which many deprecated presentational tags are used) and newer HTML (in which class attributes might figure more prominently).

Once the engine determines that a style can't be shared, i.e., that no pre-existing front end style pointer is available, then it's time to figure out the set of declarations that match a given element. It is obvious that for inline style attributes and mapped attributes that you can find the corresponding declaration quickly. The inline style declaration can be owned by the element, and the mapped attributes can be kept in a document-level hash. WebCore has a bit of an edge over Gecko here in that it treats each individual mapped attribute on an element as a separate declaration, whereas Gecko hashes all of the mapped attributes on an element as a single "rule." This means that Gecko will not be able to share the mapped attribute declaration for the following two elements:

<img width=300 border=0>
<img width=500 border=0>

WebCore creates three unique declarations and hashes them, one for a width of 300, one for a width of 500, and one for a border of 0. Gecko creates two different "rules," one for (width=300,border=0) and another for (width=500,border=0). As you can see in such a system, you will frequently not be able to treat the identical border attributes as the same.

Aside from this difference in mapped attribute handling, the two engines employ a similar optimization for quickly determining matching stylesheet rules called rule filtering. All rules that are potentially matchable by any element (i.e., that have the correct media type) are hashed based on the contents of the rightmost simple selector in the rule.

A selector in CSS can be either simple (meaning that all of the contents of that selector apply only to a single element) or compound (meaning that you may examine multiple elements like parents or siblings of that element). A compound selector is essentially a chain of simple selectors, so the following rule:

tr > td { color: blue }

has two simple selectors, tr and td. The rightmost simple selector in the rule is the one that we will use for the rule filtering optimization.

The rightmost simple selector falls into four categories.

(1) The selector uses an ID. (Example: #foo)
(2) The selector doesn't have an ID but uses a class. (Example: .foo)
(3) The selector has no class or ID but specifies a tag name. (Example: div)
(4) The selector specifies none of these things. (Example: *[disabled])

The rule is placed into one of four hashtables depending on which category it falls into. The idea behind these categorizations is to always filter out more specific information first. For example, if an element has a specific ID, then obviously any rules whose rightmost selector uses a different ID cannot match. Technically the last category can just be a list and not a hashtable, since those rules must always be examined by all elements.

Each hashtable, therefore, consists of a mapping from a given atomic string to a set of rules that match. The class attribute is exceptional in that you must put the rule into the hashtable multiple times if multiple class attributes are used.

When determining the set of rules that match a given element, you only examine rules that correspond to the correct hash entry based off your ID, classes and tag name. This optimization basically eliminates 95+% of the rules up front so that they need not even be considered during the matching process.

Each rule is then examined in detail, with all selectors being checked, to determine if it is a match, and the set of matches is collected. The set of matches can then be sorted by priority and specificity such that all the declarations are in the proper application order.

This brings us to the final phase of the style computation, which is taking the set of matches and quickly computing the appropriate front end style information. It is here that Gecko really shines. What I implemented in Gecko was a data structure called the rule tree for efficient storing of cached style information that can be shared *even when* two elements are not necessarily the same.

The idea behind the rule tree is as follows. You can think of the universe of possible rules in your document as an alphabet and the set of rules that are matched by an element as a given input word. For example, imagine that you had 26 rules in a stylesheet and you labeled them A-Z. One element might match three rules in the sheet, thus forming the input word "C-A-T" or another might form the input word "D-O-G."

There are several important observations one can make once you formulate the problem this way. The first is that words that are prefixes of a larger word will end up applying the same set of rules. All additional letters in the word do is result in the application of more declarations. Thus the rule tree is effectively a lexicographic tree of nodes, with each node in a tree being created lazily as you walk the tree spelling out a given word.

This system allows you to cache style information at each node in the tree. This means that once you've looked up the word "C-A-T-E-R-W-A-U-L", and cached information at all of the nodes, then looking up the word "C-A-T" becomes more efficient.

In order to make the caching efficient, properties can be grouped into categories, with the primary criterion for categorization being whether the property inherits by default. It's also important to group properties together that would logically be specified together, so that when a fault occurs and you have to make a copy of a given struct, you do so knowing that the other values in the struct were probably going to be different anyway.

Once you have the properties grouped into categories like the border struct or the background struct, then you can either store these structs in the rule tree or as part of a style tree that more or less matches the structure of the document. Inheritance has to apply down the style tree and tends to force a fault, whereas non-inherited properties can usually be cached in the rule tree for easy access.

WebCore doesn't contain a rule tree, but it is smart enough to refcount the structs and share them as long as no properties have been set in the struct. In practice this works pretty well but is not as ideal as the rule tree solution.


OOP Java: A little business logic with
your beans


OOP Java: A little business logic with
your beans
02/19/2003 02:34 AM
CNET Feb 19 2003 1:24AM ET

Implementing XPath for Wireless Devices,
Part II


Implementing XPath for Wireless Devices,
Part II
07/17/2002 07:16 PM
In the second of a two-part series, we explore the implementation of XPath on wireless devices using the WAP family of standards.

Implementing XPath for wireless devices,
part II (XML.com)


Implementing XPath for wireless devices,
part II (XML.com)
07/18/2002 07:34 PM

Java Enterprise TeamWork


Java Enterprise TeamWork 11/17/2003 12:56 AM
Working hard

Open Java Enterprise Framework


Open Java Enterprise Framework 06/03/2004 10:46 AM
Le développement avance !

Java 'Tiger' Divides the Enterprise


Java 'Tiger' Divides the Enterprise 07/23/2004 02:36 PM
Application integrators signal a reluctance to upgrade to J2SE 5.0 on first pass.

Sun planea liberar Java Enterprise


Sun planea liberar Java Enterprise 03/31/2005 05:02 PM

Architect Java enterprise apps


Architect Java enterprise apps 10/02/2002 11:17 PM
CNET Oct 2 2002 10:02PM ET

Apple's Enterprise IT Battle Plan, Part
Two


Apple's Enterprise IT Battle Plan, Part
Two
05/24/2004 06:42 PM
Can Apple gain a foothold in the volatile enterprise market with software as well as hardware? By Elizabeth Millard, MacNewsWorld (via MyAppleMenu)

Storage and Its Impact on Enterprise
Viability, Part II


Storage and Its Impact on Enterprise
Viability, Part II
04/22/2004 06:43 PM
Internet.com Apr 22 2004 10:19PM GMT

Enterprise Java Open Source Architecture


Enterprise Java Open Source Architecture 02/10/2004 03:58 PM
EJOSA Revolutions Beta CVS

An Easy Way to Develop JAVA Enterprise
Applications


An Easy Way to Develop JAVA Enterprise
Applications
08/19/2004 05:03 PM
WebDevInfo Aug 19 2004 8:46PM GMT

Java Enterprise Destined for Open Source


Java Enterprise Destined for Open Source 07/15/2004 05:16 PM
Sun hints that pieces of the company's application server will follow in the footsteps of Solaris and Project Looking Glass.

Sun Microsystems releases Java
Enterprise System


Sun Microsystems releases Java
Enterprise System
11/05/2003 01:54 AM

Sun Microsystems has released a new software geared toward higher education users, hoping to compete with Microsoft in that market.

The New York Times reports that "The Java Enterprise System is designed to serve various functions, including network identity management, communications and collaboration, Web applications and security services at an affordable price, the company said.

"The software will be available to educational institutions for an annual license fee of $50 per year, per faculty or administrative staff. A single subscription covers the price of the software, maintenance and consulting, in addition to the infinite right to use the software in Internet applications."


Sun Extends Java Enterprise System to
Windows


Sun Extends Java Enterprise System to
Windows
07/27/2004 11:22 AM

Java Enterprise Gains Broader Support


Java Enterprise Gains Broader Support 09/01/2004 07:04 PM
Borland, CA, Quest and Mercury adopt Sun's application server for development as the company inks deals with a European wireless telco and Back Bay Technologies.

EJBlog - "Enterprise Java" Blog System


EJBlog - "Enterprise Java" Blog System 06/22/2004 11:37 PM
Initial release almost ready!

Questions about Longhorn, part 3:
Avalon's enterprise mission


Questions about Longhorn, part 3:
Avalon's enterprise mission
06/09/2004 02:10 PM
< /a> The slide shown at the right comes from a presentation entitled Windows client roadmap, given last month to the International .NET Association (INETA). When I see slides like this, I always want to change the word "How" to "Why" -- so, in this case, the question would become "Why do I have to pick between Windows Forms and Avalon?" Similarly, MSDN's Channel 9 ran a video clip of Joe Beda, from the Avalon team, entitled How should developers prepare for Longhorn/Avalon? that, at least for me, begs the question "Why should developers prepare for Longhorn/Avalon?" ...

Get started with EJBs


Get started with EJBs 06/26/2002 01:00 PM
CNET Jun 23 2002 10:22PM ET

Open-Source Future For Java Enterprise
System?


Open-Source Future For Java Enterprise
System?
04/01/2005 03:37 AM
Information Week Apr 1 2005 8:16AM GMT

Java Enterprise Serves Up Lower-Cost
Suites


Java Enterprise Serves Up Lower-Cost
Suites
02/05/2005 09:53 PM

Sun to Show Updated Java Enterprise,
Desktop Systems


Sun to Show Updated Java Enterprise,
Desktop Systems
06/01/2004 07:37 AM
Top among the product announcements Sun is making are the next releases of its Java Enterprise System and Java Desktop System.

Sun Gives Java Enterprise System License
to Small Businesses


Sun Gives Java Enterprise System License
to Small Businesses
04/19/2004 11:15 AM
Sun Microsystems Inc. officials on Monday will use its iForce partner summit in San Diego to announce a special promotional program to let companies with less than 100 employees sign up for a free, one-year runtime license for its Java Enterprise System software.

Sun's Java Enterprise System stays in
school


Sun's Java Enterprise System stays in
school
11/04/2003 12:15 PM
The computing systems maker unveils low-cost Java software that it will license to schools, in a continued effort to get a larger piece of the vast academic pie.

Anti virus software embedded in
Enterprise Java


Anti virus software embedded in
Enterprise Java
04/26/2004 08:50 AM

Sun eyes open-source for its Java
Enterprise System


Sun eyes open-source for its Java
Enterprise System
07/16/2004 05:19 PM
The Java Enterprise System includes Sun's application, Web, directory, security and communication and collaboration offerings and is integrated with much of the company's hardware.

Java Enterprise System 3 Attacks
Business Woes


Java Enterprise System 3 Attacks
Business Woes
02/01/2005 08:58 PM
Sun Microsystems is rolling out its newest Java Enterprise System release, along with five market-driven subsets aimed at solving specific business problems.

Enterprise Customer Profile (ECP)
Release 2.0 Now Available for the Java
Platform


Enterprise Customer Profile (ECP)
Release 2.0 Now Available for the Java
Platform
09/22/2004 02:28 AM
New Release of Leading CDI Software Extends Supported Platform Base [PRWEB Sep 22, 2004]

Sun Extends Java Enterprise System to
Windows (Ziff Davis)


Sun Extends Java Enterprise System to
Windows (Ziff Davis)
07/27/2004 09:13 AM
Ziff Davis -

Netscape NSS Library Vulnerability
Affects Sun Java Enterprise System


Netscape NSS Library Vulnerability
Affects Sun Java Enterprise System
09/21/2004 10:39 PM
Jérôme (Sep 21 2004)

Using Java objects in PHP scripts Part 2


Using Java objects in PHP scripts Part 2 06/26/2002 01:01 PM
In part two of the Java series, I’ll be discussing in more detail the do's and dont's of trying to get Java to work with PHP.

Event Handling In Java Part II


Event Handling In Java Part II 10/28/2003 11:06 PM
With the skills that you have developed so far from Part I of the tutorial, you can design a graphical user interface with beauty and easy. Let us refresh ourselves before we proceed, Events are method calls that Javas windowing system performs whenever any element of a user interface is manipulated.

[O'Reilly's Onjava.com]Java vs. .NET
Security, Part 2


[O'Reilly's Onjava.com]Java vs. .NET
Security, Part 2
12/11/2003 06:12 AM

J2EE Security for Servlets, EJBs, and
Web Services


J2EE Security for Servlets, EJBs, and
Web Services
08/18/2004 08:15 PM

Generics in C#, Java, and C++: A
Conversation with Anders Hejlsberg, Part
VII


Generics in C#, Java, and C++: A
Conversation with Anders Hejlsberg, Part
VII
01/27/2004 03:36 AM
Anders Hejlsberg, the lead C# architect, talks with Bruce Eckel and Bill Venners about C# and Java generics, C++ templates, contraints, and the weak-strong typing dial.

LogicaCMG Wireless Networks Drives
Increased Mobile Services With Sun
Java(TM) Enterprise System


LogicaCMG Wireless Networks Drives
Increased Mobile Services With Sun
Java(TM) Enterprise System
09/01/2004 03:50 AM
Investors Business Daily Sep 1 2004 7:26AM GMT
Grok Description matches for Enterprise Java Beans - Part 2, Implementing Your First EJBs
GrokA matches for Enterprise Java Beans - Part 2, Implementing Your First EJBs

Enterprise Java Beans - Part 2, Implementing Your First EJBs

The following phrases have been identified by the grok system as matching this entry:

















Also check out:


Grok

Ipod Porn on the
Rise

Brief Abstract of
Wikipedia's
Mesothelioma Cancer
page

Get first aid
instructions in your
cell phone

IE is crap
JSPWiki gains
podcasting support

College
Hostage-Taker
Ordered to Hospital

Guard in Nude Photo
Flap Ordered Rehired

Egyptian Twins to
Leave Dallas
Hospital

U.S. Urges Iraq
Power Shift; Top
General Returning

Rumsfeld Says No
Early U.S. Pullout
from Iraq

Former Head of
Islamic Charity
Sentenced

Man Accused of
Killing Prankster
Charged

Brothers Sentenced
in Hunters' Murders

Dell sales jump
16pc, led by server
and storage growth

IBM Claims New
Supercomputer As
Fastest

Dirty business
Funds Find Nanotech
Alluring But Still
Risky

Cisco's profit
jumps; sector
recovery seen

Dell's Sales, Cost
Savings Boost Profit

Microsoft Urges EC
Regulators Not to
Order Windows
Software Change

How Many Social
Networks Is Too
Many?

GetBot v3.0
asciimatrix
The Day the Music
Died

Americans are naming
their babies after
brands

Freshmen Direct
Films For Inaugural
iMovie Festival

CNET acquires
MP3.com assets

West Australian
students get iBooks

Reverse Connect
StegScan
JCalc
Aston Martin And
Motorola An
Exclusive Allia

Cellcom to publish
tender for 3G
network construction

IBM to launch
pro-Linux drive

A ROSIE DRAW: NO
DAMAGES IN MAG TRIAL

XX LIMBAUGH SETS
MONDAY RETURN TO
AIRWAVES XX

Let them sing it for
you

CSS layout creator
Sun extends grid
computing strategy

IP Applications
Internet Technology
Selected by AOL
Canada to Support
its Newest
Nationwide Netscape
Online In

Chess Master Loses
2nd Game to Computer

High-speed Net
prices plunge

Technology could
save Welsh NHS
millions say
Conservatives

Information systems
at heart of health
service improvement
, conference wil say

Theatre Museum puts
collection online
with New
Opportunities Fund
help

ID cards: Reaction
from Scottish
National Party

Successful roll-out
of new NHS messaging
service

IBM offers glimpse
of Blue Gene
performance

Microsoft pledges EU
'solutions'

Perfect Solar Storm
Brewing?

AT&T Wireless
offering the Treo
600

NetSnap v1.3.3 Beta
Margaret
gtk2-perl
White House yields
to 9/11 panel

what is grok?