340 likes | 478 Views
Learning to Drive with a Channel Archive. Mark Boyd Software Engineer/Architect mboyd@sct.com. What We Will Cover. What is a CAR and how is it installed? What is the Development Impact? How do you build them? What new models are coming? Questions?. u. What is a CAR?.
E N D
Learning to Drive with a Channel Archive Mark Boyd Software Engineer/Architect mboyd@sct.com
What We Will Cover What is a CAR and how is it installed? What is the Development Impact? How do you build them? What new models are coming? Questions? u
What is a CAR? • CAR = Channel Archive • Jar file format • Extension of “.car”. Is case sensitive. • Contains all channel artifacts used by the channel. • Contained files should be in package relative sub-directories. • Class files • Images • Stylesheets • Stylesheet Lists • XML files • Properties files • Other resources
A Look Inside jar tf carlot.car <META-INF/…> <Directories….> com/sct/pipeline/uportal/channels/carlot/car.jpg com/sct/pipeline/uportal/channels/carlot/Channel.java com/sct/pipeline/uportal/channels/carlot/channel.jpg com/sct/pipeline/uportal/channels/carlot/channel.ssl com/sct/pipeline/uportal/channels/carlot/stylesheets/channel.xsl com/sct/pipeline/uportal/channels/carlot/Channel.class
Non-CAR Channel Installation uPortal Root Directory Images WEB-INF Stylesheets and Stylesheet lists classes media Classes Configuration files stylesheets Note: package relative sub-directories not shown
Non-CAR Channel Installation uPortal Root Directory Images WEB-INF Stylesheets and Stylesheet lists classes media Classes Configuration files stylesheets Note: package relative sub-directories not shown
Non-CAR Channel Installation uPortal Root Directory Images WEB-INF Stylesheets and Stylesheet lists classes media Classes Configuration files stylesheets Note: package relative sub-directories not shown
Non-CAR Channel Installation uPortal Root Directory Images WEB-INF Stylesheets and Stylesheet lists classes media Classes Configuration files stylesheets Note: package relative sub-directories not shown
Channel Installation with CARs(non-warfile deployment) uPortal Root Directory Images WEB-INF Stylesheets and Stylesheet lists classes cars media Classes MyChannel.car Configuration files stylesheets
Channel Installation with CARs(deployed as warfile or custom car location required) protal.properties org.jasig.portal.car.CarResources.directory=SomeDirPath/cars Images Stylesheets and Stylesheet lists Classes SomeDirPath MyChannel.car cars Configuration files
Channel Installation with CARs • CARs can be located in any sub-directory of the “cars” directory. • 2) The name of a car has no impact on its internal classes and artifacts nor on the publishing or subscribing processes.
What We Will Cover What is a CAR and how is it installed? What is the Development Impact? How do you build them? What new models are coming? Questions? u
Non-CAR Images Approach uPortal Root Directory Tight Coupling Installation Dependant Stylesheet WEB-INF classes media <xsl:variable name="mediaPath">media/org/jasig/portal/channels/Cbookmarks</xsl:variable> …/...gif … stylesheets <img src="{$mediaPath}/folder_delete.gif“…
CAR Images Approach(New functions) ChannelRuntimeData.java: getBaseMediaURL( Object aChannelObject ) getBaseMediaURL( Class aChannelClass ) getBaseMediaURL( String resourcePath ) Channel object or class loaded from CAR Path of resource internal to CAR Returns: • “media/” if not deployed as a CAR • Base URL for extracting resource from CAR. Resource path internal to jar should be appended. Note: only supports gif, jpeg, jpg, jpe in 2.1.x.
CAR Images Approach(Channel Java Source) if ( mediaBase == null ) { mediaBase = runtimeData.getBaseMediaURL( this ); String cls = getClass().getName(); String pkg = cls.substring( 0, cls.lastIndexOf( '.' ) ); mediaBase = mediaBase + pkg.replace( '.', '/' ) + '/'; } // ie: mediaBase = base + com/sct/pipeline/uportal/channels/carlot/ … XSLT xslt = new XSLT (this); xslt.setStylesheetParameter( "mediaPath", mediaBase );
Stylesheet <xsl:stylesheet version="1.0“ …> <xsl:param name="mediaPath"></xsl:param> … <img src="{$mediaPath}/car.jpg“… CAR Images Approach(Channel Stylesheet)
Media Base URL = “tag.idempotent.worker.carRsrc.target.n43.uP?carRsrc=“ Car Images Approach(Carlot Channel)
Java Source Code Stylesheet <xsl:stylesheet version="1.0“ …> <xsl:param name="mediaPath"></xsl:param> … <img src="{$mediaPath}/car.jpg“… CAR Images Approach Lighter Coupling Internal To CAR Installation Independant
Stylesheet List Aspects Carlot’s channel.ssl stylesheet list file. <?xml version="1.0"?> <?xml-stylesheet title="CarListStyleSheet" href="stylesheets/channel.xsl“ …> <?xml-stylesheet title="CarListStyleSheet" href="com/sct/pipeline/uportal/channels/carlot/stylesheets/channel.xsl" …> Note: Use fully qualified jar file resource paths or be certain that the path used is relative to calling document.
Stylesheet Aspects Include, Import, and document follow similar guideline. <xsl:variable name="palette" select="document('v2colors.xml')/*/color"/> <xsl:import href="bookmark_tree_html.xsl" /> <xsl:include href=“com/sct/uportal/channels/accnt/edits.xsl" />
What We Will Cover What is a CAR and how is it installed? What is the Development Impact? How do you build them? What new models are coming? Questions? u
How Do You Build Them? Short Answer: jar cf fileName.car… Long Answer: Dependant on internal development policy.
JA-SIG’s portal-channels • Uses top level directory for each channel. • Includes appropriate elements in directory structures mimicking uPortal deployment directory structures. • Uses package relative directory structures beneath mimicked deployment directories. • Provides build and deployment tool with channel.
Intermediate org jasig portal channels bookmarks *.java, *.ssl, *.gif, *.xsl, etc. Portal-channels CAR Building ANT portal-channels Bookmarks build.xml build.properties bookmarks.car properties source webpages media stylesheets Package relative sub-directories UBC_Webmail
SCT’s Development Policy 1) Use package-relative development directory structure. 2) Use directory naming scheme to differentiate channel base directories. 3) Provide build/deployment tool separate from channels.
SCT’s Directory Structure channels project com Institution sct Division pipeline uportal Build tool used portion channels carlot banner Channel Base Directories email myaccount edu
SCT’s Ant Based CDK Tool ant list [listFiles] --- Channels in development: [listFiles] com/campuspipeline/uportal/channels/cpAttributes [listFiles] com/sct/pipeline/uportal/channels/carlot [listFiles] edu/wasatch/college/uportal/channels/example1 [listFiles] com/sct/uportal/channels/banner Also shows channels deployed as CARs, channels with web-visible or class resources (traditional deployment), and configuration information
SCT’s Directory Structure ANT channels project com Intermediate sct com pipeline sct uportal pipeline channels carlot.car uportal carlot channels banner carlot email *.java, *.ssl, myaccount *.gif, *.xsl, etc. edu
SCT’s Ant Based CDK Tool ant car car: [selectFile] Select the channel directory to be archived: [selectFile] (0 com/campuspipeline/uportal/channels/cpAttributes, [selectFile] 1 com/sct/pipeline/uportal/channels/carlot, [selectFile] 2 edu/wasatch/college/uportal/channels/example1, [selectFile] 3 com/sct/uportal/channels/banner) 1 [mkdir] Created dir: /cdk/tmp/com/sct/pipeline/uportal/channels/carlot [javac] Compiling 1 source file to /opt/cp/sdk/ui-sdk/cdk/build [jar] Building jar: /cdk/tmp/carlot.car [move] Moving 1 files to /opt/pipeline/webapps/luminis/WEB-INF/cars [delete] Deleting directory /cdk/tmp
Laws to Follow • Always use globally unique, package relative directories as specified in Java Language Specification, section 7.7. • Com.sct…., org.jasig…., edu…. • Develop an internal policy on channel development practices and provide tools to make life easier for developers thereby encouraging adherence to the policy.
What We Will Cover What is a CAR and how is it installed? What is the Development Impact? How do you build them? What new models are coming? Questions? u
New Models (Features) • * Documentation. • * Services & Channel Types deployable from CAR. • * Support of more browser accessible file types. • Automatic Recognition of new* or updated CARs. • Replacement of CarResourceWorker? • Semi-automatic & Automatic publication. • Third party library support. • * Available in 2.2.
Questions? Mark Boyd mboyd@sct.com * See next slide for car-lot instructions.
Car-Lot Demo If you wish to deploy the Car-Lot demo download from http://luminis.sales.teamp.com/cars/carlot.car and drop it into the cars directory as outlined in this presentation. Once it is there bounce the web-server and then publish as a custom java channel, class name of com.sct.pipeline.uportal.channels.carlot.Channel with no channel controls and suitable values for all other parameters.