package com.twc.isa.AssetModule;


import org.apache.log4j.Logger;
import org.omg.CORBA.StringHolder;

import com.twc.isa.ServerModule.AdministrativeState;
import com.twc.isa.ServerModule.NameNotFound;
import com.twc.isa.ServerModule.NoGuiProvisioned;
import com.twc.isa.ServerModule.OperationalState;
import com.twc.isa.ServerModule.ServantBase;
import com.twc.isa.ServerModule.ServantBaseIteratorHolder;
import com.twc.isa.ServerModule.ServantBaseListHolder;
import com.twc.isa.ServerModule.ServantCreateFailed;
import com.twc.isa.ServerModule.ServantFactory_;
import com.twc.isa.ServerModule.Unimplemented;
import com.twc.isa.ServerModule.UnspecifiedException;

public class AssetFactory_impl extends AssetFactoryPOA {
     
	private final Logger log = Logger.getLogger(Asset_impl.class);
    public ServantFactory_ m_base   = null;
    
    public AssetData[]
    listAssetDetails() {
       	log.debug("listAssetDetails() not implemented.");
    	return null;
    }
    
    public Asset
    findAsset(String providerID, String assetID) {
    	log.debug("findAsset() not implemented.");
    	return null;
    }
    
    public AssetWithRelations
    getAssetDetails(String assetName) {
    	log.debug("getAssetDetails() not implemented.");
    	return null;
    }

    public AssetFactory_impl() {;}

    public AssetFactory_impl(org.omg.CORBA.ORB orb,String strName) {

        try {

            m_base = new ServantFactory_(orb,strName);
            //m_base.send("FactoryCreated"+":"+strName);

        } catch (Exception ex){

            log.error(null, ex);

        }

     }


    public ServantBase 
    createServant(String strName) 
    throws ServantCreateFailed {

        Asset_impl  asset_impl  = new Asset_impl(m_base.getORB(),strName);
        Asset asset_ = asset_impl._this(m_base.getORB());

        if(asset_==null) {
            throw new com.twc.isa.ServerModule.ServantCreateFailed(
                            "",
                            com.twc.isa.ServerModule.CompletionCode.cc_No);
        } else {
          m_base.add(asset_impl.name(), asset_);
          return asset_;
        }

    }

    public ServantBase 
    find(java.lang.String name) throws NameNotFound {
        return m_base.find(name);
    }

    public void 
    list(int iCount, ServantBaseListHolder sblh, ServantBaseIteratorHolder sbih) {
      m_base.list(iCount,sblh,sbih);
    }

    public void 
    removeServant(ServantBase s) {
    	log.debug("removeServant() not implemented.");
    }

    public String 
    name() {
        return m_base.name();
    }

    public void 
    provisioningGui(StringHolder strHolder) 
    throws NoGuiProvisioned {

        String strName  = getClass().getName();
        int iIdx    = strName.lastIndexOf("_");
        String strTxtFileName   = strName.substring(0,iIdx) + "ProvisioningURL.txt";
        strHolder.value = ServantFactory_.getProvisionGUI_URL_Name( strTxtFileName);

    }

    public void destroy(){
      	log.debug("destroy() not implemented.");
    }

    public void 
    statusGui(org.omg.CORBA.StringHolder strHolder) throws NoGuiProvisioned {

        String strName  = getClass().getName();
        int iIdx    = strName.lastIndexOf("_");
        String strTxtFileName   = strName.substring(0,iIdx) + "StatusURL.txt";
        strHolder.value = ServantFactory_.getProvisionGUI_URL_Name( strTxtFileName);

    }

    public Asset[] 
    anAsset() {
        return null;
    }

    public void 
    anAsset(Asset[] value) {
     	log.debug("anAsset() not implemented.");
    }
    
    public AdministrativeState 
    getAdminState() throws com.twc.isa.ServerModule.UnspecifiedException {
        return m_base.getAdminState();
    }
    
    public void 
    setAdminState(AdministrativeState st) 
    throws UnspecifiedException {
        m_base.setAdminState(st);
    }
    
    public void getCreateTime(org.omg.CORBA.LongHolder longHolder) 
    throws UnspecifiedException, Unimplemented {
        m_base.getCreateTime(longHolder);
    }
    
    public void 
    getLastModifiedTime(org.omg.CORBA.LongHolder longHolder) 
    throws UnspecifiedException, Unimplemented {
        m_base.getLastModifiedTime(longHolder);
    }
    
    public OperationalState 
    getOpState() 
    throws UnspecifiedException {
        return m_base.getOpState();
    }

	public AssetDataSummary[] listAssetDataSummary() throws UnspecifiedException {
		return null;
	}
}