Code example for Logger

Methods: info, severe

0
		log.info("Prepared Namespace lookup tables: " + ns_provided);
	} 
	 
	public File getDocumentSchema(String version, boolean strictValidation) {
		if(!version.equalsIgnoreCase(ODF_v1_2) && strictValidation) {
			log.info("Strict Validation enabled!");
			if(version.equalsIgnoreCase(ODF_v1_0)) {
				log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): using Strict Schema file: " + schemaFiles.get(v10_STRICT_DOC_SCHEMA).getName());
				return schemaFiles.get(v10_STRICT_DOC_SCHEMA);
			} 
			if(version.equalsIgnoreCase(ODF_v1_1)) {
				log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): using Strict Schema file: " + schemaFiles.get(v11_STRICT_DOC_SCHEMA).getName());
				return schemaFiles.get(v11_STRICT_DOC_SCHEMA);
			} 
			if(version.equalsIgnoreCase(ODF_v1_2)) {
				log.info("Strict Validation not applicable for v1.2!");
				log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): using Schema file: " + schemaFiles.get(v12_DOC_SCHEMA).getName());
				return schemaFiles.get(v12_DOC_SCHEMA);
			} 
			log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): Could NOT retrieve Strict Schema file for this ODF version: " + version);
		} 
		else { 
			if(version.equalsIgnoreCase(ODF_v1_0)) {
				log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): using Schema file: " + schemaFiles.get(v10_DOC_SCHEMA).getName());
				return schemaFiles.get(v10_DOC_SCHEMA);
			} 
			if(version.equalsIgnoreCase(ODF_v1_1)) {
				log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): using Schema file: " + schemaFiles.get(v11_DOC_SCHEMA).getName());
				return schemaFiles.get(v11_DOC_SCHEMA);
			} 
			if(version.equalsIgnoreCase(ODF_v1_2)) {
				log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): using Schema file: " + schemaFiles.get(v12_DOC_SCHEMA).getName());
				return schemaFiles.get(v12_DOC_SCHEMA);
			} 
			log.info("[CoreOdfValidator] retrieveOdfDocSchemaFile(): Could NOT retrieve Schema file for this ODF version: " + version);
		} 
		return null; 
	} 
	 
	public File getMathMLSchema() {
		log.info("[OdfSchemaHandler] retrieveMathMLSchemaFile(): using MathML 2 Schema file: " + schemaFiles.get(MATHML2_SCHEMA).getName());
		return schemaFiles.get(MATHML2_SCHEMA);
	} 
	 
	public File getDsigSchema(String version) {
		return schemaFiles.get(v12_DSIG_SCHEMA);
	} 
	 
	public File getManifestSchema(String version) {
		if(version.equalsIgnoreCase(ODF_v1_0)) {
			log.info("[OdfSchemaHandler] retrieveOdfManifestSchemaFile(): using Manifest Schema file: " + schemaFiles.get(v10_MANIFEST_SCHEMA).getName());
			return schemaFiles.get(v10_MANIFEST_SCHEMA);
		} 
		if(version.equalsIgnoreCase(ODF_v1_1)) {
			log.info("[OdfSchemaHandler] retrieveOdfManifestSchemaFile(): using Manifest Schema file: " + schemaFiles.get(v11_MANIFEST_SCHEMA).getName());
			return schemaFiles.get(v11_MANIFEST_SCHEMA);
		} 
		if(version.equalsIgnoreCase(ODF_v1_2)) {
			log.info("[OdfSchemaHandler] retrieveOdfManifestSchemaFile(): using Manifest Schema file: " + schemaFiles.get(v12_MANIFEST_SCHEMA).getName());
			return schemaFiles.get(v12_MANIFEST_SCHEMA);
		} 
		log.info("[OdfSchemaHandler] retrieveOdfManifestSchemaFile(): Could NOT retrieve Manifest Schema for this version: " + version);
		return null; 
	} 
	 
	public File createUserDocSchema(String version, String schemaContent) {
		File userDocSchema = null;
		if(schemaContent.equalsIgnoreCase("")|| schemaContent==null) {
			log.warning("WARN: User schema not found! Received String is empty!");
			log.info("Trying to lookup DEFAULT doc-schema...");
			userDocSchema = getDocumentSchema(version, false);
		} 
		else { 
			try { 
                userDocSchema = File.createTempFile("userDocSchema",".rng");
                FileUtils.writeStringToFile(userDocSchema, schemaContent);
            } catch (IOException e) {
                e.printStackTrace();
            } 
		} 
		return userDocSchema;
	} 
	 
	 
	public File createUserDocSchemaFromUrl(String version, URL docSchemaURL) {
		File userDocSchema = null;
		try { 
			userDocSchema = File.createTempFile("userDocSchema",".rng");
			log.info("Reading content from URL (" + docSchemaURL.toString() + ")...please hang on!");
			FileUtils.copyURLToFile(docSchemaURL, userDocSchema);
		} catch (IOException e) {
			log.severe("ERROR: Could not open URL: " + docSchemaURL.toString() + "!");
			userDocSchema = getDocumentSchema(version, false);
		} 
		return userDocSchema;
	}