jyang 2004/03/15 19:02:43
Modified: cornerstone/src/java/org/apache/cornerstone/framework/factory/ioc
InversionOfControlFactory.java
Log:
use mini implementation manager of Cornerstone
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.2 +23 -3
jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/factory/ioc/InversionOfControlFactory.java
Index: InversionOfControlFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/cornerstone/src/java/org/apache/cornerstone/framework/factory/ioc/InversionOfControlFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InversionOfControlFactory.java 2 Dec 2003 17:45:13 -0000 1.1
+++ InversionOfControlFactory.java 16 Mar 2004 03:02:43 -0000 1.2
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.cornerstone.framework.factory.ioc;
import java.beans.PropertyDescriptor;
@@ -5,7 +21,9 @@
import org.apache.commons.beanutils.PropertyUtils;
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.api.singleton.ISingletonManager;
import org.apache.cornerstone.framework.bean.helper.BeanHelper;
import org.apache.cornerstone.framework.constant.Constant;
import org.apache.cornerstone.framework.factory.BaseFactory;
@@ -115,7 +133,8 @@
protected Object createInstanceByFactoryClassName(String factoryClassName)
throws CreationException
{
- IFactory factory = (IFactory)
Cornerstone.getSingletonManager().getSingleton(factoryClassName);
+ ISingletonManager singletonManager = (ISingletonManager)
Cornerstone.getImplementation(ISingletonManager.class);
+ IFactory factory = (IFactory) singletonManager.getSingleton(factoryClassName);
if (factory == null)
throw new CreationException("singleton of class '" + factoryClassName +
"' not found");
Object product = factory.createInstance();
@@ -130,7 +149,8 @@
Class interfaceType = pd.getPropertyType();
if (!interfaceType.isInterface())
throw new CreationException("property '" + propertyName + "' of
class '" + product.getClass().getName() + "' should be an interface type");
- Object propertyValue =
Cornerstone.getImplementationManager().createImplementation(interfaceType, parentName);
+ IImplementationManager implementationManager = (IImplementationManager)
Cornerstone.getImplementation(IImplementationManager.class);
+ Object propertyValue =
implementationManager.createImplementation(interfaceType, parentName);
return propertyValue;
}
catch (ImplementationException ie)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]