Class WebServicesFactory

  • All Implemented Interfaces:
    java.io.Serializable

    public class WebServicesFactory
    extends java.lang.Object
    implements java.io.Serializable
    Generate XML artifacts (XSD, WSDL) for exposing and manipulating internal objects thru generic webservices. This is a Web Session Bean.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String appservice​(java.lang.String xmlRequest)
      Application services
      java.lang.String appservice​(javax.servlet.http.HttpServletRequest request)
      Application services
      java.lang.String appwsdl()
      Generate application WSDL contract
      ObjectDB borrowObject​(java.lang.String name)
      Get an object from the object pool
      static void checkErrors​(java.util.List<java.lang.String> msg)  
      static boolean checkLicense​(boolean force)
      Checks the license
      void clearDataCache()
      Clear all data from data cache
      java.lang.String dbdocservice​(java.lang.String xmlRequest)
      Document service
      java.lang.String dbdocservice​(javax.servlet.http.HttpServletRequest request)
      Document service
      java.lang.String dbdocwsdl()
      Generate document WSDL contract
      void destroy()
      Destroy
      java.lang.String disco​(java.lang.String[] objects, java.lang.String moduleName, boolean application, boolean document)
      Generates DISCO directory of services for one module or for all modules
      java.lang.String disco​(javax.servlet.http.HttpServletRequest request)
      Generates DISCO directory of services for one module or for all modules
      java.lang.String getAppServiceUrl()  
      java.lang.String getAppWsdlUrl()  
      java.lang.String getBaseLocation()  
      java.lang.String getBaseNamespace()  
      java.lang.String getDbdocServiceUrl()  
      java.lang.String getDbdocWsdlUrl()  
      java.lang.String getDiscoUrl()  
      int getEndpoint()  
      java.lang.Object getFromDataCache​(java.lang.String key)
      Get data from data cache
      Grant getGrant()  
      java.lang.String getImportServiceUrl()  
      java.lang.String getImportWsdlUrl()  
      java.lang.String getServiceUrl()  
      java.lang.String getWsdlUrl()  
      java.lang.String getXsdUrl()  
      java.lang.String importservice​(java.lang.String xmlRequest)
      Import service
      java.lang.String importservice​(javax.servlet.http.HttpServletRequest request)
      Import service
      java.lang.String importwsdl​(ObjectDB[] objs)
      Generates import WSDL contract
      java.lang.String importwsdl​(javax.servlet.http.HttpServletRequest request)
      Generates import WSDL contract
      void init​(java.lang.String login, java.lang.String password, java.lang.String sessionId, javax.servlet.http.HttpServletRequest request, boolean wsSecurity)
      Initialize webservice builder
      java.lang.String initCsv​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Inialize factory for CSV
      void initHtml​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Inialize factory for HTML
      java.lang.String initJson​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Inialize factory for JSON
      java.lang.String initSoap​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean wsSecurity)
      Inialize factory for SOAP
      java.lang.String initText​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Inialize factory for text
      java.lang.String initXml​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Inialize factory for XML
      static java.util.List<java.lang.String> listStaticImages​(Grant g, java.lang.String folder, javax.servlet.http.HttpServletRequest request)
      List folders or files in /images
      void rawcontentservice​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Raw content service
      void rawdataservice​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Raw data service (LOV or object)
      void rawdbdocservice​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Raw document service
      void rawresourceservice​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Raw resource service
      static Resource readIcon​(Grant g, java.lang.String type, java.lang.String code, java.lang.String object, java.lang.String objid, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Lookup in content/static/icons path
      static void readImage​(Grant g, java.io.File file, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      static void readImage​(Grant g, java.lang.String code, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Lookup as static path (images/image/.png)
      static void readStaticImage​(Grant g, java.lang.String code, java.lang.String folder, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Read static image
      void removeFromDataCache​(java.lang.String key)
      Remove data from data cache
      void returnObject​(ObjectDB obj)
      Return an object to the object pool
      java.lang.String service​(Processus p, org.w3c.dom.Node body, java.lang.String wsSecurityTokenId)
      Process service
      java.lang.String service​(ObjectDB obj, org.w3c.dom.Node body, java.lang.String wsSecurityTokenId)
      Object service
      java.lang.String service​(TreeView tv, org.w3c.dom.Node body, java.lang.String wsSecurityTokenId)
      TreeView service
      java.lang.String service​(javax.servlet.http.HttpServletRequest request)
      Object service
      void setAppServiceUrl​(java.lang.String appServiceUrl)  
      void setAppWsdlUrl​(java.lang.String appWsdlUrl)  
      void setBaseLocation​(java.lang.String baseLocation)  
      void setBaseNamespace​(java.lang.String baseNamespace)  
      void setDbdocServiceUrl​(java.lang.String dbdocServiceUrl)  
      void setDbdocWsdlUrl​(java.lang.String dbdocWsdlUrl)  
      void setDiscoUrl​(java.lang.String discoUrl)  
      void setEndpoint​(int endpoint)  
      void setGrant​(Grant g)  
      void setImportServiceUrl​(java.lang.String importServiceUrl)  
      void setImportWsdlUrl​(java.lang.String importWsdlUrl)  
      void setServiceUrl​(java.lang.String serviceUrl)  
      void setWsdlUrl​(java.lang.String wsdlUrl)  
      void setXsdUrl​(java.lang.String xsdUrl)  
      void storeInDataCache​(java.lang.String key, java.lang.Object data)
      Store data in data cache
      static void streamResource​(Grant g, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      boolean useDataCache()
      Is data caching enabled (only applicable to the API endpoint)?
      boolean useObjectPool()
      Is object pooling enabled? (only applicable to the API endpoint)
      java.lang.String wsdl​(Processus pcs)
      Generates WSDL contract for specified process
      java.lang.String wsdl​(ObjectDB obj)
      Generates WSDL contract for specified object
      java.lang.String wsdl​(TreeView tv)
      Generates WSDL contract for specified tree view
      java.lang.String wsdl​(javax.servlet.http.HttpServletRequest request)
      Generates WSDL contract for specified object, process or treeview
      java.lang.String xsd​(Processus pcs, java.lang.String extraTypes)
      Generates XSD schema for a business process
      java.lang.String xsd​(ObjectDB obj, java.lang.String extraTypes)
      Generates XSD schema for a business object
      java.lang.String xsd​(TreeView tv, java.lang.String extraTypes)
      Generates XSD schema for a tree view
      java.lang.String xsd​(javax.servlet.http.HttpServletRequest request)
      Generates XSD schema for a business object, process or treeview
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebServicesFactory

        public WebServicesFactory()
    • Method Detail

      • getGrant

        public Grant getGrant()
      • setGrant

        public void setGrant​(Grant g)
      • getEndpoint

        public int getEndpoint()
      • setEndpoint

        public void setEndpoint​(int endpoint)
      • getBaseNamespace

        public java.lang.String getBaseNamespace()
      • setBaseNamespace

        public void setBaseNamespace​(java.lang.String baseNamespace)
      • getBaseLocation

        public java.lang.String getBaseLocation()
      • setBaseLocation

        public void setBaseLocation​(java.lang.String baseLocation)
      • getXsdUrl

        public java.lang.String getXsdUrl()
      • setXsdUrl

        public void setXsdUrl​(java.lang.String xsdUrl)
      • getWsdlUrl

        public java.lang.String getWsdlUrl()
      • setWsdlUrl

        public void setWsdlUrl​(java.lang.String wsdlUrl)
      • getServiceUrl

        public java.lang.String getServiceUrl()
      • setServiceUrl

        public void setServiceUrl​(java.lang.String serviceUrl)
      • getAppWsdlUrl

        public java.lang.String getAppWsdlUrl()
      • setAppWsdlUrl

        public void setAppWsdlUrl​(java.lang.String appWsdlUrl)
      • getAppServiceUrl

        public java.lang.String getAppServiceUrl()
      • setAppServiceUrl

        public void setAppServiceUrl​(java.lang.String appServiceUrl)
      • getDbdocWsdlUrl

        public java.lang.String getDbdocWsdlUrl()
      • setDbdocWsdlUrl

        public void setDbdocWsdlUrl​(java.lang.String dbdocWsdlUrl)
      • getDbdocServiceUrl

        public java.lang.String getDbdocServiceUrl()
      • setDbdocServiceUrl

        public void setDbdocServiceUrl​(java.lang.String dbdocServiceUrl)
      • getImportWsdlUrl

        public java.lang.String getImportWsdlUrl()
      • setImportWsdlUrl

        public void setImportWsdlUrl​(java.lang.String importWsdlUrl)
      • getImportServiceUrl

        public java.lang.String getImportServiceUrl()
      • setImportServiceUrl

        public void setImportServiceUrl​(java.lang.String importServiceUrl)
      • getDiscoUrl

        public java.lang.String getDiscoUrl()
      • setDiscoUrl

        public void setDiscoUrl​(java.lang.String discoUrl)
      • init

        public void init​(java.lang.String login,
                         java.lang.String password,
                         java.lang.String sessionId,
                         javax.servlet.http.HttpServletRequest request,
                         boolean wsSecurity)
                  throws java.lang.Exception

        Initialize webservice builder

        Parameters:
        login - User login (if null, get remote user from HTTP request)
        password - User password (if null, no explicit password check, authentication check is supposed to be managed by JAAS)
        sessionId - Session ID (if null, gets HTTP session ID)
        request - HTTP request
        wsSecurity - Use WS-Security ?
        Throws:
        java.lang.Exception - if any init error occurs
      • useObjectPool

        public boolean useObjectPool()
        Is object pooling enabled? (only applicable to the API endpoint)
        Returns:
        True if object pooling is enabled
      • borrowObject

        public ObjectDB borrowObject​(java.lang.String name)
        Get an object from the object pool
        Parameters:
        name - Object name
      • returnObject

        public void returnObject​(ObjectDB obj)
        Return an object to the object pool
        Parameters:
        obj - Object
      • useDataCache

        public boolean useDataCache()
        Is data caching enabled (only applicable to the API endpoint)?
        Returns:
        True if data caching is enabled
      • storeInDataCache

        public void storeInDataCache​(java.lang.String key,
                                     java.lang.Object data)
        Store data in data cache
        Parameters:
        key - Key
        data - Data
      • getFromDataCache

        public java.lang.Object getFromDataCache​(java.lang.String key)
        Get data from data cache
        Parameters:
        key - Key
        Returns:
        Data from cache or null if not present in the data cache
      • removeFromDataCache

        public void removeFromDataCache​(java.lang.String key)
        Remove data from data cache
        Parameters:
        key - Key
      • clearDataCache

        public void clearDataCache()
        Clear all data from data cache
      • destroy

        public void destroy()
        Destroy
      • initSoap

        public java.lang.String initSoap​(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response,
                                         boolean wsSecurity)
        Inialize factory for SOAP
        Parameters:
        request - Request
        response - Response
      • initJson

        public java.lang.String initJson​(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
        Inialize factory for JSON
        Parameters:
        request - Request
        response - Response
      • initXml

        public java.lang.String initXml​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
        Inialize factory for XML
        Parameters:
        request - Request
        response - Response
      • initCsv

        public java.lang.String initCsv​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
        Inialize factory for CSV
        Parameters:
        request - Request
        response - Response
      • initText

        public java.lang.String initText​(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
        Inialize factory for text
        Parameters:
        request - Request
        response - Response
      • initHtml

        public void initHtml​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws java.lang.Exception
        Inialize factory for HTML
        Parameters:
        request - Request
        response - Response
        Throws:
        java.lang.Exception
      • checkLicense

        public static boolean checkLicense​(boolean force)
        Checks the license
        Parameters:
        force - Force?
        Returns:
        true if license is valid, false otherwise
      • xsd

        public java.lang.String xsd​(javax.servlet.http.HttpServletRequest request)
                             throws java.lang.Exception

        Generates XSD schema for a business object, process or treeview

        Parameters:
        request - HTTP request
        Returns:
        XSD schema
        Throws:
        java.lang.Exception
      • xsd

        public java.lang.String xsd​(ObjectDB obj,
                                    java.lang.String extraTypes)
                             throws java.lang.Exception

        Generates XSD schema for a business object

        Parameters:
        obj - Object
        extraTypes - Additional XSD types
        Returns:
        XSD schema
        Throws:
        java.lang.Exception
      • xsd

        public java.lang.String xsd​(Processus pcs,
                                    java.lang.String extraTypes)
                             throws java.lang.Exception

        Generates XSD schema for a business process

        Parameters:
        pcs - Process
        extraTypes - Additional XSD types
        Returns:
        XSD schema
        Throws:
        java.lang.Exception
      • xsd

        public java.lang.String xsd​(TreeView tv,
                                    java.lang.String extraTypes)
                             throws java.lang.Exception

        Generates XSD schema for a tree view

        Parameters:
        tv - Tree view
        extraTypes - Additional XSD types
        Returns:
        XSD schema
        Throws:
        java.lang.Exception
      • wsdl

        public java.lang.String wsdl​(javax.servlet.http.HttpServletRequest request)
                              throws java.lang.Exception

        Generates WSDL contract for specified object, process or treeview

        Parameters:
        request - HTTP request
        Returns:
        XSD schema
        Throws:
        java.lang.Exception
      • wsdl

        public java.lang.String wsdl​(ObjectDB obj)
                              throws java.lang.Exception

        Generates WSDL contract for specified object

        Parameters:
        obj - Object
        Returns:
        WSDL contract
        Throws:
        java.lang.Exception
      • service

        public java.lang.String service​(javax.servlet.http.HttpServletRequest request)
                                 throws java.lang.Exception

        Object service

        Parameters:
        request - HTTP request
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • service

        public java.lang.String service​(Processus p,
                                        org.w3c.dom.Node body,
                                        java.lang.String wsSecurityTokenId)
                                 throws PlatformException,
                                        java.lang.Exception

        Process service

        Parameters:
        p - Business process
        body - Body node
        Returns:
        SOAP XML response
        Throws:
        PlatformException
        java.lang.Exception
      • wsdl

        public java.lang.String wsdl​(Processus pcs)
                              throws java.lang.Exception

        Generates WSDL contract for specified process

        Parameters:
        pcs - Business process
        Returns:
        WSDL contract
        Throws:
        java.lang.Exception
      • wsdl

        public java.lang.String wsdl​(TreeView tv)
                              throws java.lang.Exception

        Generates WSDL contract for specified tree view

        Parameters:
        tv - Tree view definition
        Returns:
        WSDL contract
        Throws:
        java.lang.Exception
      • appwsdl

        public java.lang.String appwsdl()

        Generate application WSDL contract

        Returns:
        Application WSDL
      • appservice

        public java.lang.String appservice​(javax.servlet.http.HttpServletRequest request)

        Application services

        Parameters:
        request - HTTP request
        Returns:
        SOAP XML response
      • appservice

        public java.lang.String appservice​(java.lang.String xmlRequest)
                                    throws java.lang.Exception

        Application services

        Parameters:
        xmlRequest - SOAP XML request
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • importwsdl

        public java.lang.String importwsdl​(javax.servlet.http.HttpServletRequest request)
                                    throws java.lang.Exception

        Generates import WSDL contract

        Parameters:
        request - HTTP request
        Returns:
        Import WSDL
        Throws:
        java.lang.Exception
      • importwsdl

        public java.lang.String importwsdl​(ObjectDB[] objs)
                                    throws java.lang.Exception

        Generates import WSDL contract

        Parameters:
        objs - Objects
        Returns:
        Import WSDL
        Throws:
        java.lang.Exception
      • importservice

        public java.lang.String importservice​(javax.servlet.http.HttpServletRequest request)
                                       throws java.lang.Exception

        Import service

        Parameters:
        request - HTTP request
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • importservice

        public java.lang.String importservice​(java.lang.String xmlRequest)
                                       throws java.lang.Exception

        Import service

        Parameters:
        xmlRequest - SOAP XML request
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • dbdocwsdl

        public java.lang.String dbdocwsdl()
                                   throws java.lang.Exception

        Generate document WSDL contract

        Returns:
        Document WSDL
        Throws:
        java.lang.Exception
      • dbdocservice

        public java.lang.String dbdocservice​(javax.servlet.http.HttpServletRequest request)
                                      throws java.lang.Exception

        Document service

        Parameters:
        request - HTTP request
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • dbdocservice

        public java.lang.String dbdocservice​(java.lang.String xmlRequest)
                                      throws java.lang.Exception

        Document service

        Parameters:
        xmlRequest - SOAP XML request
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • rawdbdocservice

        public void rawdbdocservice​(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
                             throws java.lang.Exception
        Raw document service
        Parameters:
        request - HTTP request
        response - HTTP response
        Throws:
        java.lang.Exception
      • rawcontentservice

        public void rawcontentservice​(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws java.lang.Exception
        Raw content service
        Parameters:
        request - HTTP request
        Throws:
        java.lang.Exception
      • rawresourceservice

        public void rawresourceservice​(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws java.lang.Exception
        Raw resource service
        Parameters:
        request - HTTP request
        Throws:
        java.lang.Exception
      • streamResource

        public static void streamResource​(Grant g,
                                          javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response)
                                   throws java.io.IOException,
                                          PlatformException
        Throws:
        java.io.IOException
        PlatformException
      • listStaticImages

        public static java.util.List<java.lang.String> listStaticImages​(Grant g,
                                                                        java.lang.String folder,
                                                                        javax.servlet.http.HttpServletRequest request)
        List folders or files in /images
        Parameters:
        g - User rights
        folder - Path relative to /images
        request - Request
        Returns:
        List of sub-folders or image names
      • readStaticImage

        public static void readStaticImage​(Grant g,
                                           java.lang.String code,
                                           java.lang.String folder,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws java.io.IOException
        Read static image
        Parameters:
        g - Grant
        code - Code
        folder - Optional folder
        request - HTTP request
        response - HTTP response
        Throws:
        java.io.IOException
      • readImage

        public static void readImage​(Grant g,
                                     java.lang.String code,
                                     javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response)
                              throws java.io.IOException
        Lookup as static path (images/image/.png)
        Throws:
        java.io.IOException
      • readImage

        public static void readImage​(Grant g,
                                     java.io.File file,
                                     javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • readIcon

        public static Resource readIcon​(Grant g,
                                        java.lang.String type,
                                        java.lang.String code,
                                        java.lang.String object,
                                        java.lang.String objid,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws java.io.IOException
        Lookup in content/static/icons path
        Throws:
        java.io.IOException
      • rawdataservice

        public void rawdataservice​(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws PlatformException

        Raw data service (LOV or object)

        Parameters:
        request - HTTP request
        Throws:
        PlatformException
      • disco

        public java.lang.String disco​(javax.servlet.http.HttpServletRequest request)

        Generates DISCO directory of services for one module or for all modules

        Parameters:
        request - HTTP request
        Returns:
        DISCO directory
      • disco

        public java.lang.String disco​(java.lang.String[] objects,
                                      java.lang.String moduleName,
                                      boolean application,
                                      boolean document)
                               throws java.lang.Exception

        Generates DISCO directory of services for one module or for all modules

        Parameters:
        moduleName - Module name or null
        application - Include application service ?
        document - Include document service ?
        Returns:
        DISCO directory
        Throws:
        java.lang.Exception