From: Teiniker E. <tei...@us...> - 2007-02-25 10:53:56
|
Update of /cvsroot/ccmtools/ccmtools/test/JavaAssembly/prototype2/xxx/src/wamas In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14346/test/JavaAssembly/prototype2/xxx/src/wamas Added Files: H3Factory.java C3i1Impl.java Main.java H3Impl.java C3Impl.java Log Message: Added second prototype for Java assemblies. --- NEW FILE: H3Factory.java --- /* * This file was automatically generated by CCM Tools version 0.9.0 * <http://ccmtools.sourceforge.net> * DO NOT EDIT! */ package wamas; import Components.HomeExecutorBase; import Components.CCMException; public class H3Factory { public static HomeExecutorBase create() throws CCMException { return new H3Impl(); } } --- NEW FILE: Main.java --- package wamas; import java.util.logging.ConsoleHandler; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; import ccmtools.local.ServiceLocator; class Main { public static void main(String[] args) { try { /* * Configure Logger */ Logger logger = Logger.getLogger("test"); logger.setLevel(Level.FINE); Handler handler = new ConsoleHandler(); handler.setLevel(Level.ALL); handler.setFormatter(new ccmtools.utils.SimpleFormatter()); logger.addHandler(handler); ServiceLocator.instance().setLogger(logger); /* * First test case */ H3 home = (H3)H3Deployment.create(); C3 component = home.create(); component.configuration_complete(); // Here we use provide after configuration_complete !!! wamas.Test.I1 c3i1 = component.provide_i1(); System.out.println("C3.b = "+component.b()); System.out.println("C3->I1.value() = "+c3i1.value()); /* * Second test case */ wamas.Test.H1 h1 = (wamas.Test.H1)wamas.Test.H1Deployment.create(); wamas.Test.C1 c1 = h1.create(); c1.a1("second Test"); wamas.Test.I1 c1i1 = c1.provide_i1(); c1.configuration_complete(); System.out.println("C1->I1.value() = "+c1i1.value()); } catch(Exception e) { e.printStackTrace(); } } } --- NEW FILE: C3Impl.java --- /** * This file was automatically generated by CCM Tools version 0.9.0 * <http://ccmtools.sourceforge.net> * * CCM_C3 component business logic. * */ package wamas; import Components.CCMException; import Components.CCMExceptionReason; import Components.SessionContext; /** * This class implements component equivalent and supported interfaces * as well as component attributes. */ public class C3Impl implements CCM_C3 { /** Supported interface attribute variables */ /** Component attribute variables */ private int b_; private wamas.Test.C2 comp2_; private wamas.Test.C1 comp1_; public CCM_C3_Context ctx; public C3Impl() throws CCMException //!!!!! { //!!!!!!!! try { // create inner components comp2_ = ((wamas.Test.H2)wamas.Test.H2Deployment.create()).create(); comp1_ = ((wamas.Test.H1)wamas.Test.H1Deployment.create()).create(); // set component attributes comp1_.a1("Hello World"); comp1_.a2(642); comp2_.b(this.b_); } catch(Exception e) { e.printStackTrace(); throw new CCMException(e.getMessage(), CCMExceptionReason.CREATE_ERROR); } //!!!!!!! } /* * Supported interface methods */ /** Supported interface attributes */ /** Supported interface methods */ /** Component attribute accessor methods */ public int b() throws CCMException { return this.b_; } public void b(int value) throws CCMException { this.b_ = value; } /** Facet implementation factory methods */ private wamas.C3i1Impl i1_; public wamas.Test.CCM_I1 get_i1() { //!!!!!!!! // Here we don't need to provide a singleton behavior (it's done by the corresponding adapter) i1_ = new wamas.C3i1Impl(this); // Set facet implementation delegation target i1_.target = comp1_.provide_i1(); //!!!!!!!! return i1_; } /** Component callback methods */ public void set_session_context(SessionContext ctx) throws CCMException { this.ctx = (CCM_C3_Context)ctx; try { // Connect components // Note that connections must be performed here, because we need access to // the ctx object. comp1_.connect_i2(comp2_.provide_i2()); comp2_.connect_i3(this.ctx.get_connection_i3()); // finish configuration comp2_.configuration_complete(); comp1_.configuration_complete(); } catch(Exception e) { throw new CCMException(e.getMessage(), CCMExceptionReason.CREATE_ERROR); } } public void ccm_activate() throws CCMException { } public void ccm_passivate() throws CCMException { // Who calls this method? // A pretty cool session container would...!!! } public void ccm_remove() throws CCMException { try { comp2_.remove(); comp1_.remove(); } catch(Exception e) { throw new CCMException(e.getMessage(), CCMExceptionReason.REMOVE_ERROR); } } } --- NEW FILE: H3Impl.java --- /* * This file was automatically generated by CCM Tools version 0.9.0 * <http://ccmtools.sourceforge.net> * * H3 Implementation * * // TODO: WRITE YOUR DESCRIPTION HERE! * * @author * @version */ package wamas; import Components.CCMException; import Components.EnterpriseComponent; /** * This class implements a component home's attributes and factory methods. * * // TODO: WRITE YOUR DESCRIPTION HERE ! * * @author * @version */ public class H3Impl implements CCM_H3 { public H3Impl() { // OPTIONAL: IMPLEMENT ME HERE ! } public EnterpriseComponent create() throws CCMException { return (EnterpriseComponent) new C3Impl(); } } --- NEW FILE: C3i1Impl.java --- /** * This file was automatically generated by CCM Tools version 0.9.0 * <http://ccmtools.sourceforge.net> * * CCM_I1Impl facet implementation. * */ package wamas; import Components.CCMException; import wamas.Test.CCM_I1; import wamas.Test.I1; /** * This class implements a component facet's methods. * */ public class C3i1Impl implements CCM_I1 { /** Reference to the facet's component implementation */ private C3Impl component; /** the facet of the inner component we delegate to */ wamas.Test.I1 target; public C3i1Impl( C3Impl component) { this.component = component; } /** Business logic implementations */ public String value() throws CCMException { return this.target.value(); } } |