|
soap tutorial | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectadriani.jws.template.service.GeneralService
adriani.jws.template.service.ServiceMacro
public class ServiceMacro
This class provides all the logic used to prepare the calls to the necessary DAO, hence it's an intermediate
layer between the upper main business logic (the ServiceLogic
class) and the underlying
datasource layer (the ServiceDAO
class).
The "interface policy" of this class is the following:
EXCEPTION : an unexpected exception is thrown, hence nothing is returned
DATA OK : the method return an ArrayList
containing a set of Wrapper
objects
NO DATA : the method return an ArrayList
containing a set of Wrapper
objects (could be empty)
NO DATABASE : the method return a null
object (database not available)
NO CUSTOMER : the method return a null
object (customer not found in the database)
The specific case can be acknowledged by calling the getStatus()
method after execution,
which contains a text message only after a NO DATABASE case or a NO DATA case.
Implementation guidelines:
Architecture: to grant loose coupling to the WSDL document and to the database, all the database
issues should be handled by the ServiceDAO
class, and all the ADBBean
data
conversion issues should be handled by the related wrapper in the messages
package.
Field Summary | |
---|---|
static java.lang.String |
BLANK
Static final String value stored as class field to improve performances. |
static java.lang.String |
EMPTY
Static final String value stored as class field to improve performances. |
static java.lang.String |
HYPHEN
Static final String value stored as class field to improve performances. |
protected static java.lang.String |
leadingName
Beginning of each logging message printed on the STDOUT . |
protected static WSLogger |
logger
Retrieving the logger instance to be used for this class (static). |
protected static int |
NO_CUSTOMER
A static code describing the status of this macro after the last operation. |
protected static int |
NO_DATA
A static code describing the status of this macro after the last operation. |
protected static int |
NO_DATABASE
A static code describing the status of this macro after the last operation. |
protected static int |
OK
A static code describing the status of this macro after the last operation. |
static java.lang.String |
QUOTE
Static final String value stored as class field to improve performances. |
protected ServiceDAO |
serviceDAO
A reference to the ServiceDAO class accessing the necessary database's. |
protected int |
status
An integer code describing the status of this macro after the last operation. |
static java.lang.String |
UNDER
Static final String value stored as class field to improve performances. |
static java.lang.StringBuffer |
ZERO
Static final StringBuffer value stored as class field to improve performances. |
Fields inherited from class adriani.jws.template.service.GeneralService |
---|
benchLogger, serviceAnalyzer |
Constructor Summary | |
---|---|
ServiceMacro()
Constructor, creating also the ServiceDAO object and storing it as class attribute. |
Method Summary | |
---|---|
java.util.ArrayList |
dummyFormatDate(WrapperDateIn input)
Return an ArrayList emulating the actual macro response, but filled with dummy data. |
java.util.ArrayList |
formatDate(WrapperDateIn input)
Example method, to be replaced with actual business logic for your web service. |
java.util.ArrayList |
getDummyInformation(WrapperInformationIn input)
Return an ArrayList emulating the actual macro response, but filled with dummy data. |
java.util.ArrayList |
getInformation(WrapperInformationIn input)
Example method, to be replaced with actual business logic for your web service. |
ServiceDAO |
getServiceDAO()
Accessor method. |
int |
getStatus()
Accessor method. |
protected java.util.ArrayList |
handleNoDatabase(int database)
Prepare a null ArrayList object when the service logic fails because there is no
connection to one of the required databases. |
protected java.util.ArrayList |
handleNoRecord(WrapperIn input,
int error)
Prepare an empty ArrayList object when the service logic fails because was not
Possible to find data from the DAO layer (assuming the business logic needs to find it in the database). |
void |
setStatus(int value)
Accessor method. |
protected void |
showConfiguration()
Prints in the LOG file some information about the service configuration. |
protected int |
valueOfBuffer(java.lang.StringBuffer buffer,
int no_value)
Parse the string value of the input StringBuffer buffer into an integer value. |
Methods inherited from class adriani.jws.template.service.GeneralService |
---|
compareSB, delay, finalize, getCommandsList, getServiceAnalyzer, loadBundle, loadBundle, loadProperties, logIntrospection, manageService, showJavaProperties, showRuntime, valueOfString |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ServiceDAO serviceDAO
ServiceDAO
class accessing the necessary database's.
protected int status
public static final java.lang.String EMPTY
String
value stored as class field to improve performances.
public static final java.lang.String BLANK
String
value stored as class field to improve performances.
public static final java.lang.String UNDER
String
value stored as class field to improve performances.
public static final java.lang.String HYPHEN
String
value stored as class field to improve performances.
public static final java.lang.String QUOTE
String
value stored as class field to improve performances.
public static final java.lang.StringBuffer ZERO
StringBuffer
value stored as class field to improve performances.
protected static final int OK
protected static final int NO_DATA
protected static final int NO_DATABASE
protected static final int NO_CUSTOMER
protected static java.lang.String leadingName
protected static WSLogger logger
Constructor Detail |
---|
public ServiceMacro()
ServiceDAO
object and storing it as class attribute.
Method Detail |
---|
public java.util.ArrayList getInformation(WrapperInformationIn input)
input
- the input parameters wrapped by the WrapperIn
class
public java.util.ArrayList formatDate(WrapperDateIn input)
input
- the input parameters wrapped by the WrapperIn
class
protected java.util.ArrayList handleNoDatabase(int database)
ArrayList
object when the service logic fails because there is no
connection to one of the required databases. The output message will contain a message like
"No connection to the database".
database
- a reference to the code number of the missing database
ArrayList
object with a message describing this situationDatabase
protected java.util.ArrayList handleNoRecord(WrapperIn input, int error)
ArrayList
object when the service logic fails because was not
Possible to find data from the DAO layer (assuming the business logic needs to find it in the database).
The output message will contain a message like "missing/wrong database data".
input
- the input parameters wrapped by the WrapperIn
class
ArrayList
objectpublic void setStatus(int value)
public int getStatus()
public ServiceDAO getServiceDAO()
protected void showConfiguration()
showConfiguration
in class GeneralService
public java.util.ArrayList getDummyInformation(WrapperInformationIn input)
ArrayList
emulating the actual macro response, but filled with dummy data.
This method is called by the business logic when the FAKE configuration flag is set to true,
this means that the actual macro call (getInformation()
) it's not executed and no
database connections are opened.ServiceDAO.getDummyQuery(StringBuffer[] param, int howMany, int cols)
for details.
input
- the input parameters wrapped by the WrapperIn
class
ServiceDAO.getDummyQuery(StringBuffer[] param, int howMany, int cols)
public java.util.ArrayList dummyFormatDate(WrapperDateIn input)
ArrayList
emulating the actual macro response, but filled with dummy data.
This method is called by the business logic when the FAKE configuration flag is set to true,
this means that the actual macro call (getFormatDate()
) it's not executed and no
database connections are opened.
input
- the input parameters wrapped by the WrapperIn
class
protected int valueOfBuffer(java.lang.StringBuffer buffer, int no_value)
StringBuffer
buffer into an integer value.
The no_value
parameter represent the default integer value to be returned if
the parsing is not successful.
buffer
- the input string objectno_value
- the integer value to be returned if conversion fails
no_value
number)
|
Build 19/03/2014 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |