/*
* 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.
*/
//
/**
* @author Prashant Baliga <prabalig@in.ibm.com>
*
*/
package org.apache.imperius.spl.parser.statements.impl;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.imperius.spl.core.PolicyInfo;
import org.apache.imperius.spl.parser.compiler.symboltable.AnchorData;
import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
import org.apache.imperius.util.SPLLogger;
public class PolicyInfoImpl implements PolicyInfo {
private List importStmtList=null;
private static Logger logger = SPLLogger.getSPLLogger().getLogger();
private static String sourceClass = "PolicyInfoImpl";
public PolicyInfoImpl(List importStmtList){
this.importStmtList=importStmtList;
}
/* (non-Javadoc)
* @see org.apache.imperius.spl.parser.statements.impl.PolicyInfo#getClassQualifierMap()
*/
public Map getClassQualifierMap(){
logger.entering(sourceClass,Thread.currentThread().getName()+" "+"createInstance");
Map classQualifier=new HashMap();
Iterator it=importStmtList.iterator();
while(it.hasNext())
{
if(logger.isLoggable(Level.FINE))
logger.fine(Thread.currentThread().getName()+" 1Creating SPL Policy instance :"+importStmtList);
ImportStatement importStmt=(ImportStatement)it.next();
if(logger.isLoggable(Level.FINE))
logger.fine(Thread.currentThread().getName()+" 2Creating SPL Policy instance :"+importStmt);
SPLSymbolTable symtab=importStmt.getSymTab();
if(logger.isLoggable(Level.FINE))
logger.fine(Thread.currentThread().getName()+" 3Creating SPL Policy instance :"+symtab);
AnchorData anchor=symtab.getAnchorData();
if(logger.isLoggable(Level.FINE))
logger.fine(Thread.currentThread().getName()+" 4Creating SPL Policy instance :"+anchor);
List classes=anchor.getAnchorClassList();
if(logger.isLoggable(Level.FINE))
logger.fine(Thread.currentThread().getName()+" 5Creating SPL Policy instance :"+classes);
Iterator classIt=classes.iterator();
while(classIt.hasNext()){
String classname=(String)classIt.next();
String qualifier=anchor.getQualifierForClass(classname);
classQualifier.put(classname, qualifier);
}
}
logger.exiting(sourceClass,Thread.currentThread().getName()+" "+"createInstance");
return classQualifier;
}
}