001: package org.jacorb.security.sas;
002:
003: /*
004: * JacORB - a free Java ORB
005: *
006: * Copyright (C) 2002-2004 Gerald Brose
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Library General Public License for more details.
017: *
018: * You should have received a copy of the GNU Library General Public
019: * License along with this library; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: */
022:
023: import org.apache.avalon.framework.configuration.ConfigurationException;
024: import org.apache.avalon.framework.logger.Logger;
025: import org.jacorb.orb.standardInterceptors.SASComponentInterceptor;
026: import org.jacorb.sasPolicy.ATLAS_POLICY_TYPE;
027: import org.jacorb.sasPolicy.SAS_POLICY_TYPE;
028: import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
029: import org.omg.PortableInterceptor.ORBInitInfo;
030: import org.omg.PortableInterceptor.ORBInitializer;
031: import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
032:
033: /**
034: * This initializes the SAS Target Security Service (TSS) Interceptor
035: *
036: * @author David Robison
037: * @version $Id: SASInitializer.java,v 1.6 2004/05/07 13:08:29 david.robison Exp $
038: */
039:
040: public class SASInitializer extends org.omg.CORBA.LocalObject implements
041: ORBInitializer {
042: private Logger logger = null;
043: public static final int SecurityAttributeService = 15;
044: public static int sasPrincipalNamePIC = (-1);
045:
046: /**
047: * This method registers the interceptors.
048: */
049: public void post_init(ORBInitInfo info) {
050: org.jacorb.orb.ORB orb = ((org.jacorb.orb.portableInterceptor.ORBInitInfoImpl) info)
051: .getORB();
052: logger = orb.getConfiguration().getNamedLogger(
053: "jacorb.security.SAS");
054:
055: // install the TSS interceptor
056: try {
057: sasPrincipalNamePIC = info.allocate_slot_id();
058: info
059: .add_server_request_interceptor(new SASTargetInterceptor(
060: info));
061: } catch (ConfigurationException ce) {
062: if (logger.isErrorEnabled())
063: logger.error("ConfigurationException", ce);
064: } catch (DuplicateName duplicateName) {
065: if (logger.isErrorEnabled())
066: logger.error("TSS DuplicateName", duplicateName);
067: } catch (UnknownEncoding unknownEncoding) {
068: if (logger.isErrorEnabled())
069: logger.error("TSS UnknownEncoding", unknownEncoding);
070: }
071:
072: // install the CSS interceptor
073: try {
074: info
075: .add_client_request_interceptor(new SASClientInterceptor(
076: info));
077: } catch (ConfigurationException ce) {
078: if (logger.isErrorEnabled())
079: logger.error("ConfigurationException", ce);
080: } catch (DuplicateName duplicateName) {
081: if (logger.isErrorEnabled())
082: logger.error("CSS DuplicateName", duplicateName);
083: } catch (UnknownEncoding unknownEncoding) {
084: if (logger.isErrorEnabled())
085: logger.error("CSS UnknownEncoding", unknownEncoding);
086: }
087:
088: // install IOR interceptor
089: try {
090: info.add_ior_interceptor(new SASComponentInterceptor(info));
091: } catch (DuplicateName duplicateName) {
092: if (logger.isErrorEnabled())
093: logger.error("IOR DuplicateName", duplicateName);
094: }
095:
096: // create policy factory
097: info.register_policy_factory(SAS_POLICY_TYPE.value,
098: new SASPolicyFactory());
099: info.register_policy_factory(ATLAS_POLICY_TYPE.value,
100: new ATLASPolicyFactory());
101: }
102:
103: public void pre_init(ORBInitInfo info) {
104: }
105: } // SAS setup Initializer
|