Websphere Process Server training docs


Human tasks


 Selectors

Business rules

 BSM
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wpi_v6/wpswid/6.0.2/MediationLabs/WPIv602_ESB_UnModeledFaultsLab.pdf

requierment for enhanced for loop in java (J2SE5.0)



Enhanced for loops allow convenient iteration over collections, without the need for an explicitly defined iterator. This reduces the need for boilerplate iteration code and the corresponding opportunities for errors.
as per JSR 121

Running Java without Main method

StaticBlockClass.java
~~~~~~~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public  class StaticBlockClass {

      static{
            System.out.println("i dont have main method");
      }
     
}

TestStaticClient.java
~~~~~~~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public class TestStaticClient {

      public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
            Class.forName("com.anil.builder.design.pattern.StaticBlockClass");
      }
}

Builder DesignPattern

Builder Design pattern is used when there is a requirement for creating complex objects.
if it is a simple object you can make use of factory design pattern.



Car.java
~~~~~~~~~
package com.anil.builder.design.
pattern;

public class Car {

        private String engine;
        private String tyre;
        private String paint;

        public String getEngine() {
                return engine;
        }

        public void setEngine(String engine) {
                this.engine = engine;
        }

        public String getTyre() {
                return tyre;
        }

        public void setTyre(String tyre) {
                this.tyre = tyre;
        }

        public String getPaint() {
                return paint;
        }

        public void setPaint(String paint) {
                this.paint = paint;
        }

}
----------------------------------------------------

CarBuilder.java
~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public interface CarBuilder {
        public String makeEngine();
        public String makeTyre();
        public String makePaint();
        public void makeCar();
        public Car getCar();
}
----------------------------------------------------------

USCarBuilder.java
~~~~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public class USCarBuilder implements CarBuilder {

        private Car car;

        @Override
        public String makeEngine() {
                // TODO Auto-generated method stub
                return "US Engine added ";
        }

        @Override
        public String makeTyre() {
                return "APPOLO tyres added";
        }

        @Override
        public String makePaint() {
                return "Red colour added";
        }

        @Override
        public void makeCar() {
                car=new Car();
                car.setEngine(makeEngine());
                car.setTyre(makeTyre());
                car.setPaint(makePaint());
        }

        @Override
        public Car getCar() {
                // TODO Auto-generated method stub
                return car;
        }

}
--------------------------------------------------------

GermanCarBuilder.java
~~~~~~~~~~~~~~~~~~~~~~

package com.anil.builder.design.pattern;

public class GermanCarBuilder implements CarBuilder {

private Car car;

        @Override
        public String makeEngine() {
                // TODO Auto-generated method stub
                return "German Engine";
        }

        @Override
        public String makeTyre() {
                return "German tyres";
        }

        @Override
        public String makePaint() {
                return "Blue";
        }

        @Override
        public void makeCar() {
                car=new Car();
                car.setEngine(makeEngine());
                car.setTyre(makeTyre());
                car.setPaint(makePaint());
        }

        @Override
        public Car getCar() {
                return car;
        }

}
----------------------------------------------------

Director.java
~~~~~~~~~~~~~
package com.anil.builder.design.pattern;

public class Director {

        private CarBuilder carBuilder;

        public Director(CarBuilder carBuilder) {
                super();
                this.carBuilder = carBuilder;
        }

        public CarBuilder getCarBuilder() {
                return carBuilder;
        }

        public void setCarBuilder(CarBuilder carBuilder) {
                this.carBuilder = carBuilder;
        }

        public void build() {
                carBuilder.makeCar();
        }
}
-----------------------------------------------------------
Test.java
~~~~~~~~~
package com.anil.builder.design.pattern;

public class Test {

        public static void main(String[] args) {
                CarBuilder builder=new USCarBuilder();
                Director director=new Director(builder);
                director.build();
                Car car=builder.getCar();
                System.out.println(" Car Engine : "+car.getEngine());
        }

 Pattern Definition
 Moves the Construction logic of the Object from the Object Class to Builder Class

Improves
  • Object Construction
  • Making new Changes
  • Modular Design