public void generate(int mode, Dictionary props) throws Exception {
		zclRootPackage = (String) props.get(OPT_ZCL_CLASSES_PACKAGE_NAME);
		interfacesPackageName = (String) props.get(OPT_INTERFACES_PACKAGE_NAME);
		outputPath = (String) props.get(OPT_OUTPUT_DIR);
		clusters = (List) props.get(OPT_CLUSTER_NAME);
		Boolean generateRecords = (Boolean) props.get("it.telecomitalia.ah.zigbee.zcl.generator.generateRecords");
		Boolean generateProxyClasses = (Boolean) props.get(OPT_GENERATE_PROXY_CLASSES);

		if (generateRecords != null) {
			this.generateRecords = generateRecords.booleanValue();
		}

		if (generateProxyClasses != null) {
			this.generateProxyClasses = generateProxyClasses.booleanValue();
		}

		if (this.zclClusters == null) {
			throw new Exception("no parsed Cluster to generate. Call parse() first");
		}

		this.mode = mode;
		jModel = new JCodeModel();

		// commonly referenced classes
		zbDeviceClass = jModel.ref(ZigBeeDevice.class);
		jZclValidationException = jModel.ref(ZclValidationException.class);
		jIZclAttributeDescription = jModel.ref(IZclAttributeDescriptor.class);

		try {
			buildCodeModel(zclClusters);
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		if (jModel != null) {
			// generates the code of the previous cluster
			dumpCodeModel(jModel);
		}
	}