Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright 2014 Internet2
*
* 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.
*/
/*
* @author mchyzer
* $Id: SubjectCheckConfig.java,v 1.3 2009-03-22 02:49:27 mchyzer Exp $
*/
package edu.internet2.middleware.subject;
import java.net.URL;
import java.util.Collection;
import javax.naming.NameNotFoundException;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.internet2.middleware.grouper.app.gsh.GrouperShell;
import edu.internet2.middleware.grouper.cfg.GrouperConfig;
import edu.internet2.middleware.subject.provider.SourceManager;
/**
* make sure the subject.xml config is correct
*/
public class SubjectCheckConfig {
/** */
public static final String GROUPER_TEST_SUBJECT_BY_ID = "grouperTestSubjectByIdOnStartupASDFGHJ";
/** */
public static final String SUBJECT_ID_TO_FIND_ON_CHECK_CONFIG = "subjectIdToFindOnCheckConfig";
/** */
public static final String FIND_SUBJECT_BY_ID_ON_CHECK_CONFIG = "findSubjectByIdOnCheckConfig";
/** logger */
private static Log log = edu.internet2.middleware.grouper.util.GrouperUtil.getLog(SubjectCheckConfig.class);
/**
* make surce classpath file is there
* @param resourceName
* @return true if ok
*/
public static boolean checkConfig(String resourceName) {
boolean foundResource = false;
//first, there must be a subject.properties
try {
//get the url of the navigation file
ClassLoader cl = SubjectCheckConfig.class.getClassLoader();
URL url = cl.getResource(resourceName);
foundResource = url != null;
} catch (Exception e) {
//this means it cant be found
log.info("Exception looking for " + resourceName, e);
}
if (!foundResource) {
String error = "Cant find required resource on classpath: " + resourceName;
//this is serious, lets go out and error
System.err.println("Subject API error: " + error);
log.error(error);
}
return foundResource;
}
/**
* check the subject config
*/
public static void checkConfig() {
//at this point, we have a subject.properties... now check it out
Collection