Changeset 585:62af773a1f92

Show
Ignore:
Timestamp:
09/30/09 14:58:23 (4 years ago)
Author:
tgambet
Branch:
default
convert_revision:
svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@586
Message:

fixed method negotiation was broken
+ changed InputModule? constructor visibility to public

Location:
src/org/w3c/unicorn
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • src/org/w3c/unicorn/UnicornCall.java

    r580 r585  
    1 // $Id: UnicornCall.java,v 1.28 2009-09-30 13:40:36 tgambet Exp $ 
     1// $Id: UnicornCall.java,v 1.29 2009-09-30 14:58:22 tgambet Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    2121import org.w3c.unicorn.exceptions.UnicornException; 
    2222import org.w3c.unicorn.input.InputParameter; 
     23import org.w3c.unicorn.input.*; 
    2324import org.w3c.unicorn.request.Request; 
    2425import org.w3c.unicorn.request.RequestList; 
     
    171172                        final Request aRequest = Request.createRequest( 
    172173                        // the corresponding best input module 
    173                                         //aInputFactory.getInputModule(aInputMethod.getMethod()), 
    174                                         inputParameter.getInputModule(), 
     174                                        //InputFactory.getInputModule(aInputMethod.getMethod()), 
     175                                        createInputModule(aInputMethod, inputParameter.getInputModule()), 
    175176                                        // URL of the service to call 
    176177                                        aInputMethod.getCallMethod().getURL().toString(), 
     
    549550                this.messages = messages; 
    550551        } 
     552         
     553        public InputModule createInputModule(InputMethod aInputMethod, InputModule inputModule) { 
     554                if (aInputMethod.getMethod() == inputModule.getEnumInputMethod()) { 
     555                        return inputModule; 
     556                } 
     557                 
     558                try { 
     559                        switch (aInputMethod.getMethod()) { 
     560                        case DIRECT: 
     561                                return new DirectInputModule(inputModule); 
     562                        case UPLOAD: 
     563                                return new FakeUploadInputModule(inputModule); 
     564                                //return new FileItemInputModule(inputModule); 
     565                        case URI: 
     566                                return new URIInputModule(inputModule); 
     567                        default: 
     568                                return null; 
     569                        } 
     570                } catch (IOException e) { 
     571                        logger.error(e.getMessage(), e); 
     572                        return null; 
     573                } 
     574        } 
     575 
    551576} 
  • src/org/w3c/unicorn/input/DirectInputModule.java

    r493 r585  
    1 // $Id: DirectInputModule.java,v 1.3 2009-09-23 09:17:03 tgambet Exp $ 
     1// $Id: DirectInputModule.java,v 1.4 2009-09-30 14:58:23 tgambet Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    6262         *             for unknown error 
    6363         */ 
    64         protected DirectInputModule(final InputModule aInputModule) 
     64        public DirectInputModule(final InputModule aInputModule) 
    6565                        throws IOException { 
    6666                logger.trace("Constructor"); 
  • src/org/w3c/unicorn/input/FakeUploadInputModule.java

    r493 r585  
    1 // $Id: FakeUploadInputModule.java,v 1.3 2009-09-23 09:17:03 tgambet Exp $ 
     1// $Id: FakeUploadInputModule.java,v 1.4 2009-09-30 14:58:23 tgambet Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    4848         * @throws IOException 
    4949         */ 
    50         protected FakeUploadInputModule(final InputModule aInputModule) 
     50        public FakeUploadInputModule(final InputModule aInputModule) 
    5151                        throws IOException { 
    5252                logger.trace("Constructor"); 
  • src/org/w3c/unicorn/input/URIInputModule.java

    r493 r585  
    1 // $Id: URIInputModule.java,v 1.4 2009-09-23 09:17:03 tgambet Exp $ 
     1// $Id: URIInputModule.java,v 1.5 2009-09-30 14:58:23 tgambet Exp $ 
    22// Author: Damien LEROY. 
    33// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006. 
     
    1414 
    1515import org.apache.commons.lang.StringEscapeUtils; 
     16import org.apache.commons.logging.Log; 
     17import org.apache.commons.logging.LogFactory; 
    1618import org.w3c.unicorn.contract.EnumInputMethod; 
    1719import org.w3c.unicorn.util.Property; 
     
    2426public class URIInputModule implements InputModule { 
    2527 
     28        public static final Log logger = LogFactory.getLog(URIInputModule.class); 
     29         
    2630        /** 
    2731         * Sets the method of input to URI 
     
    7377         *             odd error occurs 
    7478         */ 
    75         protected URIInputModule(final InputModule aInputModule) throws IOException { 
     79        public URIInputModule(final InputModule aInputModule) throws IOException { 
    7680                logger.trace("Constructor."); 
    7781                logger.debug("InputModule : " + aInputModule + ".");