HY400 – Installing the Accelerator
- Build Framework
- Extension Concept
- Basic Configuration
- Hybris Server
- hAC, Initialization, and Update
- Recipes
- Spring in SAP Hybris Commerce
- Exercise How-to
1. Build Framework
- SAP Hybris Commerce Platform has a build framework based on Apache Ant
- Ant handles compilation and a number of automation tasks.
- Class executables compiled by the Eclipse IDE are not used by SAP Hybris Commerce.
- There is a build file in every extension, but we generally just use the one in the platform extension, which builds the entire suite.
- It builds every extension listed or referenced by localextensions.xml
Building with ant
- When you call ant, the build framework:
- generates and compiles Model classes(covered in the next module)
- according to the definitions in the *-items.xml files
- In order of extensions dependency(hierarchy)
- collects localization property files(locales_XY.properties).
- collects layout configuration files(hmc.xml)
- updates configuration of the Commerce Server.
- generates five new folders(only in the first run!)
- generates and compiles Model classes(covered in the next module)
Build Targets
2. Extension Concept
Where to Begin with SAP Hybris Commerce?
- Starting any project involves creating one or more extensions
- Each extension will contribute a part of the greater whole, including modifying or adding to the data model, business logic, backoffice tools configuration, etc..
- Your(project) code is separated from Hybris (framework) code, making your code easier to reuse and migrate to future versions.
- SAP Hybris Commerce bundles a proprietary code generator.
- In general, a project will include
- A front end extension, will all jsp pages, tag and css files, controllers, etc..
- A testing extension, containing the test cases and data.
- One or more infrastructure or utility extension(such as services)
Structure of the Core Extension
Structure of the Storefront Extension
Creating a New, non-Accelerator Extension
- Non-Accelerator extensions use a template, such as
- To create single extension, invoke [ ant extgen ]
- Reference any required extensions in extensioninfo.xml
- Add your extension to config/localextension.xml
- Invoke ant clean all
Creating an Accelerator-based Extension
- An accelerator-based projects’ extension set is defined by the Accelerator template you are using as the basis for your site.
- Your projects extensions are created by ant modulegen
- For example, if you base your bookstore shop on the B2C Accelerator, ant will generate the following extensions for you
Template and Product Extensions
3. Basic Configuration
Configuration changes
- Modify the local.properties file and restart the application server
- No need to call ant in the console
- Configuration files are read during startup
- All configuration files are inside the config directory
- However if you change any Tomcat configuration setting(such as tomcat.http.port), you need to call ant server
- If in doubt, call ant all
- It’s possible to change the properties on the runtime in the hAC
- however, after a server restart, these changes are lost.
localextensions.xml
- List of extensions used by build framework
- Extensions can be listed by name instead of location path
- Dependencies are resolved automatically using the path parameter. Build will find dependent extensions which are not explicitly listed.
- A complete localextensions.xml can be generated using the extensionsxml ant target
- During install process, overwrite hybris/config/localextensions.xml with content of desired sample file, then run ant all.
Load required extensions
4. Hybris Server
Bundled with SAP Hybris Commerce
- SAP Hybris Commerce comes with a bundled Hybris server and a configuration template for the tcServer
What is the Hybris Server?
- Optimized and pre-configured server based on Apache Tomcat
- Production-ready quality and best suited to run all applications of the SAP Hybris Commerce Suite
- Configuration templates available for development and production deployment.
- Independent of the Operating system
- Easy Installation
- Can be run as a system service under Microsoft Windows or Linux
- Contains a wrapper that automatically restarts the Apache Tomcat Java Virtual Machine if the Apache Tomcat hangs or stops.
5. hAC, Initialization, and Update
hAC – Hybris Administration Console
- Administration
- Monitoring
- Configuraiton
- localhost:9001/(by default)
- localhost:9001/hac
Initialize or Update the System
System Initialization:
- Entire type system is created from scratch
- All database tables are dropped
- Data model is created from scratch as defined in the items.xml files
- New tables with initial dataset are created
- Existing data model definitions will be lost
System Update:
- Existing tables are updated to match changes in the domain model.
- No loss of data!
- Two major aspects
- Adding newly defined types to the type system definition in the database
- Modifying type system definition in the database to match the definition in the domain model.
Initialization and Update
- hac->Platform->Initialize | Update
2. Ant view in eclipse + tenant
3. Command line
Configurable update from console
- Optionally, hac is able to provide the configuration for update system from console:
- hac->platform->update
- Choose your update settings
- Click on Dump configuration
- Copy configuration settings from the screen
- Put it in a .json file
- To execute the update run the command: ant updatesystem -Dtenant=<my tenant> -DconfigFile=<path>/<filename>.json
Initializing and Updating SAP Hybris Commerce:
https://help.hybris.com/6.0.0/hcd/8bf4f76d86691014a29cf03f0616bdb7.html
6. Recipes
Hybris Installer
- Gradle-based project written in Groovy
- Simplifies installing the SAP Hybris Commerce Suite
- Automated script that takes care of
- Directory creation
- Moving files
- Updating configuration and properties files
- System initialization
Recipes
- Recipes are used for installing a flavor of the SAP Hybris Commerce Suite, that is the SAP Hybris Commerce Suite with the desired application(eg. B2C Accelerator, Telco Accelerator, or Datahub)
- A recipe contains the information required to install the flavor, such as
- Three mandatory tasks(setup, initialize, start)
- Calls to required plugins(eg. installer-platform-plugin.jar)
- Local properties
- Extensions
- Database configuration
- Web archives
- Server information(eg. Apache Tomcat)
Recipes creation
- In order to create a recipe, you need to:
- Create a folder for the recipe under /hybris/installer/recipes/
- The name of your recipe must be the name of your folder
- Using Groovy, create the build.gradle file containing your installer recipe
- Create a README.txt describing what your recipe does and proving the commands required to setup, initialize and start your system.
HY400 – Overview
The SAP Hybris Commerce Platform
- Composed of standard set of extensions providing base functionality
- Build your site atop standard extensions, maintaining a clear code and configuration separation.
- An extension
- Is the packaging mechanism for a SAP Hybris Commerce feature
- Contain business logic, type definitions, a web application, etc..
- Database and application server abstraction layer
- ORM framework
- Build framework
- Cockpit framework
- Data modelling, validation, and imports
- Web services
- Configuration files
- SAP Hybris Commerce Service
Building a Commerce Site on SAP Hybris
SAP Hybris Commerce is an omni-channel platform
- It interacts with customers over the web, mobile devices, email, kiosks, or via support reps
- It is connected to prodcut and website content catalogs, inventory and fulfillment systems, ERPs, etc..
Building a Commerce Site with Commerce Accelerator
- Some SAP Hybris customers build their commerce sites from the ground up
- where the ground is the standard SAP Hybris platform
- However, most leverage one of the SAP Hybris Commerce Accelerators
- Functional sites that serve as starting points for your development.
- Allow you to jump-start implementation, shortening your development time and simplifying maintenance
- Each accelerator consists of extension templates
- The templates are copied and renamed using the moduLegen ant target.
- You will directly modify the java and configuration files in these extensions to build your site.
Accelerators
Rude Magic –
With Capo on First Fret other wise F# = F G# = G A#m = Am C# = C Start of the Pre - Chorus F# G# A#m G# Saturday morning jumped out of bed and put on my best suit F# A#m G# F# Got in my car and raced like a jet, all the way to you F# G# C# Knocked on your door with heart in my hand G# F# To ask you a question G# A#m Cause I know that you're an old fashioned man yeah yeah F# G# A#m Can I have your daughter for the rest of my life? say yes, say yes G# Cause I need to know F# G# You say I'll never get your blessings till the day I die A#m G# F# Tough luck my friend but the answer is no! F# C# Why you gotta be so rude? F# G# F# Don't you know I'm human too F# C# why you gotta be so rude A#m I'm gonna marry her anyway F# marry that girl C# marry her anyway F# marry that girl A#m yeah no matter what you say F# marry that girl C# and we'll be a family F# C# Why you gotta be so rude