001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.corba.security; 018 019 import java.io.Serializable; 020 021 import org.omg.CORBA.LocalObject; 022 import org.omg.CORBA.Policy; 023 024 import org.apache.geronimo.corba.security.config.tss.TSSConfig; 025 026 027 /** 028 * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ 029 */ 030 public class ServerPolicy extends LocalObject implements Policy { 031 032 private final TSSConfig TSSConfig; 033 private final ClassLoader classloader; 034 035 public ServerPolicy(Config config) { 036 this.TSSConfig = config.getTSSConfig(); 037 this.classloader = config.getClassloader(); 038 } 039 040 protected ServerPolicy(TSSConfig config, ClassLoader classLoader) { 041 this.TSSConfig = config; 042 this.classloader = classLoader; 043 } 044 045 public TSSConfig getConfig() { 046 return TSSConfig; 047 } 048 049 public ClassLoader getClassloader() { 050 return classloader; 051 } 052 053 public int policy_type() { 054 return ServerPolicyFactory.POLICY_TYPE; 055 } 056 057 public void destroy() { 058 } 059 060 public Policy copy() { 061 return new ServerPolicy(TSSConfig, classloader); 062 } 063 064 public static class Config implements Serializable { 065 private final TSSConfig TSSConfig; 066 private final transient ClassLoader classloader; 067 068 public Config(TSSConfig TSSConfig, ClassLoader classloader) { 069 this.TSSConfig = TSSConfig; 070 this.classloader = classloader; 071 } 072 073 public final TSSConfig getTSSConfig() { 074 return TSSConfig; 075 } 076 077 public final ClassLoader getClassloader() { 078 return classloader; 079 } 080 } 081 }