You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by tv...@apache.org on 2007/05/05 08:58:51 UTC

svn commit: r535465 [39/49] - in /jakarta/turbine/fulcrum/trunk: ./ bsf/ bsf/src/java/org/apache/fulcrum/bsf/ bsf/src/test/ bsf/xdocs/ cache/ cache/src/java/org/apache/fulcrum/cache/ cache/src/java/org/apache/fulcrum/cache/impl/ cache/src/test/ cache/s...

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverImpl.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverImpl.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/configuration/ComponentConfigurationPropertiesResolverImpl.java Fri May  4 23:58:06 2007
@@ -1,53 +1,56 @@
-/*
- * Copyright 2002-2005 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.fulcrum.yaafi.framework.configuration;
-
-import java.util.Properties;
-
-/**
- * A implementation to provide out-of-the-box component configuration properties
- * using the following algorithm:
- * 
- * <ul>
- *   <li>add the user-supplied defaults to the result<li>
- * 	 <li>add the system properties to the result<li>
- * 	 <li>add the Merlin context entries to the result<li>
- * </ul>
- * 
- * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
- */
-public class ComponentConfigurationPropertiesResolverImpl 
-	extends ComponentConfigurationPropertiesResolverBaseImpl
-{    
-    /**
-     * @see org.apache.fulcrum.yaafi.framework.configuration.ComponentConfigurationPropertiesResolver#resolve(java.util.Properties)
-     */
-    public Properties resolve(Properties defaults) throws Exception
-    {
-        String location = this.getLocation();
-        Properties result = this.loadProperties(location);
-        
-        if(defaults != null) 
-        {
-            result.putAll(defaults);
-        }
-            
-        result.putAll(System.getProperties());
-        this.addAvalonContext(result);
-        
-        return result;    
-    }    
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.fulcrum.yaafi.framework.configuration;
+
+import java.util.Properties;
+
+/**
+ * A implementation to provide out-of-the-box component configuration properties
+ * using the following algorithm:
+ *
+ * <ul>
+ *   <li>add the user-supplied defaults to the result<li>
+ * 	 <li>add the system properties to the result<li>
+ * 	 <li>add the Merlin context entries to the result<li>
+ * </ul>
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+public class ComponentConfigurationPropertiesResolverImpl
+	extends ComponentConfigurationPropertiesResolverBaseImpl
+{
+    /**
+     * @see org.apache.fulcrum.yaafi.framework.configuration.ComponentConfigurationPropertiesResolver#resolve(java.util.Properties)
+     */
+    public Properties resolve(Properties defaults) throws Exception
+    {
+        String location = this.getLocation();
+        Properties result = this.loadProperties(location);
+
+        if(defaults != null)
+        {
+            result.putAll(defaults);
+        }
+
+        result.putAll(System.getProperties());
+        this.addAvalonContext(result);
+
+        return result;
+    }
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonFortressConstants.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonFortressConstants.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonFortressConstants.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonFortressConstants.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.constant;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 /**
@@ -43,4 +45,4 @@
 
     /** Fortress alias for "urn:avalon:temp" */
     String FORTRESS_IMPL_WORKDIR = "impl.workDir";
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonMerlinConstants.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonMerlinConstants.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonMerlinConstants.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonMerlinConstants.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.constant;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 /**
@@ -46,4 +48,4 @@
 
     /** define the Merlin component classloader (ClassLoader) */
     String URN_AVALON_CLASSLOADER = "urn:avalon:classloader";
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonPhoenixConstants.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonPhoenixConstants.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonPhoenixConstants.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonPhoenixConstants.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.constant;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 /**
@@ -40,4 +42,4 @@
 
     /** Phoenix alias for "urn:avalon:home" */
     String PHOENIX_APP_HOME = "app.home";
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonYaafiConstants.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonYaafiConstants.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonYaafiConstants.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/constant/AvalonYaafiConstants.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.constant;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 /**
@@ -62,4 +64,4 @@
     /** this is only supplied for backward compatibilty with ECM */
     String COMPONENT_APP_ROOT  = "componentAppRoot";
 
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceConstants.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceConstants.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceConstants.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceConstants.java Fri May  4 23:58:06 2007
@@ -1,19 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.container;
 
 /*
- * Copyright 2002-2005 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *      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.
+ * 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.
  */
 
 import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
@@ -71,7 +74,7 @@
 
     /** property to lookup the reconfigurationDelay */
     String RECONFIGURATION_DELAY_KEY = "reconfigurationDelay";
-    
+
     /////////////////////////////////////////////////////////////////////////
     // Default values for YAAFI configuration files
     /////////////////////////////////////////////////////////////////////////
@@ -91,4 +94,4 @@
     /** default value for role config flavour */
     String COMPONENT_ROLECONFIGFLAVOUR_VALUE = "yaafi";
 
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainer.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainer.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainer.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainer.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.container;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 import org.apache.avalon.framework.activity.Disposable;
@@ -42,4 +44,4 @@
      * @return the Avalon paramters
      */
     Parameters getParameters();
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.container;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 import java.io.File;
@@ -68,7 +70,7 @@
 {
     /** the timeout after getting a write lock for reconfiguration */
     private static final int RECONFIGURATION_DELAY = 0;
-    
+
     /** The role configuration file to be used */
     private String componentRolesLocation;
 
@@ -101,7 +103,7 @@
 
     /** The service manager passed to the container */
     private ServiceManager parentServiceManager;
-    
+
     /** The list of services instantiated */
     private List serviceList;
 
@@ -134,16 +136,16 @@
 
     /** global flag for enabling/disabling dynamic proxies */
     private boolean hasDynamicProxies;
-    
+
     /** The list of interceptor services applied to all services */
     private ArrayList defaultInterceptorServiceList;
-    
+
     /** Read/Write lock to synchronize acess to services */
     private ReadWriteLock readWriteLock;
-    
+
     /** the configuration for running the ComponentConfigurationPropertiesResolver */
     private Configuration componentConfigurationPropertiesResolverConfig;
-    
+
     /////////////////////////////////////////////////////////////////////////
     // Avalon Service Lifecycle
     /////////////////////////////////////////////////////////////////////////
@@ -197,15 +199,15 @@
         this.callerContext = context;
     }
 
-    
-    /** 
+
+    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager serviceManager) throws ServiceException
     {
         this.parentServiceManager = serviceManager;
     }
-    
+
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
@@ -214,15 +216,15 @@
         Validate.notNull( configuration, "configuration" );
 
         // retrieve the reconfigurationDelay
-        
-        this.reconfigurationDelay = 
+
+        this.reconfigurationDelay =
             configuration.getChild(RECONFIGURATION_DELAY_KEY).getValueAsInteger(
                 RECONFIGURATION_DELAY
                 );
 
         // evaluate if we are using dynamic proxies
-        
-        this.hasDynamicProxies = 
+
+        this.hasDynamicProxies =
             configuration.getChild(DYNAMICPROXY_ENABLED_KEY).getValueAsBoolean(false);
 
         // retrieve the container flavour
@@ -297,14 +299,14 @@
             currComponentConfiguration.getChild(COMPONENT_ISENCRYPTED_KEY).getValue(
                 "false" )
                 );
-                
-        
+
+
         // get the configuration for componentConfigurationPropertiesResolver
-        
+
         this.componentConfigurationPropertiesResolverConfig = configuration.getChild(
             COMPONENT_CONFIG_PROPERTIES_KEY
             );
-        
+
         // evaluate parameters
 
         Configuration currParameters = configuration.getChild(COMPONENT_PARAMETERS_KEY);
@@ -318,13 +320,13 @@
             currParameters.getChild(COMPONENT_ISENCRYPTED_KEY).getValue(
                 "false" )
                 );
-        
+
         // evaluate the default interceptors
 
-        Configuration currInterceptorList = configuration.getChild( 
-            INTERCEPTOR_LIST_KEY 
+        Configuration currInterceptorList = configuration.getChild(
+            INTERCEPTOR_LIST_KEY
             );
-                
+
         Configuration[] interceptorConfigList = currInterceptorList.getChildren(
             INTERCEPTOR_KEY
             );
@@ -332,11 +334,11 @@
         for( int j=0; j<interceptorConfigList.length; j++ )
         {
             String interceptorServiceName = interceptorConfigList[j].getValue(null);
-                        
+
             if( !StringUtils.isEmpty(interceptorServiceName) && this.hasDynamicProxies())
             {
 	            this.defaultInterceptorServiceList.add( interceptorServiceName );
-	
+
 	            this.getLogger().debug("Using the following default interceptor service : "
 	                + interceptorServiceName
 	                );
@@ -389,14 +391,14 @@
             );
 
         // create the configuration properties
-        
+
         Properties componentConfigurationProperties = this.loadComponentConfigurationProperties();
 
         // expand the componentConfiguration using the componentConfigurationProperties
-        
+
         ConfigurationUtil.expand(
             this.getLogger(),
-            (DefaultConfiguration) this.serviceConfiguration, 
+            (DefaultConfiguration) this.serviceConfiguration,
             componentConfigurationProperties
             );
 
@@ -446,7 +448,7 @@
     public void dispose()
     {
         Object lock = null;
-            
+
         if( this.isDisposed )
         {
             return;
@@ -455,12 +457,12 @@
         try
         {
             lock = this.getWriteLock();
-            
+
             if( this.getLogger() != null )
             {
                 this.getLogger().debug("Disposing all services");
             }
-            
+
             // decommision all servcies
 
             this.decommisionAll( this.getServiceList() );
@@ -515,31 +517,31 @@
         try
         {
             // 1) lock the service container
-            
+
             lock = this.getWriteLock();
-            
+
 	        // 2) store the new configuration
 
 	        this.serviceConfiguration = configuration;
 
             Properties componentConfigurationProperties = this.loadComponentConfigurationProperties();
-            
+
             ConfigurationUtil.expand(
                 this.getLogger(),
-                (DefaultConfiguration) this.serviceConfiguration, 
+                (DefaultConfiguration) this.serviceConfiguration,
                 componentConfigurationProperties
                 );
 
 	        // 3) reconfigure the services
-	
+
 	        for( int i=0; i<this.getServiceList().size(); i++ )
 	        {
 	            serviceComponent = (ServiceComponent) this.getServiceList().get(i);
-	
+
 	            Configuration serviceComponentConfiguraton = this.getServiceConfiguration().getChild(
 	                serviceComponent.getShorthand()
 	                );
-	
+
 	            try
 	            {
 	                serviceComponent.setConfiguration(serviceComponentConfiguraton);
@@ -552,9 +554,9 @@
 	                exceptionCounter++;
 	            }
 	        }
-	
+
 	        // 4) check the result
-	
+
 	        if( exceptionCounter > 0 )
 	        {
 	            String msg = "The reconfiguration failed with " + exceptionCounter + " exception(s)";
@@ -574,14 +576,14 @@
 
     /**
      * @see org.apache.fulcrum.yaafi.framework.container.ServiceLifecycleManager#getRoleEntry(java.lang.String)
-     */    
+     */
     public RoleEntry getRoleEntry(String name)
         throws ServiceException
     {
         Object lock = null;
-        
+
         try
-        {	
+        {
             lock = this.getReadLock();
             return this.getServiceComponentEx(name).getRoleEntry();
         }
@@ -590,28 +592,28 @@
             this.releaseLock(lock);
         }
     }
-    
+
     /**
      * @see org.apache.fulcrum.yaafi.framework.container.ServiceLifecycleManager#getRoleEntries()
      */
     public RoleEntry[] getRoleEntries()
     {
         Object lock = null;
-        
+
         try
         {
             lock = this.getReadLock();
-            
+
 	        List serviceList = this.getServiceList();
 	        ServiceComponent serviceComponent = null;
 	        RoleEntry[] result = new RoleEntry[serviceList.size()];
-	
+
 	        for( int i=0; i<result.length; i++ )
 	        {
 	            serviceComponent = (ServiceComponent) serviceList.get(i);
 	            result[i] = serviceComponent.getRoleEntry();
 	        }
-	
+
 	        return result;
         }
         finally
@@ -630,18 +632,18 @@
         Validate.noNullElements(names,"names");
 
         Object lock = null;
-        
+
         try
         {
             // get exclusive access
-            
+
             lock = this.getWriteLock();
-                       
+
 	        for( int i=0; i<names.length; i++ )
 	        {
 	            // ensure that the service exists since during our reconfiguration
 	            // we might use a stle recofniguration entry
-	
+
 	            if( this.getServiceMap().get(names[i]) != null )
 	            {
 	                this.reconfigure(names[i]);
@@ -664,12 +666,12 @@
         boolean result = false;
         Object lock = null;
         ServiceComponent serviceComponent = null;
-        
-        // look at our available service 
-        
+
+        // look at our available service
+
         try
         {
-            lock = this.getReadLock();            
+            lock = this.getReadLock();
             serviceComponent = this.getLocalServiceComponent(name);
             result = ( serviceComponent != null ? true : false );
         }
@@ -677,15 +679,15 @@
         {
             this.releaseLock(lock);
         }
-        
+
         // if we haven't found anything ask the parent ServiceManager
-        
+
         if( ( result == false ) && ( this.hasParentServiceManager() ) )
         {
             result = this.getParentServiceManager().hasService(name);
         }
-        
-        return result;            
+
+        return result;
     }
 
     /**
@@ -700,12 +702,12 @@
         ServiceComponent serviceComponent = null;
 
         // look at our available service
-        
+
         try
         {
             lock = this.getReadLock();
             serviceComponent = this.getLocalServiceComponent(name);
-            
+
             if( serviceComponent != null )
             {
                 result = serviceComponent.getInstance();
@@ -715,7 +717,7 @@
         {
             String msg = "Failed to lookup a service " + name;
             this.getLogger().error( msg, t );
-            throw new ServiceException( name, msg, t );   
+            throw new ServiceException( name, msg, t );
         }
 		finally
 		{
@@ -723,7 +725,7 @@
 		}
 
         // if we haven't found anything ask the parent ServiceManager
-        
+
         if( result == null )
         {
             if( this.hasParentServiceManager() )
@@ -731,9 +733,9 @@
 	            result = this.getParentServiceManager().lookup(name);
 	        }
         }
-        
+
         // if we still haven't found anything then complain
-        
+
         if( result == null )
         {
             String msg = "The following component does not exist : " + name;
@@ -759,7 +761,7 @@
     public void decommision(String name) throws ServiceException
     {
         Object lock = null;
-        
+
         try
         {
             lock = this.getWriteLock();
@@ -778,7 +780,7 @@
     public Parameters getParameters()
     {
         Object lock = null;
-        
+
         try
         {
             lock = this.getReadLock();
@@ -789,7 +791,7 @@
             this.releaseLock(lock);
         }
     }
-    
+
     /**
      * @see java.lang.Object#toString()
      */
@@ -798,13 +800,13 @@
         ToStringBuilder toStringBuilder = new ToStringBuilder(this);
 
         toStringBuilder.append("applicationRootDir", this.getApplicationRootDir());
-        toStringBuilder.append("tempRootDir", this.getTempRootDir());               
+        toStringBuilder.append("tempRootDir", this.getTempRootDir());
         toStringBuilder.append("componentRolesLocation", this.componentRolesLocation);
         toStringBuilder.append("componentConfigurationLocation", this.componentConfigurationLocation);
         toStringBuilder.append("parametersLocation", parametersLocation);
         toStringBuilder.append("logger", this.getLogger().getClass().getName());
         toStringBuilder.append("hasDynamicProxies", this.hasDynamicProxies);
-        toStringBuilder.append("containerFlavour", this.containerFlavour);        
+        toStringBuilder.append("containerFlavour", this.containerFlavour);
         toStringBuilder.append("componentRolesFlavour", this.componentRolesFlavour);
         toStringBuilder.append("isComponentRolesEncrypted", this.isComponentRolesEncrypted);
         toStringBuilder.append("isComponentConfigurationEncrypted", this.isComponentConfigurationEncrypted);
@@ -812,7 +814,7 @@
 
         return toStringBuilder.toString();
     }
-    
+
     /////////////////////////////////////////////////////////////////////////
     // Service Implementation
     /////////////////////////////////////////////////////////////////////////
@@ -863,7 +865,7 @@
 
     /**
      * Enforce that a service is known to simplify error handling.
-     * 
+     *
      * @param name the name of the service component
      * @return the service component
      * @throws ServiceException the service was not found
@@ -886,7 +888,7 @@
 
     /**
      * Try to get a local service component
-     * 
+     *
      * @param name the name of the service component
      * @return the service component if any
      */
@@ -939,7 +941,7 @@
 
     /**
      * Incarnation of a list of services.
-     * 
+     *
      * @param serviceList the list of available services
      * @throws Exception the incarnation of a service failed
      */
@@ -948,19 +950,19 @@
     {
         ServiceComponent serviceComponent = null;
 
-        // configure all services 
-        
+        // configure all services
+
         for( int i=0; i<serviceList.size(); i++ )
         {
-            serviceComponent = (ServiceComponent) this.getServiceList().get(i);            
+            serviceComponent = (ServiceComponent) this.getServiceList().get(i);
             this.configure( serviceComponent );
         }
 
         // incarnate all services
-        
+
         for( int i=0; i<serviceList.size(); i++ )
         {
-            serviceComponent = (ServiceComponent) this.getServiceList().get(i);            
+            serviceComponent = (ServiceComponent) this.getServiceList().get(i);
             this.incarnate( serviceComponent );
         }
 
@@ -988,18 +990,18 @@
 
         RoleEntry roleEntry = serviceComponent.getRoleEntry();
         String componentFlavour = roleEntry.getComponentFlavour();
-        
+
         DefaultContext serviceComponentContext = mapper.mapTo(
             this.getContext(),
             componentFlavour
             );
-        
+
         // add the read/write lock to the context
-        
+
         serviceComponentContext.put(
             URN_YAAFI_KERNELLOCK,
             this.readWriteLock
-            );            
+            );
 
         // create the remaining Avalon artifacts for the service component
 
@@ -1020,14 +1022,14 @@
         serviceComponent.setContext(serviceComponentContext);
         serviceComponent.setConfiguration(serviceComponentConfiguraton);
         serviceComponent.setParameters(serviceComponentParameters);
-        
+
         // load the implementation class of the service
-        
+
         serviceComponent.loadImplemtationClass(
            this.getClassLoader()
             );
     }
-    
+
     /**
      * Incarnation of a configured service component. After the
      * incarnation the service component is operational.
@@ -1097,7 +1099,7 @@
 
     /**
      * Disposing of a single service component.
-     
+
      * @param serviceComponent The service component to decommision
      */
     private void dispose( ServiceComponent serviceComponent )
@@ -1140,11 +1142,11 @@
     }
 
     /**
-     * Factory method for creating services. The service 
+     * Factory method for creating services. The service
      * instances are not initialized at this point.
-     * 
+     *
      * @param roleConfiguration the role configuration file
-     * @param logger the logger 
+     * @param logger the logger
      * @throws ConfigurationException creating the service instance failed
      */
     private List createServiceComponents(Configuration roleConfiguration, Logger logger )
@@ -1178,9 +1180,9 @@
                 // add the default interceptors to all role entries
 
                 RoleEntry roleEntry = roleEntryList[i];
-                
+
                 if( this.hasDynamicProxies() )
-                {                   
+                {
                     roleEntry.addInterceptors(defaultInterceptorList);
                 }
                 else
@@ -1259,21 +1261,21 @@
     {
         Properties result = new Properties();
         ComponentConfigurationPropertiesResolver resolver = null;
-        
+
         String className = this.componentConfigurationPropertiesResolverConfig.getChild("resolver").getValue(
             ComponentConfigurationPropertiesResolverImpl.class.getName()
             );
-                
+
         try
         {
             Class resolverClass = this.getClassLoader().loadClass( className );
-            resolver = (ComponentConfigurationPropertiesResolver) resolverClass.newInstance();       
+            resolver = (ComponentConfigurationPropertiesResolver) resolverClass.newInstance();
             ContainerUtil.enableLogging(resolver, this.getLogger());
             ContainerUtil.contextualize(resolver, this.getContext());
             ContainerUtil.configure(resolver, this.componentConfigurationPropertiesResolverConfig);
-            
+
             result = resolver.resolve(null);
-            
+
             this.getLogger().debug("Using the following componentConfigurationProperties: " + result);
         }
         catch (Exception e)
@@ -1330,7 +1332,7 @@
 
     /**
      * Set the application directory of the container.
-     * 
+     *
      * @param dir The applicationRootDir to set.
      */
     private File setApplicationRootDir(File dir)
@@ -1351,7 +1353,7 @@
     {
         return this.applicationRootDir;
     }
-    
+
     /**
      * @return Returns the serviceManager of the parent container
      */
@@ -1359,8 +1361,8 @@
     {
         return this.parentServiceManager;
     }
-    
-    /** 
+
+    /**
      * @return is a parent ServiceManager available
      */
     private boolean hasParentServiceManager()
@@ -1369,7 +1371,7 @@
     }
     /**
      * Set the temporary directory of the container.
-     * 
+     *
      * @param dir The tempRootDir to set.
      */
     private File setTempRootDir(File dir)
@@ -1444,7 +1446,7 @@
     /**
      * Create a decrypting input stream using the default password.
      *
-     * @param is the input stream to be decrypted 
+     * @param is the input stream to be decrypted
      * @return an decrypting input stream
      * @throws IOException
      * @throws GeneralSecurityException
@@ -1508,7 +1510,7 @@
     {
         return context;
     }
-    
+
     /**
      * @return Returns the hasDynamicProxies.
      */
@@ -1516,7 +1518,7 @@
     {
         return this.hasDynamicProxies;
     }
-    
+
     /**
      * @return Returns the defaultInterceptorServiceList.
      */
@@ -1524,7 +1526,7 @@
     {
         return defaultInterceptorServiceList;
     }
-    
+
     /**
      * @return a read lock
      */
@@ -1540,21 +1542,21 @@
             throw new RuntimeException(msg);
         }
     }
-    
+
     /**
      * @return a write lock
      */
     private final Object getWriteLock()
     {
         Object result = null;
-        
+
         try
         {
             result = this.readWriteLock.getWriteLock(AVALON_CONTAINER_YAAFI);
-            
+
             // wait for a certain time to get non-proxied services
             // either finished or blocked
-            
+
             try
             {
                 Thread.sleep( this.reconfigurationDelay );
@@ -1572,7 +1574,7 @@
             throw new RuntimeException(msg);
         }
     }
-    
+
     /**
      * Release the read/write lock.
      */
@@ -1580,7 +1582,7 @@
     {
         this.readWriteLock.releaseLock(lock, AVALON_CONTAINER_YAAFI);
     }
-    
+
     /**
      * @return the containers class loader
      */

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceLifecycleManager.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceLifecycleManager.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceLifecycleManager.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceLifecycleManager.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.container;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 
@@ -79,4 +81,4 @@
      */
     void decommision( String name )
         throws ServiceException;
-}
\ No newline at end of file
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/AvalonToYaafiContextMapper.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/AvalonToYaafiContextMapper.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/AvalonToYaafiContextMapper.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/AvalonToYaafiContextMapper.java Fri May  4 23:58:06 2007
@@ -1,244 +1,246 @@
-package org.apache.fulcrum.yaafi.framework.context;
-
-/*
- * Copyright 2004 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.
- */
-
-import java.io.File;
-
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonFortressConstants;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonMerlinConstants;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonPhoenixConstants;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
-import org.apache.fulcrum.yaafi.framework.util.Validate;
-
-/**
- * Helper for converting Avalon Context of Fortress and Phoenix
- * container to a standard Merlin context.
- *
- * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
- */
-
-public class AvalonToYaafiContextMapper
-{
-    /** The directory for storing temporary files */
-    private File tempRootDir;
-
-    /** Our default context */
-    private DefaultContext defaultContext;
-    
-    /** our defaul class loader */
-    private ClassLoader classLoader;
-
-    /**
-     * Constructor
-     *
-     * @param tempRootDir current temp directory
-     * @param context the existing context
-     */
-    public AvalonToYaafiContextMapper(
-        File tempRootDir,
-        Context context,
-        ClassLoader classLoader)
-    {
-        Validate.notNull( tempRootDir, "tempRootDir" );
-        Validate.notNull( context, "context" );
-        Validate.notNull( classLoader, "classLoader" );
-        
-        this.tempRootDir = tempRootDir;
-        this.classLoader = classLoader;
-        
-        // here we have to create a new DefaultContext since
-        // it contains service specific entries
-        
-        this.defaultContext = new DefaultContext( context );        
-    }
-
-    /**
-     * Map a Avalon context to the YAAFI (Merlin) incarnation whereas
-     * the following containers are supported
-     * <ul>
-     *   <li>merlin</li>
-     *   <li>fortress</li>
-     *   <li>phoenix</li>
-     * </ul>
-     *
-     * @param context the Avalon context to map
-     * @param from Avalon container identifier
-     * @return the mapped Avalon context
-     * @throws ContextException Accessing the context failed
-     */
-    public Context mapFrom( Context context, String from )
-        throws ContextException
-    {
-        Validate.notNull( context, "context" );
-        Validate.notEmpty( from, "from" );
-
-        if( AvalonPhoenixConstants.AVALON_CONTAINER_PHOENIX.equals(from) )
-        {
-            return mapFromPhoenix(context);
-
-        }
-        else if( AvalonFortressConstants.AVALON_CONTAINER_FORTESS.equals(from) )
-        {
-            return mapFromFortress(context);
-
-        }
-        else if( AvalonMerlinConstants.AVALON_CONTAINER_MERLIN.equals(from) )
-        {
-            return mapFromMerlin(context);
-        }
-        else if( AvalonYaafiConstants.AVALON_CONTAINER_YAAFI.equals(from) )
-        {
-            return mapFromMerlin(context);
-        }
-        else
-        {
-            String msg = "Don't know the following container type : " + from;
-            throw new IllegalArgumentException(msg);
-        }
-    }
-
-    /**
-     * Map a Avalon Phoenix context to the YAAFI (Merlin) incarnation
-     *
-     * @param context the Avalon context to map
-     * @return the mapped Avalon context
-     * @throws ContextException Accessing the context failed
-     */
-    private Context mapFromPhoenix(Context context)
-        throws ContextException
-    {
-        DefaultContext result = this.getDefaultContext();
-
-        String urnAvalonName = AvalonYaafiConstants.AVALON_CONTAINER_YAAFI;
-        String urnAvalonPartition = (String) context.get( AvalonPhoenixConstants.PHOENIX_APP_NAME );
-        File urnAvalonHome = (File) context.get( AvalonPhoenixConstants.PHOENIX_APP_HOME );
-        File urnAvalonTemp = this.getTempRootDir();
-
-        // add the Merlin specific parameters
-        
-        result.put( AvalonYaafiConstants.URN_AVALON_NAME, urnAvalonName );
-        result.put( AvalonYaafiConstants.URN_AVALON_PARTITION, urnAvalonPartition );
-        result.put( AvalonYaafiConstants.URN_AVALON_HOME, urnAvalonHome );
-        result.put( AvalonYaafiConstants.URN_AVALON_TEMP, urnAvalonTemp );
-        result.put( AvalonYaafiConstants.URN_AVALON_CLASSLOADER, this.getClassLoader() );
-
-        // add the deprecated ECM parameter
-        
-        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT, urnAvalonHome.getAbsolutePath());
-
-        // add the Fortress specific parameters
-
-        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_ID,urnAvalonPartition);
-        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_LOGGER,urnAvalonName);
-        result.put(AvalonFortressConstants.FORTRESS_CONTEXT_ROOT,urnAvalonHome);
-        result.put(AvalonFortressConstants.FORTRESS_IMPL_WORKDIR,urnAvalonTemp);
-
-        return result;
-    }
-
-    /**
-     * Map a Avalon Fortress context to the YAAFI (Merlin) incarnation
-     *
-     * @param context the Avalon context to map
-     * @return the mapped Avalon context
-     * @throws ContextException Accessing the context failed
-     */
-    private Context mapFromFortress(Context context)
-        throws ContextException
-    {
-        DefaultContext result = this.getDefaultContext();
-
-        String urnAvalonPartition = (String) context.get( AvalonFortressConstants.FORTRESS_COMPONENT_ID );
-        File urnAvalonHome = (File) context.get( AvalonFortressConstants.FORTRESS_CONTEXT_ROOT );
-        File urnAvalonTemp = (File) context.get( AvalonFortressConstants.FORTRESS_IMPL_WORKDIR );
-
-        // add the Merlin specific parameters
-        
-        result.put( AvalonYaafiConstants.URN_AVALON_NAME, AvalonYaafiConstants.AVALON_CONTAINER_YAAFI );
-        result.put( AvalonYaafiConstants.URN_AVALON_PARTITION, urnAvalonPartition );
-        result.put( AvalonYaafiConstants.URN_AVALON_HOME, urnAvalonHome );
-        result.put( AvalonYaafiConstants.URN_AVALON_TEMP, urnAvalonTemp );
-        result.put( AvalonYaafiConstants.URN_AVALON_CLASSLOADER, this.getClassLoader() );
-
-        // add the deprecated ECM parameter
-        
-        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT, urnAvalonHome.getAbsolutePath());
-
-
-        return result;
-    }
-
-    /**
-     * Map a Avalon Merlin context to the YAAFI (Merlin) incarnation
-     *
-     * @param context the Avalon context to map
-     * @return the mapped Avalon context
-     * @throws ContextException Accessing the context failed
-     */
-    private Context mapFromMerlin(Context context)
-        throws ContextException
-    {
-        DefaultContext result = this.getDefaultContext();
-
-        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
-        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
-        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
-        String urnAvalonName = (String) (String) context.get(AvalonYaafiConstants.URN_AVALON_NAME);
-
-        // add the Fortress specific parameters
-
-        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_ID,urnAvalonPartition);
-        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_LOGGER,urnAvalonName);
-        result.put(AvalonFortressConstants.FORTRESS_CONTEXT_ROOT,urnAvalonHome);
-        result.put(AvalonFortressConstants.FORTRESS_IMPL_WORKDIR,urnAvalonTemp);
-
-        // add the deprecated ECM parameter
-        
-        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT, urnAvalonHome.getAbsolutePath());
-
-        return result;
-
-    }
-
-    /**
-     * @return Returns the classLoader.
-     */
-    private ClassLoader getClassLoader()
-    {
-        return this.classLoader;
-    }
-    
-    /**
-     * @return Returns the defaultContext.
-     */
-    private DefaultContext getDefaultContext()
-    {
-        return this.defaultContext;
-    }
-    
-    /**
-     * @return Returns the tempRootDir.
-     */
-    private File getTempRootDir()
-    {
-        return this.tempRootDir;
-    }    
-}
\ No newline at end of file
+package org.apache.fulcrum.yaafi.framework.context;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.File;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonFortressConstants;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonMerlinConstants;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonPhoenixConstants;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
+import org.apache.fulcrum.yaafi.framework.util.Validate;
+
+/**
+ * Helper for converting Avalon Context of Fortress and Phoenix
+ * container to a standard Merlin context.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class AvalonToYaafiContextMapper
+{
+    /** The directory for storing temporary files */
+    private File tempRootDir;
+
+    /** Our default context */
+    private DefaultContext defaultContext;
+
+    /** our defaul class loader */
+    private ClassLoader classLoader;
+
+    /**
+     * Constructor
+     *
+     * @param tempRootDir current temp directory
+     * @param context the existing context
+     */
+    public AvalonToYaafiContextMapper(
+        File tempRootDir,
+        Context context,
+        ClassLoader classLoader)
+    {
+        Validate.notNull( tempRootDir, "tempRootDir" );
+        Validate.notNull( context, "context" );
+        Validate.notNull( classLoader, "classLoader" );
+
+        this.tempRootDir = tempRootDir;
+        this.classLoader = classLoader;
+
+        // here we have to create a new DefaultContext since
+        // it contains service specific entries
+
+        this.defaultContext = new DefaultContext( context );
+    }
+
+    /**
+     * Map a Avalon context to the YAAFI (Merlin) incarnation whereas
+     * the following containers are supported
+     * <ul>
+     *   <li>merlin</li>
+     *   <li>fortress</li>
+     *   <li>phoenix</li>
+     * </ul>
+     *
+     * @param context the Avalon context to map
+     * @param from Avalon container identifier
+     * @return the mapped Avalon context
+     * @throws ContextException Accessing the context failed
+     */
+    public Context mapFrom( Context context, String from )
+        throws ContextException
+    {
+        Validate.notNull( context, "context" );
+        Validate.notEmpty( from, "from" );
+
+        if( AvalonPhoenixConstants.AVALON_CONTAINER_PHOENIX.equals(from) )
+        {
+            return mapFromPhoenix(context);
+
+        }
+        else if( AvalonFortressConstants.AVALON_CONTAINER_FORTESS.equals(from) )
+        {
+            return mapFromFortress(context);
+
+        }
+        else if( AvalonMerlinConstants.AVALON_CONTAINER_MERLIN.equals(from) )
+        {
+            return mapFromMerlin(context);
+        }
+        else if( AvalonYaafiConstants.AVALON_CONTAINER_YAAFI.equals(from) )
+        {
+            return mapFromMerlin(context);
+        }
+        else
+        {
+            String msg = "Don't know the following container type : " + from;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Map a Avalon Phoenix context to the YAAFI (Merlin) incarnation
+     *
+     * @param context the Avalon context to map
+     * @return the mapped Avalon context
+     * @throws ContextException Accessing the context failed
+     */
+    private Context mapFromPhoenix(Context context)
+        throws ContextException
+    {
+        DefaultContext result = this.getDefaultContext();
+
+        String urnAvalonName = AvalonYaafiConstants.AVALON_CONTAINER_YAAFI;
+        String urnAvalonPartition = (String) context.get( AvalonPhoenixConstants.PHOENIX_APP_NAME );
+        File urnAvalonHome = (File) context.get( AvalonPhoenixConstants.PHOENIX_APP_HOME );
+        File urnAvalonTemp = this.getTempRootDir();
+
+        // add the Merlin specific parameters
+
+        result.put( AvalonYaafiConstants.URN_AVALON_NAME, urnAvalonName );
+        result.put( AvalonYaafiConstants.URN_AVALON_PARTITION, urnAvalonPartition );
+        result.put( AvalonYaafiConstants.URN_AVALON_HOME, urnAvalonHome );
+        result.put( AvalonYaafiConstants.URN_AVALON_TEMP, urnAvalonTemp );
+        result.put( AvalonYaafiConstants.URN_AVALON_CLASSLOADER, this.getClassLoader() );
+
+        // add the deprecated ECM parameter
+
+        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT, urnAvalonHome.getAbsolutePath());
+
+        // add the Fortress specific parameters
+
+        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_ID,urnAvalonPartition);
+        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_LOGGER,urnAvalonName);
+        result.put(AvalonFortressConstants.FORTRESS_CONTEXT_ROOT,urnAvalonHome);
+        result.put(AvalonFortressConstants.FORTRESS_IMPL_WORKDIR,urnAvalonTemp);
+
+        return result;
+    }
+
+    /**
+     * Map a Avalon Fortress context to the YAAFI (Merlin) incarnation
+     *
+     * @param context the Avalon context to map
+     * @return the mapped Avalon context
+     * @throws ContextException Accessing the context failed
+     */
+    private Context mapFromFortress(Context context)
+        throws ContextException
+    {
+        DefaultContext result = this.getDefaultContext();
+
+        String urnAvalonPartition = (String) context.get( AvalonFortressConstants.FORTRESS_COMPONENT_ID );
+        File urnAvalonHome = (File) context.get( AvalonFortressConstants.FORTRESS_CONTEXT_ROOT );
+        File urnAvalonTemp = (File) context.get( AvalonFortressConstants.FORTRESS_IMPL_WORKDIR );
+
+        // add the Merlin specific parameters
+
+        result.put( AvalonYaafiConstants.URN_AVALON_NAME, AvalonYaafiConstants.AVALON_CONTAINER_YAAFI );
+        result.put( AvalonYaafiConstants.URN_AVALON_PARTITION, urnAvalonPartition );
+        result.put( AvalonYaafiConstants.URN_AVALON_HOME, urnAvalonHome );
+        result.put( AvalonYaafiConstants.URN_AVALON_TEMP, urnAvalonTemp );
+        result.put( AvalonYaafiConstants.URN_AVALON_CLASSLOADER, this.getClassLoader() );
+
+        // add the deprecated ECM parameter
+
+        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT, urnAvalonHome.getAbsolutePath());
+
+
+        return result;
+    }
+
+    /**
+     * Map a Avalon Merlin context to the YAAFI (Merlin) incarnation
+     *
+     * @param context the Avalon context to map
+     * @return the mapped Avalon context
+     * @throws ContextException Accessing the context failed
+     */
+    private Context mapFromMerlin(Context context)
+        throws ContextException
+    {
+        DefaultContext result = this.getDefaultContext();
+
+        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
+        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
+        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
+        String urnAvalonName = (String) (String) context.get(AvalonYaafiConstants.URN_AVALON_NAME);
+
+        // add the Fortress specific parameters
+
+        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_ID,urnAvalonPartition);
+        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_LOGGER,urnAvalonName);
+        result.put(AvalonFortressConstants.FORTRESS_CONTEXT_ROOT,urnAvalonHome);
+        result.put(AvalonFortressConstants.FORTRESS_IMPL_WORKDIR,urnAvalonTemp);
+
+        // add the deprecated ECM parameter
+
+        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT, urnAvalonHome.getAbsolutePath());
+
+        return result;
+
+    }
+
+    /**
+     * @return Returns the classLoader.
+     */
+    private ClassLoader getClassLoader()
+    {
+        return this.classLoader;
+    }
+
+    /**
+     * @return Returns the defaultContext.
+     */
+    private DefaultContext getDefaultContext()
+    {
+        return this.defaultContext;
+    }
+
+    /**
+     * @return Returns the tempRootDir.
+     */
+    private File getTempRootDir()
+    {
+        return this.tempRootDir;
+    }
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/YaafiToAvalonContextMapper.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/YaafiToAvalonContextMapper.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/YaafiToAvalonContextMapper.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/context/YaafiToAvalonContextMapper.java Fri May  4 23:58:06 2007
@@ -1,226 +1,228 @@
-package org.apache.fulcrum.yaafi.framework.context;
-
-/*
- * Copyright 2004 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.
- */
-
-import java.io.File;
-
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonFortressConstants;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonMerlinConstants;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonPhoenixConstants;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
-import org.apache.fulcrum.yaafi.framework.util.Validate;
-
-/**
- * Helper for converting a YAAFI context to a different container
- *
- * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
- */
-
-public class YaafiToAvalonContextMapper
-{
-    /** the name of the component for which we create the context */
-    private String urnAvalonName;
-
-    /** the classloader of the component */
-    private ClassLoader urnAvalonClassLoader;
-
-    /**
-     * Constructor
-     *
-     * @param urnAvalonName the name of the component for which we create the context
-     * @param urnAvalonClassLoader the classloader of the component
-     */
-    public YaafiToAvalonContextMapper( String urnAvalonName, ClassLoader urnAvalonClassLoader )
-    {
-        Validate.notEmpty( urnAvalonName, "urnAvalonName" );
-        Validate.notNull( urnAvalonClassLoader, "urnAvalonClassLoader" );
-
-        this.urnAvalonName = urnAvalonName;
-        this.urnAvalonClassLoader = urnAvalonClassLoader;
-    }
-
-    /**
-     * @return Returns the urnAvalonClassLoader.
-     */
-    public ClassLoader getUrnAvalonClassLoader()
-    {
-        return urnAvalonClassLoader;
-    }
-
-    /**
-     * @return Returns the urnAvalonName.
-     */
-    public String getUrnAvalonName()
-    {
-        return urnAvalonName;
-    }
-
-    /**
-     * Map a YAAFI (Merlin) context to a different incarnation
-     *
-     * @param context the context to be mapped
-     * @param to the target Avalon container
-     * @return the mapped context
-     * @throws ContextException accessing the context failed
-     */
-    public DefaultContext mapTo( Context context, String to )
-        throws ContextException
-    {
-        Validate.notNull( context, "context" );
-        Validate.notEmpty( to, "to" );
-
-        if( AvalonPhoenixConstants.AVALON_CONTAINER_PHOENIX.equals(to) )
-        {
-            return mapToPhoenix(context);
-
-        }
-        else if( AvalonFortressConstants.AVALON_CONTAINER_FORTESS.equals(to) )
-        {
-            return mapToFortress(context);
-
-        }
-        else if( AvalonMerlinConstants.AVALON_CONTAINER_MERLIN.equals(to) )
-        {
-            return mapToMerlin(context);
-        }
-        else if( AvalonYaafiConstants.AVALON_CONTAINER_YAAFI.equals(to) )
-        {
-            return mapToYaafi(context);
-        }
-        else
-        {
-            String msg = "Don't know the following container type : " + to;
-            throw new IllegalArgumentException(msg);
-        }
-    }
-
-    /**
-     * Map to a Phoenix context
-     *
-     * @param context the original context
-     * @return the mapped context
-     * @throws ContextException accessing the context failed
-     */
-    private DefaultContext mapToPhoenix( Context context )
-        throws ContextException
-    {
-        DefaultContext result = createDefaultContext(context);
-
-        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
-        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
-        String urnAvalonName = this.getUrnAvalonName();
-
-        result.put(AvalonPhoenixConstants.PHOENIX_APP_NAME,urnAvalonPartition);
-        result.put(AvalonPhoenixConstants.PHOENIX_APP_HOME,urnAvalonHome);
-        result.put(AvalonPhoenixConstants.PHOENIX_BLOCK_NAME,urnAvalonName);
-
-        return result;
-    }
-
-    /**
-     * Map to a Fortress context
-     *
-     * @param context the original context
-     * @return the mapped context
-     * @throws ContextException accessing the context failed
-     */
-    private DefaultContext mapToFortress( Context context )
-        throws ContextException
-    {
-        DefaultContext result = createDefaultContext(context);
-
-        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
-        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
-        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
-        String urnAvalonName = this.getUrnAvalonName();
-
-        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_ID,urnAvalonPartition);
-        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_LOGGER,urnAvalonName);
-        result.put(AvalonFortressConstants.FORTRESS_CONTEXT_ROOT,urnAvalonHome);
-        result.put(AvalonFortressConstants.FORTRESS_IMPL_WORKDIR,urnAvalonTemp);
-
-        return result;
-    }
-
-    /**
-     * Map to a Merlin context. Actually there is nothing to do but
-     * we do the full monty to ensure that context mannipulation wirks.
-     *
-     * @param context the original context
-     * @return the mapped context
-     * @throws ContextException accessing the context failed
-     */
-    private DefaultContext mapToMerlin( Context context )
-        throws ContextException
-    {
-        DefaultContext result = createDefaultContext(context);
-
-        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
-        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
-        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
-        String urnAvalonName = this.getUrnAvalonName();
-        ClassLoader urnAvalonClossLoader = this.getUrnAvalonClassLoader();
-
-        result.put(AvalonMerlinConstants.URN_AVALON_PARTITION,urnAvalonPartition);
-        result.put(AvalonMerlinConstants.URN_AVALON_NAME,urnAvalonName);
-        result.put(AvalonMerlinConstants.URN_AVALON_HOME,urnAvalonHome);
-        result.put(AvalonMerlinConstants.URN_AVALON_TEMP,urnAvalonTemp);
-        result.put(AvalonMerlinConstants.URN_AVALON_CLASSLOADER,urnAvalonClossLoader);
-
-        return result;
-    }
-
-    /**
-     * Map to a YAAFI context.
-     *
-     * @param context the original context
-     * @return the mapped context
-     * @throws ContextException accessing the context failed
-     */
-    private DefaultContext mapToYaafi( Context context )
-        throws ContextException
-    {
-        DefaultContext result = createDefaultContext(context);
-
-        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
-        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
-        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
-        String urnAvalonName = this.getUrnAvalonName();
-        ClassLoader urnAvalonClossLoader = this.getUrnAvalonClassLoader();
-
-        result.put(AvalonYaafiConstants.URN_AVALON_PARTITION,urnAvalonPartition);
-        result.put(AvalonYaafiConstants.URN_AVALON_NAME,urnAvalonName);
-        result.put(AvalonYaafiConstants.URN_AVALON_HOME,urnAvalonHome);
-        result.put(AvalonYaafiConstants.URN_AVALON_TEMP,urnAvalonTemp);
-        result.put(AvalonYaafiConstants.URN_AVALON_CLASSLOADER,urnAvalonClossLoader);
-        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT,urnAvalonHome.getAbsolutePath());
-
-        return result;
-    }
-
-    /**
-     * Create a context to work with
-     */
-    private DefaultContext createDefaultContext(Context context)
-    {
-        return new DefaultContext(context);
-    }
-}
\ No newline at end of file
+package org.apache.fulcrum.yaafi.framework.context;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.File;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonFortressConstants;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonMerlinConstants;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonPhoenixConstants;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
+import org.apache.fulcrum.yaafi.framework.util.Validate;
+
+/**
+ * Helper for converting a YAAFI context to a different container
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class YaafiToAvalonContextMapper
+{
+    /** the name of the component for which we create the context */
+    private String urnAvalonName;
+
+    /** the classloader of the component */
+    private ClassLoader urnAvalonClassLoader;
+
+    /**
+     * Constructor
+     *
+     * @param urnAvalonName the name of the component for which we create the context
+     * @param urnAvalonClassLoader the classloader of the component
+     */
+    public YaafiToAvalonContextMapper( String urnAvalonName, ClassLoader urnAvalonClassLoader )
+    {
+        Validate.notEmpty( urnAvalonName, "urnAvalonName" );
+        Validate.notNull( urnAvalonClassLoader, "urnAvalonClassLoader" );
+
+        this.urnAvalonName = urnAvalonName;
+        this.urnAvalonClassLoader = urnAvalonClassLoader;
+    }
+
+    /**
+     * @return Returns the urnAvalonClassLoader.
+     */
+    public ClassLoader getUrnAvalonClassLoader()
+    {
+        return urnAvalonClassLoader;
+    }
+
+    /**
+     * @return Returns the urnAvalonName.
+     */
+    public String getUrnAvalonName()
+    {
+        return urnAvalonName;
+    }
+
+    /**
+     * Map a YAAFI (Merlin) context to a different incarnation
+     *
+     * @param context the context to be mapped
+     * @param to the target Avalon container
+     * @return the mapped context
+     * @throws ContextException accessing the context failed
+     */
+    public DefaultContext mapTo( Context context, String to )
+        throws ContextException
+    {
+        Validate.notNull( context, "context" );
+        Validate.notEmpty( to, "to" );
+
+        if( AvalonPhoenixConstants.AVALON_CONTAINER_PHOENIX.equals(to) )
+        {
+            return mapToPhoenix(context);
+
+        }
+        else if( AvalonFortressConstants.AVALON_CONTAINER_FORTESS.equals(to) )
+        {
+            return mapToFortress(context);
+
+        }
+        else if( AvalonMerlinConstants.AVALON_CONTAINER_MERLIN.equals(to) )
+        {
+            return mapToMerlin(context);
+        }
+        else if( AvalonYaafiConstants.AVALON_CONTAINER_YAAFI.equals(to) )
+        {
+            return mapToYaafi(context);
+        }
+        else
+        {
+            String msg = "Don't know the following container type : " + to;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Map to a Phoenix context
+     *
+     * @param context the original context
+     * @return the mapped context
+     * @throws ContextException accessing the context failed
+     */
+    private DefaultContext mapToPhoenix( Context context )
+        throws ContextException
+    {
+        DefaultContext result = createDefaultContext(context);
+
+        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
+        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
+        String urnAvalonName = this.getUrnAvalonName();
+
+        result.put(AvalonPhoenixConstants.PHOENIX_APP_NAME,urnAvalonPartition);
+        result.put(AvalonPhoenixConstants.PHOENIX_APP_HOME,urnAvalonHome);
+        result.put(AvalonPhoenixConstants.PHOENIX_BLOCK_NAME,urnAvalonName);
+
+        return result;
+    }
+
+    /**
+     * Map to a Fortress context
+     *
+     * @param context the original context
+     * @return the mapped context
+     * @throws ContextException accessing the context failed
+     */
+    private DefaultContext mapToFortress( Context context )
+        throws ContextException
+    {
+        DefaultContext result = createDefaultContext(context);
+
+        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
+        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
+        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
+        String urnAvalonName = this.getUrnAvalonName();
+
+        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_ID,urnAvalonPartition);
+        result.put(AvalonFortressConstants.FORTRESS_COMPONENT_LOGGER,urnAvalonName);
+        result.put(AvalonFortressConstants.FORTRESS_CONTEXT_ROOT,urnAvalonHome);
+        result.put(AvalonFortressConstants.FORTRESS_IMPL_WORKDIR,urnAvalonTemp);
+
+        return result;
+    }
+
+    /**
+     * Map to a Merlin context. Actually there is nothing to do but
+     * we do the full monty to ensure that context mannipulation wirks.
+     *
+     * @param context the original context
+     * @return the mapped context
+     * @throws ContextException accessing the context failed
+     */
+    private DefaultContext mapToMerlin( Context context )
+        throws ContextException
+    {
+        DefaultContext result = createDefaultContext(context);
+
+        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
+        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
+        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
+        String urnAvalonName = this.getUrnAvalonName();
+        ClassLoader urnAvalonClossLoader = this.getUrnAvalonClassLoader();
+
+        result.put(AvalonMerlinConstants.URN_AVALON_PARTITION,urnAvalonPartition);
+        result.put(AvalonMerlinConstants.URN_AVALON_NAME,urnAvalonName);
+        result.put(AvalonMerlinConstants.URN_AVALON_HOME,urnAvalonHome);
+        result.put(AvalonMerlinConstants.URN_AVALON_TEMP,urnAvalonTemp);
+        result.put(AvalonMerlinConstants.URN_AVALON_CLASSLOADER,urnAvalonClossLoader);
+
+        return result;
+    }
+
+    /**
+     * Map to a YAAFI context.
+     *
+     * @param context the original context
+     * @return the mapped context
+     * @throws ContextException accessing the context failed
+     */
+    private DefaultContext mapToYaafi( Context context )
+        throws ContextException
+    {
+        DefaultContext result = createDefaultContext(context);
+
+        String urnAvalonPartition = (String) context.get(AvalonYaafiConstants.URN_AVALON_PARTITION);
+        File urnAvalonHome = (File) context.get(AvalonYaafiConstants.URN_AVALON_HOME);
+        File urnAvalonTemp = (File) context.get(AvalonYaafiConstants.URN_AVALON_TEMP);
+        String urnAvalonName = this.getUrnAvalonName();
+        ClassLoader urnAvalonClossLoader = this.getUrnAvalonClassLoader();
+
+        result.put(AvalonYaafiConstants.URN_AVALON_PARTITION,urnAvalonPartition);
+        result.put(AvalonYaafiConstants.URN_AVALON_NAME,urnAvalonName);
+        result.put(AvalonYaafiConstants.URN_AVALON_HOME,urnAvalonHome);
+        result.put(AvalonYaafiConstants.URN_AVALON_TEMP,urnAvalonTemp);
+        result.put(AvalonYaafiConstants.URN_AVALON_CLASSLOADER,urnAvalonClossLoader);
+        result.put(AvalonYaafiConstants.COMPONENT_APP_ROOT,urnAvalonHome.getAbsolutePath());
+
+        return result;
+    }
+
+    /**
+     * Create a context to work with
+     */
+    private DefaultContext createDefaultContext(Context context)
+    {
+        return new DefaultContext(context);
+    }
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.factory;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 import java.io.File;

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerFactory.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerFactory.java?view=diff&rev=535465&r1=535464&r2=535465
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerFactory.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerFactory.java Fri May  4 23:58:06 2007
@@ -1,20 +1,22 @@
 package org.apache.fulcrum.yaafi.framework.factory;
 
 /*
- * Copyright 2004 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ * 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.
  */
 
 import org.apache.avalon.framework.configuration.Configuration;
@@ -127,7 +129,7 @@
 
     /**
      * Disposes the container.
-     * 
+     *
      * @param container the container to be disposed
      * @return true if the disposal was successful or false otherwise
      */
@@ -170,4 +172,4 @@
         }
     }
 
-}
\ No newline at end of file
+}



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