portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jy...@apache.org
Subject cvs commit: jakarta-jetspeed-2/cornerstone-demo/src/java/org/apache/cornerstone/framework/demo/main DemoPersistence.java DemoMain.java
Date Wed, 17 Mar 2004 02:08:18 GMT
jyang       2004/03/16 18:08:18

  Modified:    cornerstone-demo/src/java/org/apache/cornerstone/framework/demo/main
                        DemoPersistence.java DemoMain.java
  Log:
  updated to use Cornerstone.getImplementation()
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.3       +6 -4      jakarta-jetspeed-2/cornerstone-demo/src/java/org/apache/cornerstone/framework/demo/main/DemoPersistence.java
  
  Index: DemoPersistence.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/cornerstone-demo/src/java/org/apache/cornerstone/framework/demo/main/DemoPersistence.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DemoPersistence.java	8 Mar 2004 01:18:12 -0000	1.2
  +++ DemoPersistence.java	17 Mar 2004 02:08:18 -0000	1.3
  @@ -19,6 +19,7 @@
   
   import org.apache.cornerstone.framework.api.factory.CreationException;
   import org.apache.cornerstone.framework.api.factory.IFactory;
  +import org.apache.cornerstone.framework.api.implementation.IImplementationManager;
   import org.apache.cornerstone.framework.api.implementation.ImplementationException;
   import org.apache.cornerstone.framework.bean.visitor.BeanPrinter;
   import org.apache.cornerstone.framework.demo.bo.api.IGroup;
  @@ -39,21 +40,22 @@
   
           Cornerstone.init();
   
  -        IFactory groupFactory = (IFactory) Cornerstone.getImplementationManager().createImplementation(
  +        IImplementationManager implementationManager = (IImplementationManager) Cornerstone.getImplementation(IImplementationManager.class);
  +        IFactory groupFactory = (IFactory) implementationManager.createImplementation(
           	IFactory.class,
           	"cornerstone.demo.groupFactory"
           );
           IGroup group = (IGroup) groupFactory.createInstance(new Integer(100));
           System.out.println("group=" + BeanPrinter.getPrintString(group));
   
  -		IFactory userFactory = (IFactory) Cornerstone.getImplementationManager().createImplementation(
  +		IFactory userFactory = (IFactory) implementationManager.createImplementation(
   			IFactory.class,
   			"cornerstone.demo.userFactory"
   		);
   		IUser user = (IUser) userFactory.createInstance(new Integer(101));
   		System.out.println("user=" + BeanPrinter.getPrintString(user));
   
  -		IFactory userListFactory = (IFactory) Cornerstone.getImplementationManager().createImplementation(
  +		IFactory userListFactory = (IFactory) implementationManager.createImplementation(
   			IFactory.class,
   			"cornerstone.demo.userListFactory"
   		);
  
  
  
  1.3       +16 -12    jakarta-jetspeed-2/cornerstone-demo/src/java/org/apache/cornerstone/framework/demo/main/DemoMain.java
  
  Index: DemoMain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/cornerstone-demo/src/java/org/apache/cornerstone/framework/demo/main/DemoMain.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DemoMain.java	8 Mar 2004 01:18:12 -0000	1.2
  +++ DemoMain.java	17 Mar 2004 02:08:18 -0000	1.3
  @@ -17,7 +17,9 @@
   
   import org.apache.log4j.PropertyConfigurator;
   import org.apache.cornerstone.framework.api.context.IContext;
  +import org.apache.cornerstone.framework.api.implementation.IImplementationManager;
   import org.apache.cornerstone.framework.api.service.IService;
  +import org.apache.cornerstone.framework.api.service.IServiceManager;
   import org.apache.cornerstone.framework.bean.visitor.BeanPrinter;
   import org.apache.cornerstone.framework.context.BaseContext;
   import org.apache.cornerstone.framework.init.Cornerstone;
  @@ -47,7 +49,8 @@
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/cornerstone.demo.service/cornerstone.demo.getDate.reg.properties
           // for the definition of this service
           String serviceName = "cornerstone.demo.getDate";
  -        IService service = Cornerstone.getServiceManager().createServiceByName(serviceName);
  +        IServiceManager serviceManager = (IServiceManager) Cornerstone.getImplementation(IServiceManager.class);
  +        IService service = serviceManager.createServiceByName(serviceName);
   
   		// call passing no values in context
   		// service will use its defaults
  @@ -71,7 +74,7 @@
   		// call another instance of DateService which has different configurations
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/cornerstone.demo.service/cornerstone.demo.getDate2.reg.properties
   		serviceName = "cornerstone.demo.getDate2";
  -		service = Cornerstone.getServiceManager().createServiceByName(serviceName);
  +		service = serviceManager.createServiceByName(serviceName);
   		context = new BaseContext();
   		dateString = (String) service.invoke(context);
   		printDate(serviceName, dateString, context);
  @@ -79,7 +82,7 @@
   		// call yet another instance of DateService which has different configurations
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/cornerstone.demo.service/cornerstone.demo.getDate3.reg.properties
   		serviceName = "cornerstone.demo.getDate3";
  -		service = Cornerstone.getServiceManager().createServiceByName(serviceName);
  +		service = serviceManager.createServiceByName(serviceName);
   		context = new BaseContext();
   		dateString = (String) service.invoke(context);
   		printDate(serviceName, dateString, context);
  @@ -93,7 +96,7 @@
           // services will share the same inputs and output, whihc is not desirable.  This
           // "spreading" is unnecessary if the services in the sequence are of different
classes.
   		serviceName = "cornerstone.demo.getDate1x1";     // name of service controller
  -        service = Cornerstone.getServiceManager().createServiceByName(serviceName);
  +        service = serviceManager.createServiceByName(serviceName);
           context = new BaseContext();
           context.setValue("tz102", "GMT-0800");
           context.setValue("tz103", "GMT+0800");
  @@ -114,7 +117,8 @@
   
           // get the single implementation of an factory interface
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IAFactory/.reg.properties
  -		IAFactory aFactory = (IAFactory) Cornerstone.getImplementationManager().createImplementation(IAFactory.class);
  +        IImplementationManager implementationManager = (IImplementationManager) Cornerstone.getImplementation(IImplementationManager.class);
  +		IAFactory aFactory = (IAFactory) implementationManager.createImplementation(IAFactory.class);
   		IA a = (IA) aFactory.createInstance();
   		String aPrintString = BeanPrinter.getPrintString(a);
   		System.out.println("a=" + aPrintString);
  @@ -122,14 +126,14 @@
           // get the "a1_viaInstanceClassName" implementation variant of interface IA
           // This variant defines how an instance should be created by using "instance.className".
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IA/a1_viaInstanceClassName.reg.properties
  -        IA a1_viaInstanceClassName = (IA) Cornerstone.getImplementationManager().createImplementation(IA.class,
"a1_viaInstanceClassName");
  +        IA a1_viaInstanceClassName = (IA) implementationManager.createImplementation(IA.class,
"a1_viaInstanceClassName");
           String a1_viaInstanceClassNamePrintString = BeanPrinter.getPrintString(a1_viaInstanceClassName);
           System.out.println("a1_viaInstanceClassName=" + a1_viaInstanceClassNamePrintString);
   
           // get the "a1_viaFactoryClassName" implementation variant of interface IA
           // This variant defines how an instance should be created by using "factory.className".
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IA/a1_viaFactoryClassName.reg.properties
  -        IA a1_viaFactoryClassName = (IA) Cornerstone.getImplementationManager().createImplementation(IA.class,
"a1_viaFactoryClassName");
  +        IA a1_viaFactoryClassName = (IA) implementationManager.createImplementation(IA.class,
"a1_viaFactoryClassName");
           String a1_viaFactoryClassNamePrintString = BeanPrinter.getPrintString(a1_viaFactoryClassName);
           System.out.println("a1_viaFactoryClassName=" + a1_viaFactoryClassNamePrintString);
   
  @@ -137,7 +141,7 @@
           // This variant doesn't specify either instance.className or factory.className
but gets that
           // from its parent (another implementation for the same interface) specified by
"parent.name".
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IA/a1_viaParentName.reg.properties
  -        IA a1_viaParentName = (IA) Cornerstone.getImplementationManager().createImplementation(IA.class,
"a1_viaParentName");
  +        IA a1_viaParentName = (IA) implementationManager.createImplementation(IA.class,
"a1_viaParentName");
           String a1_viaParentNamePrintString = BeanPrinter.getPrintString(a1_viaParentName);
           System.out.println("a1_viaParentName=" + a1_viaParentNamePrintString);
   
  @@ -149,7 +153,7 @@
           // get the implementation variant "x1y1" of factory interface IXFactory and create
an instance
           // the instance of X1 will be associated with an instance of Y1
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IXFactory/x1y1.reg.properties
  -        IXFactory xFactory = (IXFactory) Cornerstone.getImplementationManager().createImplementation(IXFactory.class,
"x1y1");
  +        IXFactory xFactory = (IXFactory) implementationManager.createImplementation(IXFactory.class,
"x1y1");
           IX x1y1 = (IX) xFactory.createInstance();
           String x1y1PrintString = BeanPrinter.getPrintString(x1y1);
           System.out.println("x1y1=" + x1y1PrintString);
  @@ -157,7 +161,7 @@
           // get the implementation variant "x1y2" of factory interface IXFactory and create
an instance
           // the instance of X1 will be associated with an instance of Y2
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IXFactory/x1y2.reg.properties
  -        xFactory = (IXFactory) Cornerstone.getImplementationManager().createImplementation(IXFactory.class,
"x1y2");
  +        xFactory = (IXFactory) implementationManager.createImplementation(IXFactory.class,
"x1y2");
           IX x1y2 = (IX) xFactory.createInstance();
           String x1y2PrintString = BeanPrinter.getPrintString(x1y2);
           System.out.println("x1y2=" + x1y2PrintString);
  @@ -165,7 +169,7 @@
           // get the implementation variant "x1y3" of factory interface IXFactory and create
an instance
           // the instance of X1 will be associated with an instance of Y3
           // ${CORNERSTONE_RUNTIME_HOME}/registry/implementation/...IXFactory/x1y3.reg.properties
  -        xFactory = (IXFactory) Cornerstone.getImplementationManager().createImplementation(IXFactory.class,
"x1y3");
  +        xFactory = (IXFactory) implementationManager.createImplementation(IXFactory.class,
"x1y3");
           IX x1y3 = (IX) xFactory.createInstance();
           String x1y3PrintString = BeanPrinter.getPrintString(x1y3);
           System.out.println("x1y3=" + x1y3PrintString);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message