axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rineh...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/client Call.java
Date Tue, 12 Feb 2002 12:46:23 GMT
rineholt    02/02/12 04:46:23

  Modified:    java/src/org/apache/axis AxisEngine.java Message.java
               java/src/org/apache/axis/client Call.java
  Log:
  Allow the attachment implementation to be pluggable.
  
  Revision  Changes    Path
  1.68      +18 -0     xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- AxisEngine.java	8 Feb 2002 03:09:25 -0000	1.67
  +++ AxisEngine.java	12 Feb 2002 12:46:23 -0000	1.68
  @@ -99,8 +99,11 @@
       public static final String PROP_SYNC_CONFIG = "syncConfiguration";
       public static final String PROP_SEND_XSI = "sendXsiTypes";
       public static final String PROP_ATTACHMENT_DIR = "attachments.Directory";
  +    public static final String PROP_ATTACHMENT_IMPLEMENTATION  = "attachments.implementation"
;
       public static final String PROP_ATTACHMENT_CLEANUP = "attachment.DirectoryCleanUp";
   
  +    public static final String DEFAULT_ATTACHMENT_IMPL="org.apache.axis.attachments.AttachmentsImpl";
  +
       // Default admin. password
       private static final String DEFAULT_ADMIN_PASSWORD = "admin";
   
  @@ -188,6 +191,21 @@
   
           if (category.isDebugEnabled()) {
               category.debug(JavaUtils.getMessage("exit00", "AxisEngine::init"));
  +        }
  +
  +        /*Set the default attachment implementation */
  +
  +        String attachmentsImp= null;
  +        try{
  +            attachmentsImp=System.getProperty("axis." + PROP_ATTACHMENT_IMPLEMENTATION
 );
  +            if(null!=attachmentsImp)
  +                setOption(PROP_ATTACHMENT_IMPLEMENTATION, attachmentsImp);
  +        } catch(Throwable t){attachmentsImp= null;} 
  +
  +        if(attachmentsImp == null ){
  +            if((attachmentsImp= (String) getOption(PROP_ATTACHMENT_IMPLEMENTATION)) ==
null){
  +                  setOption(PROP_ATTACHMENT_IMPLEMENTATION, DEFAULT_ATTACHMENT_IMPL);
  +            }
           }
       }
   
  
  
  
  1.59      +14 -3     xml-axis/java/src/org/apache/axis/Message.java
  
  Index: Message.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Message.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- Message.java	12 Dec 2001 17:35:11 -0000	1.58
  +++ Message.java	12 Feb 2002 12:46:23 -0000	1.59
  @@ -184,20 +184,31 @@
   
       private static boolean attachmentSupportEnabled = false;
   
  -    public static boolean isAttachmentSupportEnabled() {
  +    public boolean isAttachmentSupportEnabled() {
           if (checkForAttchmentSupport) {
               //aviod testing and possibly failing everytime.
               checkForAttchmentSupport = false;
               Class mailapiclass = null;
               Class dataHandlerclass = null;
               try {
  +                String attachImpName= AxisEngine.DEFAULT_ATTACHMENT_IMPL;
  +                MessageContext mc= getMessageContext();
  +                if(null != mc){
  +                    AxisEngine ae= mc.getAxisEngine();
  +                    if(null != ae){ 
  +                      attachImpName= (String)ae.getOption(
  +                        AxisEngine.PROP_ATTACHMENT_IMPLEMENTATION);
  +                    }
  +                }
  +                if(null == attachImpName){
  +                    attachImpName=AxisEngine.DEFAULT_ATTACHMENT_IMPL;
  +                }
                   dataHandlerclass = 
                           Class.forName("javax.activation.DataHandler");
                   mailapiclass = 
                           Class.forName("javax.mail.internet.MimeMultipart");
                   attachImpl = 
  -                        Class.forName(
  -                                "org.apache.axis.attachments.AttachmentsImpl");
  +                        Class.forName(attachImpName);
                   attachmentSupportEnabled = true;
               } catch (ClassNotFoundException ex) {
                   // no support for it, leave mAttachments null.
  
  
  
  1.72      +0 -3      xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- Call.java	11 Feb 2002 15:03:59 -0000	1.71
  +++ Call.java	12 Feb 2002 12:46:23 -0000	1.72
  @@ -1698,9 +1698,6 @@
        *
        */
        public void addAttachmentPart( Object attachment){
  -         if(!Message.isAttachmentSupportEnabled()){
  -              throw new RuntimeException("No support for attachments");
  -         }
            attachmentParts.add(attachment);
        }
   }
  
  
  

Mime
View raw message