
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcModel.*;

public class pfcModelExamples {

	public static Model retrieveModelFromStandardDir(BaseSession session, String modelname, ModelType type)
	{
		String stdpath = "/home/ptc/models/standard";
		ModelDescriptor descr;
		Model model;

		try {
			descr = pfcModel.ModelDescriptor_Create(type, modelname, null);
			descr.SetPath(stdpath);
		}
		catch (jxthrowable x) {
			System.out.println("Error in initializing model descriptor"+x);
			return (null);
		}

		try {
			model = session.RetrieveModel(descr);
		}
		catch (jxthrowable x) {
			printMsg("Exception in retrieveing model:"+x);
			return (null);
		}

		return (model);
	}

	public static void printMsg (String str) {
		System.out.println (str);
	}
}
