Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * OfficeFloor - http://www.officefloor.net
   * Copyright (C) 2005-2011 Daniel Sagenschneider
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package net.officefloor.compile;
 
 import java.util.Map;
 

Office Floor compiler to compile the net.officefloor.frame.api.manage.OfficeFloor into the net.officefloor.frame.api.OfficeFrame to be built.

This is the starting point to use the compiler.

Author(s):
Daniel Sagenschneider
 
 public abstract class OfficeFloorCompiler {

java.lang.System.getProperty(java.lang.String) that allows specifying the OfficeFloorCompiler implementation java.lang.Class.

Should this not be specified the default net.officefloor.compile.impl.OfficeFloorCompilerImpl will be used.

Note: it is anticipated that net.officefloor.compile.impl.OfficeFloorCompilerImpl will always be used.

 
 	public static final String IMPLEMENTATION_CLASS_PROPERTY_NAME = "net.officefloor.compiler.implementation";

Factory to create the OfficeFloorCompiler.

This enables overriding the default behaviour in creating an OfficeFloorCompiler instances.

 
 	public static interface OfficeFloorCompilerFactory {

 
 	}

 
 	private static OfficeFloorCompilerFactory FACTORY = null;

Specifies the OfficeFloorCompiler.OfficeFloorCompilerFactory. Allows for overriding the default behaviour in creating an OfficeFloorCompiler.

Typically this should not be called however is included to enable flexibility in creating OfficeFloorCompiler instances.

	public synchronized static final void setFactory(
		// Ensure not already specified
		if ( != null) {
" has already been specified");
		}
		// Specify office floor compiler factory
		 = factory;
	}

Creates a new instance of a OfficeFloorCompiler.

Returns:
New OfficeFloorCompiler.
	public synchronized static final OfficeFloorCompiler newOfficeFloorCompiler() {
		// Determine if use factory
		if ( != null) {
			// Factory to create the office floor compiler
		}
		// Obtain the office floor compiler
		OfficeFloorCompiler compiler = null;
		// Determine if overriding the implementation
		String implementationClassName = System
		if (!CompileUtil.isBlank(implementationClassName)) {
			// Have override implementation, so use
			try {
				compiler = (OfficeFloorCompiler) Class.forName(
						implementationClassName).newInstance();
catch (Throwable ex) {
						"Can not create instance of " + implementationClassName
" from default constructor"ex);
			}
		}
		// Use default implementation if no override
		if (compiler == null) {
			compiler = new OfficeFloorCompilerImpl();
		}
		// Return the office floor compiler
		return compiler;
	}

	public static final PropertyList newPropertyList() {
		// Create the office floor compiler
		// Use the compiler to return a new property list
		return compiler.createPropertyList();
	}

	private ClassLoader classLoader = null;

		// Ensure have a class loader
		if (this. == null) {
		}
		// Return the class loader
		return this.;
	}

Overrides the default java.lang.ClassLoader to use in compiling the net.officefloor.frame.api.manage.OfficeFloor.

Parameters:
classLoader java.lang.ClassLoader.
	public void setClassLoader(ClassLoader classLoader) {
		this. = classLoader;
	}

	public void addSystemProperties() {
		Properties systemProperties = System.getProperties();
		for (String name : systemProperties.stringPropertyNames()) {
			String value = systemProperties.getProperty(name);
			this.addProperty(namevalue);
		}
	}

	public void addEnvProperties() {
		Map<StringStringenvProperties = System.getenv();
		for (String name : envProperties.keySet()) {
			String value = envProperties.get(name);
			this.addProperty(namevalue);
		}
	}

Adds the aliases for the source classes.
	public void addSourceAliases() {
		// Add the office source aliases from the class path
		for (OfficeSourceService<?> service : ServiceLoader.load(
		}
		// Add the section source aliases from the class path
		for (SectionSourceService<?> service : ServiceLoader.load(
		}
		// Add the work source aliases from the class path
		for (WorkSourceService<?, ?> service : ServiceLoader.load(
			this.addWorkSourceAlias(service.getWorkSourceAlias(), service
		}
		// Add the managed object source aliases from the class path
		for (ManagedObjectSourceService<?, ?, ?> service : ServiceLoader.load(
		}
		// Add the administrator source aliases from the class path
		for (AdministratorSourceService<?, ?, ?> service : ServiceLoader.load(
		}
		// Add the team source aliases from the class path
		for (TeamSourceService<?> service : ServiceLoader.load(
			this.addTeamSourceAlias(service.getTeamSourceAlias(), service
		}
	}
	/*
	 * ======= Methods to be implemented by the OfficeFloorCompiler ===========
	 */

	public abstract void setConfigurationContext(
			ConfigurationContext configurationContext);

Overrides the default net.officefloor.compile.issues.CompilerIssues to use in compiling the net.officefloor.frame.api.manage.OfficeFloor.

Implementations of OfficeFloorCompiler must provide a default net.officefloor.compile.issues.CompilerIssues. Typically this will be an implementation that writes issues to java.lang.System.err.

	public abstract void setCompilerIssues(CompilerIssues issues);

	public abstract void setOfficeFrame(OfficeFrame officeFrame);

	public abstract <S extends OfficeFloorSourcevoid setOfficeFloorSourceClass(
			Class<S> officeFloorSourceClass);

	public abstract void addProperty(String nameString value);

Allows providing an alias name for an net.officefloor.compile.spi.office.source.OfficeSource.

This stops the configuration files from being littered with fully qualified class names of the net.officefloor.compile.spi.office.source.OfficeSource classes. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.

Typically this should not be used directly as the OfficeSourceService is the preferred means to provide net.officefloor.compile.spi.office.source.OfficeSource aliases.

	public abstract <S extends OfficeSourcevoid addOfficeSourceAlias(
			String aliasClass<S> officeSourceClass);

Allows providing an alias name for a net.officefloor.compile.spi.section.source.SectionSource.

This stops the configuration files from being littered with fully qualified class names of the net.officefloor.compile.spi.section.source.SectionSource classes. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.

Typically this should not be used directly as the SectionSourceService is the preferred means to provide net.officefloor.compile.spi.section.source.SectionSource aliases.

	public abstract <S extends SectionSourcevoid addSectionSourceAlias(
			String aliasClass<S> sectionSourceClass);

Allows providing an alias name for a net.officefloor.compile.spi.work.source.WorkSource.

This stops the configuration files from being littered with fully qualified class names of the net.officefloor.compile.spi.work.source.WorkSource classes. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.

Typically this should not be used directly as the WorkSourceService is the preferred means to provide net.officefloor.compile.spi.work.source.WorkSource aliases.

	public abstract <W extends Work, S extends WorkSource<W>> void addWorkSourceAlias(
			String aliasClass<S> workSourceClass);

Allows providing an alias name for a net.officefloor.frame.spi.managedobject.source.ManagedObjectSource.

This stops the configuration files from being littered with fully qualified class names of the net.officefloor.frame.spi.managedobject.source.ManagedObjectSource classes. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.

Typically this should not be used directly as the ManagedObjectSourceService is the preferred means to provide net.officefloor.frame.spi.managedobject.source.ManagedObjectSource aliases.

	public abstract <D extends Enum<D>, F extends Enum<F>, S extends ManagedObjectSource<D, F>> void addManagedObjectSourceAlias(
			String aliasClass<S> managedObjectSourceClass);

Allows providing an alias name for a net.officefloor.frame.spi.administration.source.AdministratorSource.

This stops the configuration files from being littered with fully qualified class names of the net.officefloor.frame.spi.administration.source.AdministratorSource classes. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.

Typically this should not be used directly as the AdministratorSourceService is the preferred means to provide net.officefloor.frame.spi.administration.source.AdministratorSource aliases.

	public abstract <I, A extends Enum<A>, S extends AdministratorSource<I, A>> void addAdministratorSourceAlias(
			String aliasClass<S> administratorSourceClass);

Allows providing an alias name for a net.officefloor.frame.spi.team.source.TeamSource.

This stops the configuration files from being littered with fully qualified class names of the net.officefloor.frame.spi.team.source.TeamSource classes. This is anticipated to allow flexibility as the functionality evolves so that relocating/renaming classes does not require significant configuration changes.

Typically this should not be used directly as the TeamSourceService is the preferred means to provide net.officefloor.frame.spi.team.source.TeamSource aliases.

	public abstract <S extends TeamSourcevoid addTeamSourceAlias(
			String aliasClass<S> teamSourceClass);

	public abstract PropertyList createPropertyList();

	public abstract OfficeLoader getOfficeLoader();

	public abstract SectionLoader getSectionLoader();

	public abstract WorkLoader getWorkLoader();

	public abstract TeamLoader getTeamLoader();

Compiles and builds the net.officefloor.frame.api.manage.OfficeFloor.

Use this method in preference to net.officefloor.compile.officefloor.OfficeFloorLoader.

Parameters:
officeFloorLocation Location of the net.officefloor.frame.api.manage.OfficeFloor.
Returns:
net.officefloor.frame.api.manage.OfficeFloor or null if issues in compiling which are reported to the net.officefloor.compile.issues.CompilerIssues.
	public abstract OfficeFloor compile(String officeFloorLocation);
New to GrepCode? Check out our FAQ X