-
Notifications
You must be signed in to change notification settings - Fork 0
HelloWorld
To start seeing "something" happen, lets create the connection from the CoreMedia Content Cloud instance. This is a configuration element for the CoreMedia Studio and the Content Application Engine, but we will see the results in the studio log first.
The commerce connection is a core element of the integration and holds a set of services to implement for the given commerce backend - some of them being optional.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:/framework/spring/livecontext-mock-services.xml"/>
<bean name="commerce:mock1" class="com.coremedia.blueprint.base.livecontext.ecommerce.common.BaseCommerceConnection" scope="prototype">
<property name="storeContextProvider" ref="mockStoreContextProvider"/>
<property name="idProvider" ref="mockCommerceIdProvider"/>
<property name="commerceBeanFactory" ref="mockCommerceBeanFactory"/>
<property name="vendorUrl" value="${livecontext.mock.vendorUrl}"/>
<property name="vendorVersion" value="${livecontext.mock.vendorVersion}"/>
<property name="vendorName" value="${livecontext.mock.vendorName}"/>
</bean>
</beans>
There may and will be some more services to implement, but we will now stick to the starting points
-
Store Context
-
Connection
-
Relation to Content
The Content Cloud StoreContext implementaton holds the necessary information for the corrent context in the content and how to access the commerce system in that context.
So the context will contain information about the store's URLs, ID, and API entry-points.
It highly depends on the Commerce system you use, which information is needed.
There will be no custom implementation of the StoreContext, but you will be able
to use the generic StoreContextImpl
, there will however be a custom implementation
of the StoreContextProvider to fill the generic StoreContextImpl
with the
needed data.
For the Magento part we chose to place the following pieces of information in the StoreContext implementation.
- store id
- store name
- website id
- default currency
Commerce IDs use a similar scheme to CoreMedia IDs, of course not using the
coremedia:
prefix. So the generic implementation of a CommerceIdProvider
will be sufficient and you will use a prefix of your choice.
The beans for the services available through the connection need to be prepare in the spring framework configuration.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:customize="http://www.coremedia.com/2007/coremedia-spring-beans-customization"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.coremedia.com/2007/coremedia-spring-beans-customization http://www.coremedia.com/2007/coremedia-spring-beans-customization.xsd">
<context:annotation-config/>
<!-- Map the properties here: -->
<context:component-scan base-package="com.coremedia.livecontext.ecommerce.mock.configuration" />
<import resource="livecontext-mock-cache.xml"/>
<bean id="mockCommerceIdProvider" class="com.coremedia.blueprint.base.livecontext.ecommerce.common.BaseCommerceIdProvider">
<property name="vendor" value="${livecontext.mock.vendorPrefix}"/>
</bean>
<bean id="mockStoreContextProvider" class="com.coremedia.livecontext.ecommerce.mock.common.MockStoreContextProvider">
<property name="settingsService" ref="settingsService"/>
<property name="sitesService" ref="sitesService"/>
<property name="cache" ref="cache"/>
<!-- API access relevant other parts... -->
</bean>
<bean id="mockUserContextProvider" class="com.coremedia.blueprint.base.ecommerce.user.CmsUserContextProvider"/>
</beans>
If you now try to start your application, you will perhaps come accross the deployment part of CoreMedia Content Cloud as prepared for development system other than localhost.
So you now will need to add the configuration item used - e.g. - for the
StoreContextProvider
in the application properties for the CoreMedia Studio
and the (Preview) CAE.
To test your basic setup the connection configuration needs to be hooked into a site in the CoreMedia content repository.
The Home Page of the Site needs a Content Cloud settings document (like e.g. given in the IBM WebSphere Commerce example or test test content in this repository).
In this settings document the setting livecontext.connectionId
must be
set to the id used in the Spring Framework configuration (s.a.).
When you decide to copy content from another Commerce Site in the CoreMedia content repository be sure to
- Rename the Site
- Rename the Home Page
- Change LiveContext connectionId
- Change the Site ID in the Site document
- Change the Name the Site document
- Change the URL segment in the Home Page document
Also be sure to remove any copied augmented categories (CMExcternalChannel
)
which might be linked to your content and point to another commerce backend.
With the CoreMedia Studio default settings you won't see these objects. Go to the preferences of your user, move to the product catalog tab and switch on viewing of these objects.
Having prepared all the parts in this chapter should result in a Content Cloud
instance trying to connect to the mock Commerce system stub and produce
output in the studio.log
to make sure, that the connction is starting to work.
If this is the case, we move ahead to the first really visible use case in the CoreMedia Studio.