View Javadoc
1   /*
2    * This file is part of Waarp Project (named also Waarp or GG).
3    *
4    *  Copyright (c) 2019, Waarp SAS, and individual contributors by the @author
5    *  tags. See the COPYRIGHT.txt in the distribution for a full listing of
6    * individual contributors.
7    *
8    *  All Waarp Project is free software: you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License, or (at your
11   * option) any later version.
12   *
13   * Waarp is distributed in the hope that it will be useful, but WITHOUT ANY
14   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15   * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16   *
17   *  You should have received a copy of the GNU General Public License along with
18   * Waarp . If not, see <http://www.gnu.org/licenses/>.
19   */
20  package org.waarp.openr66.context.task.test;
21  
22  import org.waarp.common.logging.WaarpLogger;
23  import org.waarp.common.logging.WaarpLoggerFactory;
24  import org.waarp.openr66.context.R66BusinessFactoryInterface;
25  import org.waarp.openr66.context.R66BusinessInterface;
26  import org.waarp.openr66.context.R66Session;
27  import org.waarp.openr66.context.task.exception.OpenR66RunnerErrorException;
28  
29  /**
30   * Example dummy Business Factory which only generates Log Business
31   */
32  public class TestBusinessFactory implements R66BusinessFactoryInterface {
33  
34    /**
35     * Empry constructor
36     */
37    public TestBusinessFactory() {
38      // nothing
39    }
40  
41    @Override
42    public R66BusinessInterface getBusinessInterface(final R66Session session) {
43      return new R66BusinessInterface() {
44        /**
45         * Internal Logger
46         */
47        private final WaarpLogger logger =
48            WaarpLoggerFactory.getLogger(R66BusinessInterface.class);
49        private String info;
50  
51        @Override
52        public void setInfo(final R66Session session, final String info) {
53          logger.warn("setInfo: " + session + " = " + info);
54          this.info = info;
55        }
56  
57        @Override
58        public void releaseResources(final R66Session session) {
59          logger.warn("releaseResources: " + session);
60        }
61  
62        @Override
63        public String getInfo(final R66Session session) {
64          return info;
65        }
66  
67        @Override
68        public void checkAtStartup(final R66Session session)
69            throws OpenR66RunnerErrorException {
70          logger.warn("checkAtStartup: " + session);
71        }
72  
73        @Override
74        public void checkAtError(final R66Session session) {
75          logger.warn("checkAtError: " + session);
76        }
77  
78        @Override
79        public void checkAtConnection(final R66Session session)
80            throws OpenR66RunnerErrorException {
81          logger.warn("checkAtConnection: " + session);
82        }
83  
84        @Override
85        public void checkAtChangeFilename(final R66Session session)
86            throws OpenR66RunnerErrorException {
87          logger.warn("checkAtChangeFilename: " + session);
88        }
89  
90        @Override
91        public void checkAtAuthentication(final R66Session session)
92            throws OpenR66RunnerErrorException {
93          logger.warn("checkAtAuthentication: " + session);
94        }
95  
96        @Override
97        public void checkAfterTransfer(final R66Session session)
98            throws OpenR66RunnerErrorException {
99          logger.warn("checkAfterTransfer: " + session);
100       }
101 
102       @Override
103       public void checkAfterPreCommand(final R66Session session)
104           throws OpenR66RunnerErrorException {
105         logger.warn("checkAfterPreCommand: " + session);
106       }
107 
108       @Override
109       public void checkAfterPost(final R66Session session)
110           throws OpenR66RunnerErrorException {
111         logger.warn("checkAfterPost: " + session);
112       }
113     };
114   }
115 
116   @Override
117   public void releaseResources() {
118     // nothing
119   }
120 
121 }