You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by ha...@apache.org on 2004/06/20 23:04:07 UTC

svn commit: rev 21517 - in excalibur/sandbox/fortress2: fortress2-api/src/java/org/apache/excalibur/fortress fortress2-impl/src/java/org/apache/excalibur/fortress fortress2-impl/src/test/org/apache/excalibur/fortress/test fortress2-tck/src/java/org/apache/excalibur/fortress/tck

Author: hammett
Date: Sun Jun 20 14:04:07 2004
New Revision: 21517

Modified:
   excalibur/sandbox/fortress2/fortress2-api/src/java/org/apache/excalibur/fortress/Container.java
   excalibur/sandbox/fortress2/fortress2-impl/src/java/org/apache/excalibur/fortress/DefaultContainer.java
   excalibur/sandbox/fortress2/fortress2-impl/src/test/org/apache/excalibur/fortress/test/DefaultContainerTestCase.java
   excalibur/sandbox/fortress2/fortress2-tck/src/java/org/apache/excalibur/fortress/tck/AbstractContainerTestCase.java
Log:
Few minor modifications.

Modified: excalibur/sandbox/fortress2/fortress2-api/src/java/org/apache/excalibur/fortress/Container.java
==============================================================================
--- excalibur/sandbox/fortress2/fortress2-api/src/java/org/apache/excalibur/fortress/Container.java	(original)
+++ excalibur/sandbox/fortress2/fortress2-api/src/java/org/apache/excalibur/fortress/Container.java	Sun Jun 20 14:04:07 2004
@@ -1,27 +1,54 @@
 /*
-* Copyright 2003-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.
-*/
+ * Copyright 2003-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.excalibur.fortress;
 
 /**
+ * Primary interface exposed to clients.
+ * <p>
+ * The use must configure his container throught the 
+ * <code>Container</code> interface (adding components/handler/configuration)
+ * before its usage.
+ * <p>
  * 
- *
  * @author <a href="mailto:dev@excalibur.apache.org">Excalibur Development Team</a>
  */
 public interface Container
 {
+	/**
+	 * Returns a component instance given the 
+	 * specified identification.
+	 * 
+	 * @param name Component/Service name
+	 * @return component instance
+	 */
     Object getComponent( String name );
+
+	/**
+	 * Returns a component instance given the 
+	 * specified identification and if the specified 
+	 * criteria matches the available components. 
+	 * 
+	 * The criteria is evaluated by a another pluggable 
+	 * entity (DiscoveryStrategy?)
+	 * 
+	 * @param name Component/Service name
+	 * @param criteria Specific criteria
+	 * @return component instance
+	 */
+	Object getComponent( String name, Object criteria );
 }

Modified: excalibur/sandbox/fortress2/fortress2-impl/src/java/org/apache/excalibur/fortress/DefaultContainer.java
==============================================================================
--- excalibur/sandbox/fortress2/fortress2-impl/src/java/org/apache/excalibur/fortress/DefaultContainer.java	(original)
+++ excalibur/sandbox/fortress2/fortress2-impl/src/java/org/apache/excalibur/fortress/DefaultContainer.java	Sun Jun 20 14:04:07 2004
@@ -17,20 +17,56 @@
 package org.apache.excalibur.fortress;
 
 /**
- * 
+ * Default implementation for a simple container.
  *
  * @author <a href="mailto:dev@excalibur.apache.org">Excalibur Development Team</a>
  */
 public class DefaultContainer implements Container
 {
-    public DefaultContainer()
-    {
-    }
+	public DefaultContainer()
+	{
+	}
 
-    public Object getComponent( String name )
-    {
-        if( name == null ) throw new IllegalArgumentException();
+	/**
+	 * Returns a component instance given the 
+	 * specified identification.
+	 * 
+	 * @param name Component/Service name
+	 * @return component instance
+	 */
+	public Object getComponent(String name)
+	{
+		if (name == null)
+		{
+			// TODO: Change to Commons-lang ArgumentNullException ?
+			// TODO: Shall we have an assertion util class? I guess so.
+			throw new IllegalArgumentException();
+		}
 
-        return null;
-    }
+		return null;
+	}
+
+	/**
+	 * Returns a component instance given the 
+	 * specified identification and if the specified 
+	 * criteria matches the available components. 
+	 * 
+	 * The criteria is evaluated by a another pluggable 
+	 * entity (DiscoveryStrategy?)
+	 * 
+	 * @param name Component/Service name
+	 * @param criteria Specific criteria
+	 * @return component instance
+	 */
+	public Object getComponent(String name, Object criteria)
+	{
+		if (name == null || criteria == null)
+		{
+			// TODO: Change to Commons-lang ArgumentNullException ?
+			// TODO: Shall we have an assertion util class? I guess so.
+			throw new IllegalArgumentException();
+		}
+
+		return null;
+	}
 }

Modified: excalibur/sandbox/fortress2/fortress2-impl/src/test/org/apache/excalibur/fortress/test/DefaultContainerTestCase.java
==============================================================================
--- excalibur/sandbox/fortress2/fortress2-impl/src/test/org/apache/excalibur/fortress/test/DefaultContainerTestCase.java	(original)
+++ excalibur/sandbox/fortress2/fortress2-impl/src/test/org/apache/excalibur/fortress/test/DefaultContainerTestCase.java	Sun Jun 20 14:04:07 2004
@@ -1,19 +1,20 @@
 /*
-* Copyright 2003-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.
-*/
+ * Copyright 2003-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.excalibur.fortress.test;
 
 import org.apache.excalibur.fortress.DefaultContainer;
@@ -27,7 +28,7 @@
  */
 public class DefaultContainerTestCase extends AbstractContainerTestCase
 {
-    protected Container getContainer()
+    protected Container createContainer()
     {
         return new DefaultContainer();
     }

Modified: excalibur/sandbox/fortress2/fortress2-tck/src/java/org/apache/excalibur/fortress/tck/AbstractContainerTestCase.java
==============================================================================
--- excalibur/sandbox/fortress2/fortress2-tck/src/java/org/apache/excalibur/fortress/tck/AbstractContainerTestCase.java	(original)
+++ excalibur/sandbox/fortress2/fortress2-tck/src/java/org/apache/excalibur/fortress/tck/AbstractContainerTestCase.java	Sun Jun 20 14:04:07 2004
@@ -1,19 +1,20 @@
 /*
-* Copyright 2003-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.
-*/
+ * Copyright 2003-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.excalibur.fortress.tck;
 
 import org.apache.excalibur.fortress.Container;
@@ -26,20 +27,26 @@
  */
 public abstract class AbstractContainerTestCase extends TestCase
 {
-    private Container m_container;
-    protected abstract Container getContainer();
+	private Container m_container;
+
+	public void setUp() throws Exception
+	{
+		super.setUp();
+		m_container = createContainer();
+	}
+
+	protected abstract Container createContainer();
 
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        m_container = getContainer();
-    }
-
-    public void testGetComponentThrowsIllegalArgumentExceptionOnNullKey()
-    {
-        try
-        {
-            m_container.getComponent( null );
-        } catch( IllegalArgumentException iae ) {}
-    }
+	public void testGetComponentThrowsIllegalArgumentExceptionOnNullKey()
+	{
+		try
+		{
+			m_container.getComponent(null);
+			fail("Container should not accept a null name");
+		}
+		catch (IllegalArgumentException iae)
+		{
+			// Ok, expected.
+		}
+	}
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org


Re: svn commit: rev 21517

Posted by Leo Simons <ls...@jicarilla.org>.
hammett@apache.org wrote:
> +	/**
> +	 * Returns a component instance given the 
> +	 * specified identification.
> +	 * 
> +	 * @param name Component/Service name
> +	 * @return component instance
> +	 */
>      Object getComponent( String name );

that's certainly different from what Container#getComponent(String) does 
for the current fortress!

cheers,

- LSD

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/