Class AbstractRestServicePublishService

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Integer addMapping​(java.lang.String url, java.lang.String name, java.lang.String target, java.lang.String cookie)  
      protected java.lang.Class<?> createProxyClass​(IServiceIdentifier serviceid, java.lang.ClassLoader classloader, java.lang.Class<?> baseclass, java.util.Map<java.lang.String,​java.lang.Object> mapprops, java.util.List<RestMethodInfo> geninfos)
      Create a service proxy class.
      static byte[] digest​(byte[] input)
      Build the digest given the timestamp and password.
      static byte[] digest​(java.lang.String input)
      Build the digest given the timestamp and password.
      protected java.lang.Class<?> getProxyClass​(IServiceIdentifier serviceid, java.lang.ClassLoader classloader, java.lang.Class<?> baseclass, java.util.Map<java.lang.String,​java.lang.Object> mapprops)
      Get or generate a proxy class.
      java.lang.Object getServiceInfo​(java.lang.Object[] params, java.lang.String sig)
      Functionality blueprint for get service info web method.
      static java.lang.String hex​(byte[] data)
      Convert to hex value.
      java.lang.Void initWebProxyRefresh​(java.lang.String url, java.lang.String name, java.lang.String target, java.lang.String user, java.lang.String pass, IServiceIdentifier sid)  
      abstract void internalPublishService​(java.net.URI uri, org.glassfish.jersey.server.ResourceConfig rc, IServiceIdentifier sid, PublishInfo info)  
      java.lang.Object invoke​(java.lang.Object[] params, java.lang.String sig)
      Method that is invoked when rest service is called.
      abstract boolean isPublished​(IServiceIdentifier sid)
      Test if a service is published.
      IFuture<java.lang.Boolean> isSupported​(java.lang.String publishtype)
      Test if publishing a specific type is supported (e.g. web service).
      protected java.lang.String login​(java.lang.String url, java.lang.String user, java.lang.String pass)  
      protected java.util.Map<java.lang.String,​java.lang.String> parseHeader​(java.lang.String header, java.lang.String delims)
      Convert header to key value pairs.
      abstract IFuture<java.lang.Void> publishExternal​(java.net.URI uri, java.lang.String rootpath)
      Publish file resources from the file system.
      abstract IFuture<java.lang.Void> publishHMTLPage​(java.lang.String uri, java.lang.String vhost, java.lang.String html)
      Publish an html page.
      abstract IFuture<java.lang.Void> publishResources​(java.lang.String uri, java.lang.String path)
      Publish resources via a rel jar path.
      IFuture<java.lang.Void> publishService​(IServiceIdentifier serviceid, PublishInfo pi)
      Publish a service.
      abstract IFuture<java.lang.Void> unpublishService​(IServiceIdentifier sid)
      Unpublish a service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • GENERATE

        public static final java.lang.String GENERATE
        Constant for boolean flag if automatic generation should be used.
        See Also:
        Constant Field Values
      • FORMATS

        public static final java.lang.String FORMATS
        Constant for String[] for supported parameter media types.
        See Also:
        Constant Field Values
      • GENERATE_INFO

        public static final java.lang.String GENERATE_INFO
        Constant for boolean.
        See Also:
        Constant Field Values
      • DEFAULT_FORMATS

        public static final javax.ws.rs.core.MediaType[] DEFAULT_FORMATS
        The default media formats.
      • JADEXSERVICE

        public static final java.lang.String JADEXSERVICE
        The service constant.
        See Also:
        Constant Field Values
      • proxyclasses

        protected LRU<Tuple2<java.lang.Class<?>,​java.lang.Class<?>>,​java.lang.Class<?>> proxyclasses
        The proxy classes.
    • Constructor Detail

      • AbstractRestServicePublishService

        public AbstractRestServicePublishService()
        Create a new publish service.
      • AbstractRestServicePublishService

        public AbstractRestServicePublishService​(IRestMethodGenerator generator)
        Create a new publish service.
    • Method Detail

      • isSupported

        public IFuture<java.lang.Boolean> isSupported​(java.lang.String publishtype)
        Test if publishing a specific type is supported (e.g. web service).
        Specified by:
        isSupported in interface IPublishService
        Parameters:
        publishtype - The type to test.
        Returns:
        True, if can be published.
      • getProxyClass

        protected java.lang.Class<?> getProxyClass​(IServiceIdentifier serviceid,
                                                   java.lang.ClassLoader classloader,
                                                   java.lang.Class<?> baseclass,
                                                   java.util.Map<java.lang.String,​java.lang.Object> mapprops)
                                            throws java.lang.Exception
        Get or generate a proxy class.
        Throws:
        java.lang.Exception
      • internalPublishService

        public abstract void internalPublishService​(java.net.URI uri,
                                                    org.glassfish.jersey.server.ResourceConfig rc,
                                                    IServiceIdentifier sid,
                                                    PublishInfo info)
      • publishHMTLPage

        public abstract IFuture<java.lang.Void> publishHMTLPage​(java.lang.String uri,
                                                                java.lang.String vhost,
                                                                java.lang.String html)
        Publish an html page.
        Specified by:
        publishHMTLPage in interface IWebPublishService
      • publishResources

        public abstract IFuture<java.lang.Void> publishResources​(java.lang.String uri,
                                                                 java.lang.String path)
        Publish resources via a rel jar path. The resources are searched with respect to the component classloader (todo: allow for specifiying RID).
        Specified by:
        publishResources in interface IWebPublishService
      • publishExternal

        public abstract IFuture<java.lang.Void> publishExternal​(java.net.URI uri,
                                                                java.lang.String rootpath)
        Publish file resources from the file system.
      • createProxyClass

        protected java.lang.Class<?> createProxyClass​(IServiceIdentifier serviceid,
                                                      java.lang.ClassLoader classloader,
                                                      java.lang.Class<?> baseclass,
                                                      java.util.Map<java.lang.String,​java.lang.Object> mapprops,
                                                      java.util.List<RestMethodInfo> geninfos)
                                               throws java.lang.Exception
        Create a service proxy class.
        Parameters:
        service - The Jadex service.
        classloader - The classloader.
        type - The web service interface type.
        Returns:
        The proxy object.
        Throws:
        java.lang.Exception
      • initWebProxyRefresh

        public java.lang.Void initWebProxyRefresh​(java.lang.String url,
                                                  java.lang.String name,
                                                  java.lang.String target,
                                                  java.lang.String user,
                                                  java.lang.String pass,
                                                  IServiceIdentifier sid)
      • login

        protected java.lang.String login​(java.lang.String url,
                                         java.lang.String user,
                                         java.lang.String pass)
      • addMapping

        protected java.lang.Integer addMapping​(java.lang.String url,
                                               java.lang.String name,
                                               java.lang.String target,
                                               java.lang.String cookie)
      • invoke

        public java.lang.Object invoke​(java.lang.Object[] params,
                                       java.lang.String sig)
        Method that is invoked when rest service is called. Functionality blueprint for all service methods.
        Parameters:
        params - The parameters.
        Returns:
        The result.
      • getServiceInfo

        public java.lang.Object getServiceInfo​(java.lang.Object[] params,
                                               java.lang.String sig)
        Functionality blueprint for get service info web method. Creates a html page with css for style and javascript for ajax post requests. The service info site contains a section for each published method.
        Parameters:
        params - The parameters.
        Returns:
        The result.
      • isPublished

        public abstract boolean isPublished​(IServiceIdentifier sid)
        Test if a service is published.
      • hex

        public static java.lang.String hex​(byte[] data)
        Convert to hex value.
      • digest

        public static byte[] digest​(java.lang.String input)
        Build the digest given the timestamp and password.
      • digest

        public static byte[] digest​(byte[] input)
        Build the digest given the timestamp and password.
      • parseHeader

        protected java.util.Map<java.lang.String,​java.lang.String> parseHeader​(java.lang.String header,
                                                                                     java.lang.String delims)
        Convert header to key value pairs.