SSHandlerFactory.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * Initial developer(s): ____________________________________.
00022  * Contributor(s): ______________________________________.
00023  *
00024  * --------------------------------------------------------------------------
00025  * $Id: SSHandlerFactory.java,v 1.7 2004/05/17 07:22:36 durieuxp Exp $
00026  * --------------------------------------------------------------------------
00027  */
00028 
00029 package org.objectweb.security.propagation;
00030 
00031 import org.objectweb.jonathan.apis.kernel.Context;
00032 import org.objectweb.jonathan.apis.kernel.InternalException;
00033 import org.objectweb.jonathan.apis.kernel.JonathanException;
00034 import org.objectweb.jonathan.presentation.api.MarshallerFactory;
00035 import org.objectweb.jonathan.libs.kernel.GenericFactory;
00036 
00037 
00041 public class SSHandlerFactory extends GenericFactory {
00042 
00046     static public final String jonasss_context_name = "/jonas/security/SSHandler";
00047 
00064     protected Object[] getUsedComponents(Context c) {
00065       
00066         Object[] used_components = { 
00067             Context.NO_VALUE, Context.NO_VALUE, Context.NO_VALUE, Context.NO_VALUE 
00068         };
00069 
00070         if (c != null) {
00071             used_components[0] = c.getValue("id", (char) 0);
00072             used_components[1] = c.getValue("sender", (char) 0);
00073             used_components[2] = c.getValue("receiver", (char) 0);
00074             used_components[3] = c.getValue("MarshallerFactory", (char) 0);
00075         }
00076         if (! (used_components[0] instanceof Integer)) {
00077             used_components[0] = new Integer(Integer.MAX_VALUE);
00078         }
00079         if (! (used_components[1] instanceof SecuritySender)) {
00080             used_components[1] = null;
00081         }
00082         if (! (used_components[2] instanceof SecurityReceiver)) {
00083             used_components[2] = null;
00084         }
00085         if (! (used_components[3] instanceof MarshallerFactory)) {
00086             throw new InternalException("Component MarshallerFactory of type MarshallerFactory is required by SSHandler.");
00087         }
00088         return used_components;
00089     }
00090    
00100     protected Object newInstance(Context c, Object[] components) throws JonathanException {
00101         return new SSHandler(c, components);
00102     }
00103 }

Generated on Tue Feb 15 15:06:04 2005 for JOnAS by  doxygen 1.3.9.1