package org.jvnet.glassfish.comms.deployment.backend;

import java.net.URLClassLoader;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.enterprise.deploy.shared.ModuleType;

import com.sun.enterprise.deployment.BundleDescriptor;
import com.sun.enterprise.deployment.interfaces.pluggable.ArchiveDescriptor;

public class ArArchiveDescriptor extends BundleDescriptor 
	implements ArchiveDescriptor {

	private static final long serialVersionUID = 7207865173970175303L;
	private ClassLoader itsLoader = null;
	
	private static Logger theirLog = (Logger) Logger.getLogger("SipContainer");
	
	
	public ClassLoader getModuleClassLoader() {
		if (theirLog.isLoggable(Level.FINEST)){
			theirLog.finest("----- getModuleClassLoader ----->");	
		}
		if (itsLoader == null){
			theirLog.warning("Classloader not set, creating UrlClassLoader!");
			itsLoader = new URLClassLoader(null);
		}
		return itsLoader;
	}
	
	void setModuleClassLoader(ClassLoader aLoader){
		if (theirLog.isLoggable(Level.FINEST)){
			theirLog.finest("classloader set: " + aLoader);
		}
		itsLoader = aLoader;
	}

	@Override
	public ModuleType getModuleType() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Set getServiceReferenceDescriptors() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getDefaultSpecVersion() {
		// TODO what should be returned here?
		return "1.0";
	}
}
