efe2235d8b56c74a3e1bcbd0aca6f41c.ppt
- Количество слайдов: 47
The Cernunnos Project Andrew Wills JA-SIG 2007 Summer Conference, Denver Monday June 25 th, 2007 © Copyright Unicon, Inc. , 2006. This work is the intellectual property of Unicon, Inc. Permission is granted for this material to be shared for non -commercial, educational purposes, provided that this copyright statement appears on the reproduced materials and notice is given that the copying is by permission of Unicon, Inc. To disseminate otherwise or to republish requires written permission from Unicon, Inc.
1. Introduction 2. Motivation, Goals, & Strategy 3. Using Cernunnos 4. Cernunnos & u. Portal
Introducing Cernunnos • Cernunnos is an open source Java technology for implementing, instrumenting, and combining valuable software behavior • Project Home Page (Google Code): http: //code. google. com/p/cernunnos/ • Community (Google Groups): http: //groups. google. com/group/cernunnos-discussion/ • Presently, there is one contributor (guess who? )
The Cernunnos Platform • Cernunnos provides a medley of components out-of-the-box (just like Java): – A contract for Tasks & Phrases (Java API) – A basic container implementation for running Tasks & Phrases – An assortment of useful Task & Phrase implementations – A core syntax for instrumenting these implementations (XML-based) – Useful tools (e. g. Grammardoc, Command Line Scripts)
But Isn’t That Just Like … • Cernunnos has some similarities with popular technologies like Ant, Jelly, Groovy, etc. • But there are meaningful differences in the details, some of which are discussed here: http: //code. google. com/p/cernunnos/wiki/Comparison_with_Jelly • The creator of Cernunnos sees the project not as a tool written in Java, but as an innovative way to practice Java • From that perspective, it appears more similar to Servlets or Spring than the items above
Motivation, Goals, & Strategy
Notable Quote “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain. ” - Steve Jobs Taken from a recent New York Times interview about Apple’s new i. Phone http: //www. theserverside. com/blogs/thread. tss? thread_id=45781
Goals of Cernunnos • Cernunnos was created to address software professional effectiveness • Professionals who use Cernunnos should be able to deliver a higher ratio of software value (outputs) to effort (inputs) compared with “industry normal” practices
Goals of Cernunnos (Cont. ) Cenunnos is not about: Cernunnos is about: • Security • Getting more business value from your investment in custom software • Scalability • Usability
Strategy in a Nutshell • Mature disciplines are good at creating highlevel solutions from standardized, low-level components • But in software we reinvent low-level behaviors constantly: JDBC calls, file system I/O, XML parsing, XSL Transformations, etc. • Cernunnos provides a standard form factor for behavior, allowing behaviors (old & new) to be combined in innovative, flexible ways
Short Backstory Your client is moving to People. Soft Your Assignment: 1. An existing work study app must be changed to pull data from a new database 2. The work must be done in Java 3. You must do the work 4. The source database isn’t ready, and won’t be ready before your contract is up
Using Cernunnos
Tasks & Phrases • In Cernunnos, meaningful work is handled by Tasks & Phrases • A Task is a unit of behavior
Tasks & Phrases (Cont. ) > crn find-in-jar. crn Document. Factory
Tasks & Phrases (Cont. ) • Call standard (out-of-the-box) Tasks & Phrases by names from a standard grammar file • Use the
Cernunnos Grammardoc
Installing Cernunnos Running Cernunnos from the command line: 1. Install the following tools – Subversion – Ant 2. Download Cernunnos source > svn checkout http: //cernunnos. googlecode. com/svn/trunk/ 3. Compile Cernunnos > ant build 4. Add the Cernunnos bin/ directory to your path
Embedding Cernunnos Using Cernunnos in other applications: 1. Add the following JARs to the classpath: • cernunnos. jar • commons-jexl-1. 1. jar • dom 4 j. jar • jaxen. jar 2. Use the Script. Runner class Script. Runner runner = new Script. Runner(); runner. run(location)
Invoking Cernunnos • You can specify a Cernunnos script using either a file system path, a URL, or a location in the classpath > crn grammardoc. crn > crn http: //cernunnos-discussion. googlegroups. com/web/find-class-in-jar. crn Document > crn classpath: //org. jasig. portal. container. deploy-portlet-app. crn my. App. war • This is not only true for scripts – you can reference pretty much any resource pretty much anywhere in any of these ways
Cernunnos & u. Portal
New or Improved Features Cernunnos has been used with u. Portal in several ways: • Execute arbitrary SQL from the console • Convert a new u. Portal 2. 5. x to DLM • Improved “deploy. Portlet. App” target • Core data Import/Export (XML-based)
Execute Arbitrary SQL • Cernunnos picks up JDBC connection information from rdbm. properties (viz. where it lives) • Invoke with > crn sql. crn “INSERT INTO up_user…”
Convert to DLM • Automates the process described on the u. Portal wiki: http: //www. ja-sig. org/wiki/display/UPM/DLM+Administration+Guide • Summary: 1. Set User. Layout. Store. Factory. implementation to RDBMDistributed. Layout. Store 2. Set User. Layout. Manager. Factory. core. Implementation to Distributed. Layout. Manager 3. Update the UP_USER_PROFILE table to match theme and style values for DLM
New “deploy. Portlet. App” Target • Current deploy. Portlet. App implementation creates a new web. xml file using some values from the existing one, which causes problems – Hard-coded use of the 2. 3 servlet spec (UP-1241) – //description becomes /web-app/description • New implementation merely adjusts the web. xml that is provided • New implementation also makes it more natural to invoke this behavior within the web application itself classpath: //org/jasig/portal/container/deploy-portlet-app. crn
New “deploy. Portlet. App” Target (Cont. ) Summary of deploy. Portlet. App behavior: 1. Extract the specified portlet WAR file to the appropriate location within Tomcat (deploy. home in Ant) 2. Add
XML Import/Export • XML Import & Export using Cernunnos was presented at the u. Portal Developers’ Meeting at Johns Hopkins University in April • This portion of the session contains updated material from that meeting • Much more detailed information -- and a working prototype -- are available online http: //www. ja-sig. org/wiki/display/UPC/u. P 2+XML+Import+Export+with+Cernunnos
XML Import/Export (Cont. ) • Although every u. Portal release comes with a working data set, every institution needs to customize this data extensively to meet their individual needs • Editing this data where it lives (i. e. data. xml) is confusing, tedious, and risky! • Using u. Portal’s UI to edit the data isn’t reproducible by automated means
XML Import/Export (Cont. ) It would be nice if… • The data set were more approachable (readable and editable) • Entities were described in individual files instead of a single, monolithic document • Entities didn’t reference each other using database IDs, so they could be imported (or shared) in any order
Using the Prototype • A Cernunnos-based import/export tool is available that handles the following data: – Users – Groups – Channels – Group Memberships – Permissions – Layouts • The prototype tool is attached as a ZIP to the wiki page about this technology • To use it, extract the contents into the root of a u. Portal 2. 5 (or later) distribution
Using the Prototype (Cont. ) • Invoke it from the command line using Ant > ant –f import-export. xml export –Ddir={dir} –Dtype={type} [–Dsysid={sysid}] > ant –f import-export. xml import [-Ddir={dir}] [-Dpattern={pattern}] dir = a file system directory type = all | layout | all-layouts | channel | all-channels | all -permissions | all-memberships | group | all-groups sysid = user_name | fname |group_name pattern = a regex expression
Questions? Andrew Wills drew@unicon. net code. google. com/p/cernunnos/
** REMOVED **
Custom Software is Expensive • Developing new software using "industry standard" technologies and practices is very effort intensive • Qualified professionals ("knowledge workers") are expensive • And don’t forget… – Software project failure rates are daunting – So are time-to-market considerations
Whose Problem Is It? • If you're not thinking about these issues every day, you really should. . . your employers are • Offshoring is a popular practice, and growing in use • Many valuable software projects are never undertaken • There is a high threshold of expected business value that a proposed software project must meet
Choosing Project Scope One common approach to planning the scope of a software project and its iterations: 1. Create a list of proposed features 2. Assign each feature a number for Business Value 3. Assign each feature a number for Effort 4. Sort the list by the ratio of Business Value to Effort 5. Plan to implement the features with the best ratio first 6. Stop when the incremental value no longer justifies the effort
Choosing Project Scope (Cont. ) Feature BV/LOE BV A 1. 33 3 4 B 1. 25 4 5 C 1. 20 5 6 D 0. 78 9 7 E 0. 75 8 6 F 0. 71 7 5 G 0. 67 6 4 H 0. 57 14 8 I 0. 54 13 7 J 0. 50 12 6 K 0. 45 11 5 L 0. 45 20 9 M 0. 42 19 8 N 0. 40 10 4 O 0. 39 18 7 P 0. 35 17 6 Q 0. 31 16 5 R 0. 27 15 4 S 0. 23 22 5 T 0. 19 21 4
Choosing Project Scope (Cont. )
It Doesn’t Have to Be This Way • Among human endeavors, software is exceedingly young • Software industry technologies and practices are at an early evolutionary stage • Innovations that unlock tremendous gains in effectiveness are out there to be invented
Choosing Project Scope (Revisited)
Goal of This Session
Buzzword Compliance • Cernunnos leverages forward thinking both from within the software industry and elsewhere – Composite Pattern – Transparent Enclosure/Decorator Pattern – Behavior Injection – Intelligent Defaults – Form Follows Function – Platform Independence
Solution • Storing the data in XML is great because tools like Subversion can manage it smoothly • But the XML format used by data. xml is unapproachable to human beings • It would be better to store this data in a collection of smaller XML documents with domain-specific schemas
Solution (Cont. ) • These documents can be more succinct and manageable by conveying information structurally that data. xml must convey explicitly (e. g parent-child relationships, entity types) • Also these documents can avoid referencing database IDs, allowing entities to be imported and exported ad hoc – even from one portal database to another!
Data in u. Portal • Information in the portal database represents the following classes of entities: – Minor Items (version info. , sequences, etc. ) – Users – Groups – Channels – Group Memberships – Permissions – Layouts • Items that appear lower on this list often depend on items that appear higher (viz. foreign keys)
Status of the Prototype • Work on the prototype started with Layouts (DLM) and proceeded “backwards” • The prototype currently includes both import and export through Groups Users • Which leaves: – Minor Items – Users • It works in u. Portal 2. 5. 3 (AFAIK) • It hasn’t been tried in any other version


