psdi.server

Class AppService

  • java.lang.Object
    • psdi.server.AppService
    • Field Detail

      • LOAD

        protected static final int LOAD
        Used for communicating state information about the AppService.
        See Also:
        Constant Field Values
      • INIT

        protected static final int INIT
        Used for communicating state information about the AppService.
        See Also:
        Constant Field Values
      • RUN

        protected static final int RUN
        Used for communicating state information about the AppService.
        See Also:
        Constant Field Values
      • STOP

        protected static final int STOP
        Used for communicating state information about the AppService.
        See Also:
        Constant Field Values
      • stateList

        protected static final java.lang.String[] stateList
        List of strings associated with the state.
      • stateCmdList

        protected static final java.lang.String[] stateCmdList
        Change of state commands.
      • url

        protected java.lang.String url
        Accessed via setter and getter. Used by ServiceCoordinator.
      • load

        protected int load
        Accessed via setter and getter. Used by ServiceCoordinator.
      • mxServer

        protected MXServer mxServer
        The MXServer which contains this AppService.
      • currentState

        protected java.lang.String currentState
        State of the server. From the list enumerated in stateList[]
      • dbManager

        protected DBManager dbManager
        DBconnections.
      • liveObjCount

        protected int liveObjCount
        Tracks the number of clients. Counts the references to the MboSet type served by this Service.
      • running

        protected boolean running
        Tracks whether the Service is running or not. Set by setRunning(), checked by isRunning().
      • name

        protected java.lang.String name
        Name of the app service info.
    • Constructor Detail

      • AppService

        public AppService()
                   throws java.rmi.RemoteException
        Default Constructor.
        Throws:
        java.rmi.RemoteException
      • AppService

        public AppService(MXServer mxServer)
                   throws java.rmi.RemoteException
        Parameters:
        srvEnv - -- the "Server Environment" this Service is being created in.
        Throws:
        java.rmi.RemoteException
    • Method Detail

      • isRunning

        public boolean isRunning()
        Get the value of the running variable.
        Specified by:
        isRunning in interface Dependable
      • setRunning

        public void setRunning(boolean value)
        Set the value of the running variable.
        Specified by:
        setRunning in interface Dependable
      • configure

        public void configure(java.util.Properties cf)
        Configure the AppService.
        Specified by:
        configure in interface Service
        See Also:
        Service
      • setProxy

        public void setProxy(java.rmi.Remote proxy)
        Specified by:
        setProxy in interface MaxRemoteProxy
      • init

        public void init()
        Initialize the Application Service.
        Specified by:
        init in interface Service
        See Also:
        Service
      • destroy

        public void destroy()
        Description copied from interface: Service
        Release system resources. The object should release all system resources. This will be called only once and is called to prepare the object for finalization.
        Specified by:
        destroy in interface Service
        See Also:
        Service
      • getMXServer

        public MXServer getMXServer()
        Used by the delegates of this class.
      • setName

        protected void setName(java.lang.String name)
        Sets the app service name
      • setURL

        public void setURL(java.lang.String url)
        Used by ServiceCoordinator
        Specified by:
        setURL in interface Service
      • getLoad

        public int getLoad()
        Used by ServiceCoordinator
      • getServiceInfo

        public java.lang.String getServiceInfo()
        Returns Service name, author and version information.
      • getSetFromKeys

        public MboSetRemote getSetFromKeys(java.lang.String setName,
                                           java.lang.String[] keyNames,
                                           java.lang.String[][] keyValues,
                                           UserInfo user)
                                    throws MXException,
                                           java.rmi.RemoteException
        This method constructs a MboSet to contain all the records based on their key values as specified through the parameters. The where clause is composed based on the keys. This is not intended to be used when many objects are expected to be in the returned set.
        Specified by:
        getSetFromKeys in interface AppServiceRemote
        Parameters:
        setName - the name of the object
        keyNames - The name of the keys in the same order keyValues are specified
        keyValues - Two dimentially string array. Each row contain the values of the keys specified in keyNames in the same order. Each record is represented by a row
        user - userInfo object
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AppService.getSetFromKeys(String, String[], String[][], UserInfo )
      • freeMboSet

        public void freeMboSet()
        Reduces the liveObjCount, invoked by java.rmi.server.Unreferenced.unreferenced() implemented in psdi.mbo.MboSet
        Specified by:
        freeMboSet in interface MboServerInterface
        See Also:
        MboSet
      • getLiveObjCount

        public int getLiveObjCount()
        Used to determine the "load" on this Application Service within this MXServer.
        Specified by:
        getLiveObjCount in interface AppServiceRemote
      • getDBConnection

        public java.sql.Connection getDBConnection(ConnectionKey conKey)
        Gets a database connection for reading and writing to the database. The ConnectionKey is used to distinguish one connection from other. The ConnectionKey can be obtained from UserInfo object or it can be created if a UserInfo object is available. When this function is called, always it must be called with a freeDBConnection() passing the same ConnectionKey object used to get the connection.
        Specified by:
        getDBConnection in interface MboServerInterface
      • freeDBConnection

        public void freeDBConnection(ConnectionKey conKey)
        Makes the connection used by the ConnectionKey object available for others. The same ConnectionKey object used to get connection should be passed.
        Specified by:
        freeDBConnection in interface MboServerInterface
      • getCurrentState

        public java.lang.String getCurrentState()
                                         throws java.rmi.RemoteException
        Used for remote Management.
        Specified by:
        getCurrentState in interface AppServiceRemote
        Throws:
        java.rmi.RemoteException
      • getStateList

        public java.lang.String[] getStateList()
                                        throws java.rmi.RemoteException
        Used for remote Management.
        Specified by:
        getStateList in interface AppServiceRemote
        Throws:
        java.rmi.RemoteException
      • getStateCmdList

        public java.lang.String[] getStateCmdList()
                                           throws java.rmi.RemoteException
        Used for remote Management.
        Specified by:
        getStateCmdList in interface AppServiceRemote
        Throws:
        java.rmi.RemoteException
      • restart

        public void restart()
                     throws java.rmi.RemoteException
        Indicates that the Service should reload any cached information.
        Specified by:
        restart in interface ServiceRemote
        Throws:
        java.rmi.RemoteException
      • initCriteriaList

        public void initCriteriaList(java.util.Hashtable criteriaTable)
                              throws MXException,
                                     java.rmi.RemoteException
        Create the criteria list for use with getCriteria. Sub-Classes wanting to add criterions should override this method, but be sure to call the super's version first. The criteria's names ought to be in all capital letters and the criteria itself should be enclosed by parenthesis.
        Throws:
        MXException
        java.rmi.RemoteException
      • getCriteriaList

        protected java.util.Hashtable getCriteriaList()
        Get the criteria list.
        Returns:
      • getCriteria

        public java.lang.String getCriteria(java.lang.String criteriaName)
                                     throws java.rmi.RemoteException
        Retrieve a criteria using its name. Returns null if the criteria is not found. This is a remote method.
        Specified by:
        getCriteria in interface AppServiceRemote
        Throws:
        java.rmi.RemoteException
      • verifyUser

        public void verifyUser(java.lang.String loginCheck,
                               java.lang.String passCheck,
                               UserInfo userinfo)
                        throws MXException,
                               java.rmi.RemoteException
        After a user has connected, re-verify the username and password. Calls verifyUser. If the entered username is blocked, an error is thrown (signature / blockedUser). If the entered username and password do not equal those used to log on, an error is thrown (signature / badVerify).
        Specified by:
        verifyUser in interface AppServiceRemote
        Parameters:
        loginCheck - The newly entered Login ID to be compared to the logon loginid.
        passCheck - The newly entered password to be compared to the logon password.
        userInfo - The current UserInfo.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AppService.verifyUser(String, String, UserInfo, String, String, String, String[])
      • getSetForRelationship

        public MboSetRemote getSetForRelationship(java.lang.String relOwner,
                                                  java.lang.String relName,
                                                  java.lang.String[] relColumn,
                                                  java.lang.String[] relValue,
                                                  UserInfo userInfo)
                                           throws MXException,
                                                  java.rmi.RemoteException
        This is used by the Java UI dialog boxes. Normally it will not be used by the business objects.

        Given a relationship name and an array of String parameters, get the relationship, substitute the parameters, get the MboSet, and return the Set. This presumes that the bind variables in the relationship Sql are identified by sequential integers and that the correct number of substitution variables are provided in the array.

        Specified by:
        getSetForRelationship in interface AppServiceRemote
        Parameters:
        relOwner - The "owner" of the relationship name. This is NOT the actual owner of the set to be returned. It is needed so that this method can get the relationship Sql.
        relName - The relationship name.
        relColumn - Array of column names. This is used to configure the Sql with the proper datatype. There should be the same number of elements in relColumns and relValues, and they should match by index (relColumn[0] is the column name for relValue[0], etc.). These must be valid attribute names for relOwner, OR be specified as tbname.colname.
        relValue - Array of bind variables for the given relationship.
        userInfo - The userInfo making the request.
        Returns:
        MboSetRemote for the relationship.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        AppService.getSetForRelationship(java.lang.String, java.lang.String, java.lang.String[], java.lang.String[], psdi.security.UserInfo)
      • getServiceLogger

        public MXLogger getServiceLogger()
        Returns a logger to log messages related to this service.
        Returns:
        MXLogger a logger to log messages related to this service.
      • checkSecurity

        public boolean checkSecurity(java.lang.String methodname,
                                     UserInfo userInfo)
                              throws MXException,
                                     java.rmi.RemoteException
        Look in MaxServSecurity to see if a SigOption has been defined for this servicename and methodname. If SigOption is defined, then look in the user's security Profile to see if access has been granted to this user. If this is a site or org-level app, the user's default site or org is used for the security check. (This does not do any Mbo-based checks related to "conditional sigoption.")

        This method is supplied so that web services can check security before invoking a method on an app service.

        Specified by:
        checkSecurity in interface AppServiceRemote
        Parameters:
        methodname - The name of the method to be checked.
        userInfo - The UserInfo whose privilege should be checked.
        Returns:
        True if privilege is granted or there is no sigoption to be checked; else False.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Profile.getAppOptionAuth(java.lang.String, java.lang.String, java.lang.String)