Package example.filesystem.callback

Source Code of example.filesystem.callback.FsckPassNumberCallback

package example.filesystem.callback;

import org.apache.ws.resource.properties.SetResourcePropertyCallback;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.impl.CallbackFailedException;
import org.apache.ws.resource.example.filesystem.FsckPassNumberDocument;
import org.apache.xmlbeans.XmlInt;

import javax.xml.namespace.QName;

import example.filesystem.backend.FileSystem;


/**
* A callback for the FsckPassNumber resource property.
*/
public class FsckPassNumberCallback implements SetResourcePropertyCallback
{
    FileSystem m_fileSystem;

    public FsckPassNumberCallback(FileSystem fileSystem)
    {
        m_fileSystem = fileSystem;
    }

    public void deleteProperty(QName propQName) throws CallbackFailedException
    {
        return; // no need to implement - Apollo will never call delete for a prop whose minOccurs != 0
    }

    public void insertProperty(Object[] propElems) throws CallbackFailedException
    {
        return; // no need to implement - Apollo will never call insert for a prop whose minOccurs == its maxOccurs
    }

    public void updateProperty(Object[] propElems) throws CallbackFailedException
    {
        // FsckPassNumber prop has cardinality of 1, so passed array will always have exactly one element
        XmlInt xInt = (XmlInt) propElems[0];
        m_fileSystem.setFsckPassNumber(xInt.getIntValue());
    }

    public ResourceProperty refreshProperty(ResourceProperty propthrows CallbackFailedException
    {
        XmlInt xInt = (XmlInt) prop.get( 0 );
        xInt.setIntValue( m_fileSystem.getFsckPassNumber() );
        return prop;
    }
}
TOP

Related Classes of example.filesystem.callback.FsckPassNumberCallback

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.