Home » synapse-1.2-src » org.apache.synapse.transport.vfs » [javadoc | source]

    1   /*
    2   *  Licensed to the Apache Software Foundation (ASF) under one
    3   *  or more contributor license agreements.  See the NOTICE file
    4   *  distributed with this work for additional information
    5   *  regarding copyright ownership.  The ASF licenses this file
    6   *  to you under the Apache License, Version 2.0 (the
    7   *  "License"); you may not use this file except in compliance
    8   *  with the License.  You may obtain a copy of the License at
    9   *
   10   *   http://www.apache.org/licenses/LICENSE-2.0
   11   *
   12   *  Unless required by applicable law or agreed to in writing,
   13   *  software distributed under the License is distributed on an
   14   *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15   *  KIND, either express or implied.  See the License for the
   16   *  specific language governing permissions and limitations
   17   *  under the License.
   18   */
   19   package org.apache.synapse.transport.vfs;
   20   
   21   import java.text.SimpleDateFormat;
   22   import java.text.DateFormat;
   23   
   24   /**
   25    * Holds information about an entry in the VFS transport poll table used by the
   26    * VFS Transport Listener
   27    */
   28   public class PollTableEntry {
   29   
   30       // status of last scan
   31       public static final int SUCCSESSFUL = 0;
   32       public static final int WITH_ERRORS = 1;
   33       public static final int FAILED      = 2;
   34       public static final int NONE        = 3;
   35   
   36       // operation after scan
   37       public static final int DELETE = 0;
   38       public static final int MOVE   = 1;
   39   
   40       /** Axis2 service name */
   41       private String serviceName;
   42       /** File or Directory to scan */
   43       private String fileURI;
   44       /** file name pattern for a directory or compressed file entry */
   45       private String fileNamePattern;
   46       /** Content-Type to use for the message */
   47       private String contentType;
   48   
   49       /** last poll performed at */
   50       private long lastPollTime;
   51       /** duration in ms between successive polls */
   52       private long pollInterval;
   53       /** next poll time */
   54       private long nextPollTime;
   55       /** state of the last poll */
   56       private int lastPollState;
   57       /** action to take after a successful poll */
   58       private int actionAfterProcess = DELETE;
   59       /** action to take after a poll with errors */
   60       private int actionAfterErrors = DELETE;
   61       /** action to take after a failed poll */
   62       private int actionAfterFailure = DELETE;
   63   
   64       /** where to move the file after processing */
   65       private String moveAfterProcess;
   66       /** where to move the file after encountering some errors */
   67       private String moveAfterErrors;
   68       /** where to move the file after total failure */
   69       private String moveAfterFailure;
   70       /** moved file will have this formatted timestamp prefix */    
   71       private DateFormat moveTimestampFormat;
   72   
   73       private int maxRetryCount;
   74       private long reconnectTimeout;
   75   
   76       public String getServiceName() {
   77           return serviceName;
   78       }
   79   
   80       public void setServiceName(String serviceName) {
   81           this.serviceName = serviceName;
   82       }
   83   
   84       public String getFileURI() {
   85           return fileURI;
   86       }
   87   
   88       public void setFileURI(String fileURI) {
   89           if (fileURI.startsWith(VFSConstants.VFS_PREFIX)) {
   90               this.fileURI = fileURI.substring(VFSConstants.VFS_PREFIX.length());
   91           } else {
   92               this.fileURI = fileURI;
   93           }
   94       }
   95   
   96       public String getFileNamePattern() {
   97           return fileNamePattern;
   98       }
   99   
  100       public void setFileNamePattern(String fileNamePattern) {
  101           this.fileNamePattern = fileNamePattern;
  102       }
  103   
  104       public String getContentType() {
  105           return contentType;
  106       }
  107   
  108       public void setContentType(String contentType) {
  109           this.contentType = contentType;
  110       }
  111   
  112       public long getLastPollTime() {
  113           return lastPollTime;
  114       }
  115   
  116       public void setLastPollTime(long lastPollTime) {
  117           this.lastPollTime = lastPollTime;
  118       }
  119   
  120       public long getPollInterval() {
  121           return pollInterval;
  122       }
  123   
  124       public void setPollInterval(long pollInterval) {
  125           this.pollInterval = pollInterval;
  126       }
  127   
  128       public long getNextPollTime() {
  129           return nextPollTime;
  130       }
  131   
  132       public void setNextPollTime(long nextPollTime) {
  133           this.nextPollTime = nextPollTime;
  134       }
  135   
  136       public int getLastPollState() {
  137           return lastPollState;
  138       }
  139   
  140       public void setLastPollState(int lastPollState) {
  141           this.lastPollState = lastPollState;
  142       }
  143   
  144       public int getActionAfterProcess() {
  145           return actionAfterProcess;
  146       }
  147   
  148       public void setActionAfterProcess(int actionAfterProcess) {
  149           this.actionAfterProcess = actionAfterProcess;
  150       }
  151   
  152       public int getActionAfterErrors() {
  153           return actionAfterErrors;
  154       }
  155   
  156       public void setActionAfterErrors(int actionAfterErrors) {
  157           this.actionAfterErrors = actionAfterErrors;
  158       }
  159   
  160       public int getActionAfterFailure() {
  161           return actionAfterFailure;
  162       }
  163   
  164       public void setActionAfterFailure(int actionAfterFailure) {
  165           this.actionAfterFailure = actionAfterFailure;
  166       }
  167   
  168       public String getMoveAfterProcess() {
  169           return moveAfterProcess;
  170       }
  171   
  172       public void setMoveAfterProcess(String moveAfterProcess) {
  173           if (moveAfterProcess == null) {
  174               this.moveAfterProcess = null;
  175           } else if (moveAfterProcess.startsWith(VFSConstants.VFS_PREFIX)) {
  176               // to recover a good directory location if user entered with the vfs: prefix
  177               // because transport uris are given like that
  178               this.moveAfterProcess = moveAfterProcess.substring(VFSConstants.VFS_PREFIX.length());
  179           } else {
  180               this.moveAfterProcess = moveAfterProcess;
  181           }
  182       }
  183   
  184       public String getMoveAfterErrors() {
  185           return moveAfterErrors;
  186       }
  187   
  188       public void setMoveAfterErrors(String moveAfterErrors) {
  189           if (moveAfterErrors == null) {
  190               this.moveAfterErrors = null;
  191           } else if (moveAfterErrors.startsWith(VFSConstants.VFS_PREFIX)) {
  192               this.moveAfterErrors = moveAfterErrors.substring(VFSConstants.VFS_PREFIX.length());
  193           } else {
  194               this.moveAfterErrors = moveAfterErrors;
  195           }  
  196       }
  197   
  198       public String getMoveAfterFailure() {
  199           return moveAfterFailure;
  200       }
  201   
  202       public void setMoveAfterFailure(String moveAfterFailure) {
  203           if (moveAfterFailure == null) {
  204               this.moveAfterFailure = null;
  205           } else if (moveAfterFailure.startsWith(VFSConstants.VFS_PREFIX)) {
  206               this.moveAfterFailure = moveAfterFailure.substring(VFSConstants.VFS_PREFIX.length());
  207           } else {
  208               this.moveAfterFailure = moveAfterFailure;
  209           }
  210       }
  211   
  212       public int getMaxRetryCount() {
  213         return maxRetryCount;
  214       }
  215   
  216       public void setMaxRetryCount(int maxRetryCount) {
  217         this.maxRetryCount = maxRetryCount;
  218       }
  219   
  220       public long getReconnectTimeout() {
  221         return reconnectTimeout;
  222       }
  223   
  224       public void setReconnectTimeout(long reconnectTimeout) {
  225         this.reconnectTimeout = reconnectTimeout;
  226       }
  227   
  228       public DateFormat getMoveTimestampFormat() {
  229           return moveTimestampFormat;
  230       }
  231   
  232       public void setMoveTimestampFormat(DateFormat moveTimestampFormat) {
  233           this.moveTimestampFormat = moveTimestampFormat;
  234       }
  235   }

Home » synapse-1.2-src » org.apache.synapse.transport.vfs » [javadoc | source]