is-collector/src/org/gcube/informationsystem/collector/impl/porttypes/XMLStorageAccess.java

56 lines
1.7 KiB
Java

package org.gcube.informationsystem.collector.impl.porttypes;
import org.globus.wsrf.utils.FaultHelper;
import org.oasis.wsrf.faults.BaseFaultType;
import org.gcube.common.core.contexts.GCUBEServiceContext;
import org.gcube.common.core.porttypes.GCUBEPortType;
import org.gcube.informationsystem.collector.impl.contexts.ICServiceContext;
import org.gcube.informationsystem.collector.impl.xmlstorage.exist.State;
/**
* <em>XMLStorageAccess</em> portType implementation. <br/>
* It gives remote access to administration features of the XML Storage
*
* @author Manuele Simi (ISTI-CNR)
*
*/
public class XMLStorageAccess extends GCUBEPortType {
/** {@inheritDoc} */
@Override
protected GCUBEServiceContext getServiceContext() {
return ICServiceContext.getContext();
}
/**
* Disposes the XMLStorage
*
* @throws BaseFaultType if the shutdown fails
*/
public void dispose() throws BaseFaultType {
try {
logger.info("Dispose operation invoked");
logger.info("trying to shutdown the storage instances...");
try {
State.storage_manager.shutdown();
State.query_manager.shutdown();
} catch (NullPointerException se) {/* nothng to do */
}
State.storage_manager = null;
State.query_manager = null;
// request the interruption of the sweeper thread
State.sweeperT.interrupt();
logger.info("done");
} catch (Exception e) {
logger.error("unable to pose the IC with success ", e);
BaseFaultType fault = new BaseFaultType();
FaultHelper faultHelper = new FaultHelper(fault);
faultHelper.addFaultCause(e);
faultHelper
.addDescription("-IC service: Unable to pose the service");
throw fault;
}
}
}