Wednesday, July 3, 2013

Catalog subsystem

What is Catalog subsystem ?

Catalog subsystem is a component of WebSphere Commerce Server that provides online catalog navigation, partitioning, categorization, and associations. It contain all logic and data relevant to an online catalog and associations or relationships among them.
Online catalog consists of the goods and services you offer for sale.
Online catalogs can differ greatly from store to store, depending on the type and amount of merchandise.

For a catalog for purchase we need many things:

1      Prices, Product data, such as descriptions and images of your merchandise.
2.    Categories, as most, but not all catalogs divide merchandise into categories, to facilitate navigation for   customers.
3.       A display method for what you are selling.

The online Catalog can be a catalog groups (or categories) or a catalog entries.

Catalog entries

A catalog entry is a product displayed in the store's online catalog for purchasing from the store.

Catalog entries can be a single item (atomic) or composed of several other catalog entries (composite).

Atomic Catalog entries 

A single orderable item.
An orderable item is called a SKU. Atomic item is a SKU.
A fully resolved package is a atomic

 Composite catalog entries:
 A catalog entry represents unresolved products, packages, or bundles that may need additional information before becoming atomic entities.
An example is resolving a product into an item through SKU resolution, performed by the ResolveSkuCmd task command.
If necessary, you can create new CatalogEntry type objects that do not fit into one of the existing ProductItemPackageBundle, or DynamicKit models. 
  
A catalog entry can be a product, item, package, bundle, or dynamic kit.

Item and product

Flat screen T.V (Product)
        
--  T.V screen size 12 inch(item)
--  T.V screen size 15 inch(item)
--  T.V screen size 20 inch(item)
--  T.V screen size 24 inch(item)
 ….

Item
Product
tangible unit of merchandise that has a specific name, part number, and price.
a group of items that exhibit the same attributes
Item is having specific attribute value.
A 15 inch hammer with a wooden handle (part number 15) is an item. It is having specific attribute value.
handle type : Wooden
Size: 15 inch
Items related to a particular product exhibit the same set of attributes.
E.g:
Hammer is a product , it’s attributes are "handle type" and "size".
All the items are coming under one product.
each item should be associated to one product in WebSphere Commerce Accelerator
User can purchase an item.
An item is orderable(SKU)
A product cannot be purchased

Packages and bundles

Packages and bundles are groupings of catalog entries used for promotional purposes.

Package
Bundle
a package is an atomic collection of catalog entries
A bundle is a collection of catalog entries that allow customers to buy multiple items with one click
Packages can be unresolved or fully resolved.

A bundle can be a grouping of items, or a combination of products, items, and fully resolved packages.
A fully resolved package is comparable to an item, with its own price, and can be added to a shopping cart. unresolved packages must first be transformed into fully resolved packages before adding to shopping cart.
The Package will be considered as a single item , after adding to shopping cart. We will not be able to decompose, modify or remove individual items from that package.
When adding to shopping cart , the each items of bundles will be decomposed into separate orderable SKUs that are added individually to the shopping cart.
We can modify or remove each item from cart according to our choice.
a computer package:  contain a specific central processing unit, monitor, and hard drive that cannot be sold separately.

Computer bundle:
a computer bundle might be composed of a central processing unit, a monitor, a hard drive, and a CD-ROM drive.
Once the bundle is added to shopping cart, user can remove or modify items( processing unit, a monitor, a hard drive, and a CD-ROM drive).





Example:
A Computer consist of  CPU, monitor and hard drive etc.
Computer product can be displayed as package or bundle according to their business.(according to the sales how they want to display online).

If business is selling it has package , we will get it as a single item with CPU, monitor and hard drive.

If it is selling as bundle , after adding to shopping cart customer can  remove or modify item  , i.e we customer can individually buy a monitor or cpu or hard drive.

Dynamic Kit and Static kit

Dynamic Kit
Static kit
dynamic kit is a type of catalog entry which can be dynamically configured by the customer. This configuration (or grouping) of products is based on the customer's requirements and is sold as a single unit.
static kit is a group of products that are ordered as a unit. The information about the products contained in a static kit is predefined and controlled within WebSphere Commerce.
Adding a dynamic kit to an order is similar to adding a package. Like a package, the individual components of a dynamic kit cannot be modified and the entire configuration must be fulfilled as a whole. However, you may change the dynamic kit components by reconfiguring it using an external product configurator.

The individual components within the order cannot be modified and must be fulfilled together. A static kit will backorder if any of its components are unavailable.



Friday, June 28, 2013

JRE and Multiple JVM

What is JRE (Java Run time environment) ?

·  JRE is a  Java Runtime Environment. It is a software that provide an environment to run the Java program.
·  To run  the java program we need to install JRE on our machine.
·  JRE consists of  JVM , core classes(class libraries), and supporting files.

i.e. JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc)+runtime libraries.

JRE  does not contain any development tools such as compiler, debugger, etc.

· Compiler will convert the java code in to byte code and  JVM runs that complied program, and it uses the class libraries, and other supporting files provided in JRE.

Java application launcher opens a JRE, loads the class, and invokes its main method.

· The JRE is available for multiple computer platforms, including Mac, Windows, and Unix.

· If the JRE is not installed on a computer, Java programs may not be recognized by the operating system and will not run.

   JRE software is available as both a standalone environment and a Web browser plug-in, which allows Java applets to be run within a Web browser.

JRE for different version of Java

Adding  different feature, fixing bug etc to each version of java and will release new versions
We can see below,JRE download has not grown significantly in recent memory.

                                 Java 1.4.2         Java 5 (1.5)                    Java 6 (1.6)
JRE                           15.10 MB          16.13 MB                       15.42 MB  
SDK                          49.33 MB          51.82 MB                       72.90 MB

Multiple JVM 

Each instance of the Java execution will create separate JVM. If you start any two Java-based processes on your computer, they will each be running in their own JVM. You can run more than one java process, whether of the same JVM version or different ones.

Two JVMs cannot run and share memory. Each has its own heap, in different areas of RAM.
You would need to use sockets, multiple agents, RMI or similar to access code on different JVMs. 

Tuesday, April 9, 2013

Advantages and Disadvantages of Inheritance in Java


What is the use of Inheritance in Java? Examples where you used the concept of Inheritance in your project?


Inheritance: Code reuse using subclass and super class relationship. Subclass inherits all the members (fields, methods, and nested classes) from its superclass.
Inheritance is unidirectional, it is expressed using  is a “ relationship. The car is a Vehicle, but all the vehicles are not a car.

Example:
 Benefits:
             
Minimize the amount of duplicate code in an application

If  duplicate code (variable and methods) exists in two related classes, we can refactored that hierarchy by moving that common code up to the common superclass.

Better organization of code

Moving of common code to superclass results in better organization of code.

Code more flexible change

Inheritance can also make application code more flexible to change because classes that inherit from a common superclass can be used interchangeably. If the return type of a method is superclass.

Where to use inheritance:
  
Before using inheritance first compare the relationship for the two classes. Use inheritance only if there is a parent child relationship is there.
A way to test the relationship is to ask a "is-a" question.

Real time example:

Consider the above example. Here if you ask ‘is a’ question between house and building. House “is a” building , but house is not a bathroom. So here we have a parent -> child relationship between building and house.

Disadvantage:

The inheritance relationship is a, tightly coupled relationship , there will be tight bonding between parent and child. If we change code of parent class it will get affects to the all the child classes which is inheriting the parent code.

Examples from projects:

If you took an example from banking. All the account will have balance amount enquire,withdraw and deposit amount.
So here we can create a parent class Account with
public class Account {

   private double balance;

   public Account(double startingBalance)
   {

getBalance () {…}
debitCash(double amount) {}           
creditCash(double amount){}
}

public class OverdraftAccount extends Account {

   public OverdraftAccount(double balance)
   {
     super(balance);
   }
 }

/* Note:  Constructors of super class are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass using ‘super’ keyword.(As the first line of the subclass constructor) */

this.overdraftLimit = limit;
     this.overdraftFee = overdraftFee;
                       
   public double getAvailableFunds()
   {
     return super.getBalance() + overdraftLimit;
   }
 }