Sitemap

Saturday, April 11, 2015

UCM: Custom Service Class

A custom service class extends the content server’s core intradoc.server.Service.

The Service super class does not contain any methods that should be called directly. It mainly has support functions for
• Running service actions in the correct order
• Initializing a user’s security
• Running database queries
• Creating the context for the request

Key Service Class Objects
Variable Class Description
m_workspace intradoc.data.Workspace The database connection
m_binder intradoc.data.DataBinder The request and response data
m_currentAction intradoc.data.Action The current service action
m_serviceData intradoc.data.ServiceData The current service’s definition
m_userData intradoc.data.UserData The user running the service
m_service intradoc.data.Service A reference to the parent service object

The predefined Service class object m_binder has the same functionality as &IsJava=1

This is how a service class or service handler can access a parameter being passed from the service action:
String param = m_current_action.getParamAt(0);

This will get the first parameter.

Service class methods that are called from a service have a required signature: public void myMethod() throws DataException, ServiceException;
public class AcmeMailService extends Service {

    public void sendMail() throws DataException, ServiceException {
        String str = m_binder.getLocal("acmeEmailAddresses");
    }
}


Service classes:
• Service classes require minimal registration inside the server.
• Methods of a service class can only be used as actions in a service associated with that service class.
• Methods of a custom service class cannot be used as actions when extending standard services.

Service handlers
• Service handlers require additional registration inside the server.
• Methods of a service handler can be used as actions in services associated with different service classes.
• Methods of a custom service handler can be used as actions when extending standard services.

No comments:

Post a Comment