1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.transport.email; |
12 | |
|
13 | |
import org.mule.api.MuleContext; |
14 | |
import org.mule.api.construct.FlowConstruct; |
15 | |
import org.mule.api.endpoint.InboundEndpoint; |
16 | |
import org.mule.api.transport.MessageReceiver; |
17 | |
|
18 | |
import javax.mail.Flags; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
public abstract class AbstractRetrieveMailConnector extends AbstractMailConnector |
25 | |
{ |
26 | |
public static final int DEFAULT_CHECK_FREQUENCY = 60000; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 0 | private volatile long checkFrequency = DEFAULT_CHECK_FREQUENCY; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | private volatile String backupFolder = null; |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | 0 | private volatile String moveToFolder = null; |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | 0 | private boolean backupEnabled = false; |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | 0 | private volatile boolean deleteReadMessages = true; |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | 0 | private Flags.Flag defaultProcessMessageAction = Flags.Flag.SEEN; |
58 | |
|
59 | |
|
60 | |
protected AbstractRetrieveMailConnector(int defaultPort, MuleContext context) |
61 | |
{ |
62 | 0 | super(defaultPort, MAILBOX, context); |
63 | 0 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
public long getCheckFrequency() |
69 | |
{ |
70 | 0 | return checkFrequency; |
71 | |
} |
72 | |
|
73 | |
public void setCheckFrequency(long l) |
74 | |
{ |
75 | 0 | if (l < 1) |
76 | |
{ |
77 | 0 | l = DEFAULT_CHECK_FREQUENCY; |
78 | |
} |
79 | 0 | checkFrequency = l; |
80 | 0 | } |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
public String getBackupFolder() |
86 | |
{ |
87 | 0 | return backupFolder; |
88 | |
} |
89 | |
|
90 | |
public void setBackupFolder(String string) |
91 | |
{ |
92 | 0 | backupFolder = string; |
93 | 0 | } |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
public MessageReceiver createReceiver(FlowConstruct flowConstruct, InboundEndpoint endpoint) throws Exception |
99 | |
{ |
100 | 0 | Object[] args = {checkFrequency, isBackupEnabled(), backupFolder}; |
101 | 0 | return serviceDescriptor.createMessageReceiver(this, flowConstruct, endpoint, args); |
102 | |
} |
103 | |
|
104 | |
public boolean isDeleteReadMessages() |
105 | |
{ |
106 | 0 | return deleteReadMessages; |
107 | |
} |
108 | |
|
109 | |
public void setDeleteReadMessages(boolean deleteReadMessages) |
110 | |
{ |
111 | 0 | this.deleteReadMessages = deleteReadMessages; |
112 | 0 | } |
113 | |
|
114 | |
public boolean isBackupEnabled() |
115 | |
{ |
116 | 0 | return backupEnabled; |
117 | |
} |
118 | |
|
119 | |
public void setBackupEnabled(boolean backupEnabled) |
120 | |
{ |
121 | 0 | this.backupEnabled = backupEnabled; |
122 | 0 | } |
123 | |
|
124 | |
public String getMoveToFolder() |
125 | |
{ |
126 | 0 | return moveToFolder; |
127 | |
} |
128 | |
|
129 | |
public void setMoveToFolder(String moveToFolder) |
130 | |
{ |
131 | 0 | this.moveToFolder = moveToFolder; |
132 | 0 | } |
133 | |
|
134 | |
public Flags.Flag getDefaultProcessMessageAction() |
135 | |
{ |
136 | 0 | return defaultProcessMessageAction; |
137 | |
} |
138 | |
|
139 | |
public void setDefaultProcessMessageAction(Flags.Flag defaultProcessMessageAction) |
140 | |
{ |
141 | 0 | this.defaultProcessMessageAction = defaultProcessMessageAction; |
142 | 0 | } |
143 | |
} |