Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package org.jboss.identity.idm.integration.jboss5;
 
 import java.io.File;

Author(s):
Jeff Yu
	private static final Logger logger = Logger.getLogger(JAXB2IdentityDeployerConfiguration.class.getName());
	@SuppressWarnings({"unchecked"})
	public static JbossIDMDeployerType createDeployerConfiguration(InputStream inputStreamthrows Exception {
		if (inputStream == null) {
			throw new NullPointerException("deployer configuration is null");
		}
		JAXBElement<JbossIDMDeployerTypedeployerType = null;
		try {
	         JAXBContext jaxbContext = JAXBContext.newInstance("org.jboss.identity.idm.integration.jboss5.jaxb2");
	         Unmarshaller unMarshaller = jaxbContext.createUnmarshaller();
	         deployerType = (JAXBElement<JbossIDMDeployerType>)unMarshaller.unmarshal(inputStream);
	         
		}catch (JAXBException e) {
	         throw new IdentityConfigurationException("Cannot unmarshal idm deployer configuration: "e);
	      }
		if (deployerType != null) {
			return deployerType.getValue();
		}
		return null;
	}
	      if (file == null)
	      {
	         throw new NullPointerException("Identity deployer file is null");
	      }
	      
	      InputStream inputStream;
	      try
	      {
	         inputStream = new FileInputStream(file);
	      } catch (FileNotFoundException e)
	      {
	         throw new IllegalArgumentException("Identity deployer file "+file.getAbsolutePath()+" does not exist");
	      }
	      return createDeployerConfiguration(inputStream);
	}
	      ClassLoader classLoader = SecurityActions.getContextClassLoader();
	      InputStream inputStream = classLoader.getResourceAsStream(file);
	      if (inputStream == null)
	      {
	         throw new NullPointerException("Resource "+file+" does not exist");
	      }
	      return createDeployerConfiguration(inputStream);
	}
New to GrepCode? Check out our FAQ X