Module Installation
The enterprise module requires configuration and database changes. It also requires certain changes to be made to your front-end website to enable the sandbox ribbon functionality.
Configuration Changes
Loading required files
Add the dependency management section to your parent
pom.xml
:<dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-jobs-events</artifactId> <version>1.0.0-SNAPSHOT</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-enterprise</artifactId> <version>1.0.0-SNAPSHOT</version> <type>jar</type> <scope>compile</scope> </dependency>
Add this dependency into your
core/pom.xml
:<dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-enterprise</artifactId> </dependency> <dependency> <groupId>com.broadleafcommerce</groupId> <artifactId>broadleaf-jobs-events</artifactId> </dependency>
Scheduled Jobs and Events Persistence Unit
The ScheduledJobsAndEvents
Module uses a seperate persitence unit to handle transactions.
In admin and site webapp/WEB-INF/application-datasource xml. add
<jee:jndi-lookup id="webEventDS" jndi-name="jdbc/event”/>
You will need to add the JDBC connection.In site and admin webapp /META_INF/context.xml. add
<Resource name="jdbc/event" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" testWhileIdle="true" testOnBorrow="true" testOnReturn="false" validationQuery="SELECT 1" timeBetweenEvictionRunsMillis="30000" maxActive="15" maxIdle="10" minIdle="5" removeAbandonedTimeout="60" removeAbandoned="false" logAbandoned="true" minEvictableIdleTimeMillis="30000" jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.inte rceptor.StatementFinalizer" username="${database.user}" password="${database.password}" driverClassName="${database.driver}" url="${database.url}”/>
Then add the following to
core/resources/applicationContext.xml
<entry key="jdbc/event" value-ref="webEventDS"/>
Fianlly, add the
blEventPU
incore/resources/META_INF/persistence-core.xml
by using the code below<persistence-unit name="blEventPU" transaction-type="RESOURCE_LOCAL"> <non-jta-data-source>jdbc/event</non-jta-data-source> <exclude-unlisted-classes/> </persistence-unit>
Sandbox Ribbon
To get the sandbox ribbon to show up on your site when previewing changes from the admin interface, you will need to modify your site to include some additional files.
You will want to make sure that the following stylesheets are loaded in the Heat Clinic demo site's
head.html
when in sandbox mode:<th:block th:if="${#brc.sandboxMode}"> <blc:bundle name="sandbox.css" mapping-prefix="/css/" files="jquery-ui-1.10.2.custom.css, font-awesome.min.css, sandbox-client.css" /> </th:block>
You will want to make sure the following scripts are loaded in the Heat Clinic demo site's
footer.html
when in sandbox mode:<th:block th:if="${#brc.sandboxMode}"> <a id="adminDeepLink" th:unless="${#strings.isEmpty(adminDeepLink?.fullUrl)}" th:href="@{${adminDeepLink.fullUrl}}" /> <blc:bundle name="sandbox.js" mapping-prefix="/js/" files="sandbox-client.js, lib/plugins/jquery-ui-1.10.2.custom.js, lib/plugins/jquery-ui-timepicker-addon.js" /> </th:block>
Additional Items to Verify
In
applicationContext-admin-filter.xml
, verify that the pre-security filter chain does not include theblAdminRequestFilter
, and that instead theblAdminRequestFilter
is the first item in the post-security filter chain. Additionally, the post-security filter chain should not make a reference to theblAdminSandBoxFilter
.In
site/applicationContext.xml
, make sure that the following line does not appear:<task:annotation-driven />
In
schema.xml
, make sure that the following two fields are defined:<field name="sandboxId" type="long" indexed="true" stored="true" /> <field name="sandboxPriority" type="long" indexed="true" stored="true" />
Ensure load time weaving is enabled for your application server
This module uses load time weaving. If you haven't already done so, you will need to modify the provided site and admin build.xml commands (e.g. jetty-demo) to include the following line:<jvmarg value="-javaagent:${spring.instrument.path}" />
In
site/applicationContext-security.xml
, make sure you add the following line to the<sec:http></>
configuration:<sec:http auto-config="false" authentication-manager-ref="blAuthenticationManager" > ... <sec:intercept-url pattern="/crossappauth" requires-channel="https"/> ... </sec:http>
Data Changes
Either include the following three files in your
blPU.hibernate.hbm2ddl.import_files
environment property definition, or manually run the SQL statements found inside:/config/bc/sql/load_enterprise_admin_security.sql
Note: These should load above all of the items that start with
/sql/
and after the items that start with/config/bc/sql
Schema Changes
If you are allowing hibernate to create and modify your tables, this will be done automatically when you restart with the new configuration settings.
Otherwise, you will need to generate the SQL to customize your Broadleaf implementation. See the Broadleaf Schema Upgrade Documentation for details.