/*
*-**************************************************************************-*
*
* XOo°f - http://www.xooof.org
* A development and XML specification framework for documenting and
* developing the services layer of enterprise business applications.
* From the specifications, it generates WSDL, DocBook, client-side and
* server-side code for Java, C# and Python.
*
* Copyright (C) 2006 Software AG Belgium
*
* This file is part of XOo°f.
*
* XOo°f is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* XOo°f is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*-**************************************************************************-*
*/
package xdtestsuite.server;
import org.xooof.xmldispatcher.interfaces.XMLDispatcherAppException;
import org.xooof.xmldispatcher.interfaces.XMLDispatcherUserException;
import org.xooof.xmldispatcher.servers.XMLDispatcherContext;
import xdtestsuite.msgs.*;
public class MyBOBean extends MyBOBaseBean
{
private static int counter = 0;
// class methods
// constructors
private void _checkState(String expectedState)
throws XMLDispatcherAppException
{
if (expectedState == null)
{
if (state != null)
{
throw new XMLDispatcherAppException("unexpected state '" + state + "'");
}
}
else
{
if (!state.equals(expectedState))
{
throw new XMLDispatcherAppException("unexpected state '" + state + "'");
}
}
}
protected String ejbCreateCreateImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException, javax.ejb.CreateException
{
_checkState(null);
++counter;
return "PK1-"+counter;
}
protected void ejbPostCreateCreateImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException, javax.ejb.CreateException
{
_checkState("created1");
}
protected String ejbCreateSomeConstructorImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException, javax.ejb.CreateException
{
_checkState(null);
++counter;
return "PK2-"+counter;
}
protected void ejbPostCreateSomeConstructorImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException, javax.ejb.CreateException
{
_checkState("created3");
}
protected String ejbCreateBaseConstructorImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException, javax.ejb.CreateException
{
_checkState(null);
++counter;
return "PK3-"+counter;
}
protected void ejbPostCreateBaseConstructorImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException, javax.ejb.CreateException
{
_checkState("created2");
}
// instance methods
protected SMyBO impl_loadImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
try
{
SMyBO rply = new SMyBO();
rply.objId = (String)entityContext.getEJBLocalObject().getPrimaryKey();
rply.objClass = "MyBO";
rply.state = state;
return rply;
}
catch(Exception e)
{
exceptionHandler(e); // never returns
return null;
}
}
protected SMyBO impl_specificLoadImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
try
{
SMyBO rply = new SMyBO();
rply.objId = (String)entityContext.getEJBLocalObject().getPrimaryKey();
rply.objClass = "MyBO";
rply.state = state;
return rply;
}
catch(Exception e)
{
exceptionHandler(e); // never returns
return null;
}
}
protected void impl_someMethodImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
}
protected void impl_someMethod1Impl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
}
protected void impl_baseMethodImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
}
protected void impl_baseMethod1Impl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
}
protected void impl_destroyImpl(XMLDispatcherContext xdCtx)
throws XMLDispatcherUserException, XMLDispatcherAppException
{
}
// interface XMLDispatcherState
private String state;
public String getState(XMLDispatcherContext xdCtx)
{
return this.state;
}
protected void setState(XMLDispatcherContext xdCtx, String state)
{
logcat.debug("setState: "+state);
this.state = state;
}
}