package org.concord.otrunk;

import java.net.URL;

import org.concord.framework.otrunk.DefaultOTObject;
import org.concord.framework.otrunk.OTObject;
import org.concord.framework.otrunk.OTResourceSchema;
import org.concord.framework.otrunk.OTrunk;

public class OTIncludeRootObject extends DefaultOTObject 
{	
	public static interface ResourceSchema extends OTResourceSchema
	{
		public URL getHref();
	}
	protected ResourceSchema resources;

	OTObject refObject = null;
	
	public OTIncludeRootObject(ResourceSchema resources)
    {
	    super(resources);
	    this.resources = resources;
    }

	public URL getHref()
	{
		return resources.getHref();
	}
	
	public OTObject getReference()
	{
		if(refObject != null){
			return refObject;
		}
		
		URL url = getHref();
		
		OTrunkImpl otrunkImpl = (OTrunkImpl)getOTObjectService().getOTrunkService(OTrunk.class);
		
		try {
			refObject = otrunkImpl.getExternalObject(url, getOTObjectService());			
			return refObject;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}

}

@@ -42,16 +42,49 @@
 net.URL;
+%0Aimport java.util.logging.Logger;
 %0A%0Aimport
@@ -497,16 +497,86 @@
 = null;%0A
+%09private Logger logger = Logger.getLogger(this.getClass().getName());%0A
 %09%0A%09publi
@@ -1039,19 +1039,85 @@
 vice());
+%0A
 %09%09%09
+logger.info(%22included root object: %22 + refObject.otExternalId());
 %0A%09%09%09retu

Add logging statement to OTIncludeRootObject to print the id of the root object it references.