Crafter Commerce

compared with
Current by Michiel Verkaik
on May 18, 2012 10:36.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (7)

View Page History
* Authorization

h1. Entity Relationships
h1. Implementation

Crafter Commerce is implemented as a Server and a Client component, which communicate with each other over HTTP through JSON or XML messages. The Server component is build as a Java web application with Spring, Mongo, Hibernate Validator, SolrJ as dependencies. The Client component is build as a Java library that can be embedded in any Java (web) application. It uses Spring REST support to interact with the Server over HTTP and perform marshalling and unmarshalling.

!crafter-commerce-impl.png|border=1!

h1. Entity Relationships

!cc-entity-relationships.png|border=1!

h1. Mongo Schema Design

*collections:*

# accounts
# products
## promotions
## product-prices
# orders
## payments
## order-line-items
## order-delivery
# payment-gateways
# shipping-methods
# locations
# addresses
# attributes

*atomic operations:*

In Mongo, atomic operations can be performed *only* on a single BSON document.

Needed when:

# Adding a product to a shopping cart (if we manage inventory, so updating a product's available quantity should be atomic).
# ...

*indexes:*

Identify the fields to index / query on

# id (all collections)
# key-name(s) (coll-name)
# key-name(s) (coll-name)

*sharding:*

Not applicable at this time


h1. Promotions

* Analytics integration?
* What user information can we store without having to be PCI compliant?

h1. Download and build it

h2. Prerequisites

The following is a list of prerequisites that Crafter Commerce depends on in order to build and run:

* Java 1.5
* Maven 2
* An SVN client
* Apache Solr 3.6.0 (not needed for build)
* Mongo DB 2
* A decent servlet container such as Jetty, Tomcat or JBoss

Technically Mongo and Solr are not required for building, but Mongo is required for testing as an extension to the build. We're using the Maven Failsafe plugin to run integration tests, for which at least Mongo is assumed to be running at the time of building. For integration tests specifically, Mongo is expected to be run on default port 27017 with no authentication required.

h2. Prerequisites: Mongo and Solr

h3. Mongo

Mongo can be downloaded here: [http://www.mongodb.org/downloads]. At the time of writing, the latest version was 2.0.5. There are versions for OS X, Linux, Windows and Solaris.

Once you have Mongo installed, start it as follows:

{code}
mongod --dbpath=/path/to/mongo/data/db
{code}

While it's starting, it'll log to the console the default port on which it will be listening:

{code}
[initandlisten] waiting for connections on port 27017
{code}

h3. Solr

Apache Solr can be downloaded here: [http://lucene.apache.org/solr/downloads.html]. The latest version at this moment is 3.6, which is the exact dependency for Crafter Commerce, although older versions may work as well.

Download the binary distribution from one of the Apache mirrors, for example: {{ apache-solr-3.6.0.tgz}}. Then, unpack it and copy the reference schema from the Crafter Commerce source into the Solr example directory:

{code}
cd /your/path/to/apache-solr-3.5.0/example/conf
mv schema.xml to schema.xml.ORIG
cp /your/path/to/crafter-commerce/crafter-commerce-itest/solr/conf/schema.xml .
{code}

Lastly, startup Solr with embedded Jetty as follows:

{code}
cd /your/path/to/apache-solr-3.5.0/example
java -jar start.jar
{code}

Jetty will report to the console on which port it is listening for HTTP requests:

{code}
INFO::Started SocketConnector@0.0.0.0:8983
{code}

To double-check that Solr is indeed running on that port, fire up a browser, and try the following URL:

{{[http://localhost:8983/solr/]}}

h2. Download the Crafter Commerce source code

Use your SVN client to checkout a copy of the source code. From the command line it would look like this:

{code}
svn co [https://svn.rivetlogic.com/repos/crafter-community/commerce/trunk crafter-commerce]
{code}

Make sure that Solr isn't started on that port while running the integration tests.

h2. Building and testing Crafter Commerce