|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gridgain.grid.spi.GridSpiAdapter
org.gridgain.grid.spi.discovery.mail.GridMailDiscoverySpi
@GridSpiInfo(author="GridGain Systems",
url="www.gridgain.org",
email="support@gridgain.com",
version="x.x")
@GridSpiMultipleInstancesSupport(value=true)
public class GridMailDiscoverySpi
Email implementation of GridDiscoverySpi. Email discovery is
provided for cases where nodes from different networks need to participate
in a grid. When working with email discovery, make sure that maximum send/receive
limit set by mail server is not exceeded. Sometimes it is better to configure
your own mail server to avoid such limitations.
GridMailDiscoverySpi.setOutHost(String)).GridMailDiscoverySpi.setInHost(String)).GridMailDiscoverySpi.setFromAddress(String)).GridMailDiscoverySpi.setBroadcastAddress(String)).GridMailDiscoverySpi.setHeartbeatFrequency(long)GridMailDiscoverySpi.setReceiverDelay(long)GridMailDiscoverySpi.setPingResponseWait(long)GridMailDiscoverySpi.setMaxMissedHeartbeats(long)GridMailDiscoverySpi.setLeaveMessagesOnServer(long)GridMailDiscoverySpi.setOutUsername(String)GridMailDiscoverySpi.setOutPassword(String)GridMailDiscoverySpi.setOutConnectionType(GridMailDiscoveryType))GridMailDiscoverySpi.setOutProtocol(GridMailDiscoveryOutProtocol) GridMailDiscoverySpi.setOutPort(int)GridMailDiscoverySpi.setOutCustomProperties(Properties)GridMailDiscoverySpi.setInConnectionType(GridMailDiscoveryType)GridMailDiscoverySpi.setInPort(int)GridMailDiscoverySpi.setInUsername(String)GridMailDiscoverySpi.setInPassword(String)GridMailDiscoverySpi.setInCustomProperties(Properties)GridMailDiscoverySpi.setInProtocol(GridMailDiscoveryInProtocol) GridMailDiscoverySpi.setSubject(String)GridMailDiscoverySpi.setFolderName(String)GridMailDiscoverySpi.setStoreFileName(String) GridMailDiscoverySpi.setReadBatchSize(int)
GridMailDiscoverySpi spi = new GridMailDiscoverySpi();
// Inbox configuration.
spi.setInHost("pop.google.com");
// Outbox configuration.
spi.setOutHost("smtp.google.com");
// Incoming/outgoing e-mail address configuration.
spi.setFromAddress("grid@google.com");
// Broadcast address.
spi.setBroadcastAddress("grid-broadcast@google.com")
GridConfigurationAdapter cfg = new GridConfigurationAdapter();
// Override default discovery SPI.
cfg.setDiscoverySpi(spi);
// Start grid.
GridFactory.start(cfg);
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
...
<property name="discoverySpi">
<bean class="org.gridgain.grid.spi.discovery.mail.GridMailDiscoverySpi">
<property name="outHost" value="smtp.google.com"/>
<property name="inHost" value="pop.google.com"/>
<property name="fromAddress" value="grid@google.com"/>
<property name="broadcastAddress" value="grid-broadcast@google.com"/>
</bean>
</property>
...
</bean>
For information about Spring framework visit www.springframework.org
See Also:
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0
GridDiscoverySpi
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static long |
DFLT_HEARTBEAT_FREQ
Default heartbeat delay (value is 60000). |
static long |
DFLT_LEAVE_MSGS_ON_SERVER
Leave messages on server in milliseconds (value is ( GridMailDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS + 2) * GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ). |
static String |
DFLT_MAIL_SUBJECT
Default subject of email (value is grid.email.discovery.msg). |
static int |
DFLT_MAX_MISSED_HEARTBEATS
Default number of heartbeat messages that could be missed (value is 3). |
static long |
DFLT_PING_WAIT
Default ping wait timeout (value is GridMailDiscoverySpi.DFLT_RECEIVER_DELAY * 2). |
static long |
DFLT_RECEIVER_DELAY
Delay in milliseconds between receiving email (value is 30000). |
static String |
DFLT_STORE_FILE_NAME
Default local storage file name (value is grid-email-discovery-msgs.dat). |
| Constructor Summary | |
|---|---|
GridMailDiscoverySpi()
Creates discovery SPI. |
|
| Method Summary | |
|---|---|
String |
getBroadcastAddress()
Gets broadcast address used for sending broadcast messages. |
protected List<String> |
getConsistentAttributeNames()
Returns back list of attributes that should be consistent for this SPI. |
String |
getFolderName()
Gets folder name for incoming mail. |
String |
getFromAddress()
Gets message field 'From' all email messages. |
long |
getHeartbeatFrequency()
Gets delay between heartbeat requests. |
String |
getInConnectionTypeFormatted()
Gets type of ingoing mail connection. |
Properties |
getInCustomProperties()
Gets custom properties required for receiving connection. |
String |
getInHost()
Gets incoming host name for receiving email. |
int |
getInPort()
Gets port number for incoming mail. |
String |
getInProtocolFormatted()
Gets incoming mail protocol. |
String |
getInUsername()
Gets username for incoming mail authentication. |
long |
getLeaveMessagesOnServer()
Gets incoming messages life-time on mail server in milliseconds. |
GridNode |
getLocalNode()
Gets local node. |
long |
getMaximumMissedHeartbeats()
Gets number of heartbeat requests that could be missed before remote node is considered to be failed. |
GridNode |
getNode(UUID nodeId)
Gets node by ID. |
Map<String,Serializable> |
getNodeAttributes()
This method is called before SPI starts (before method GridSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernel collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes. |
String |
getOutConnectionTypeFormatted()
Gets type of outgoing mail connection. |
Properties |
getOutCustomProperties()
Gets custom properties required for outgoing connection. |
String |
getOutHost()
Gets outgoing host name for sending email. |
int |
getOutPort()
Gets port number for outgoing mail. |
String |
getOutProtocolFormatted()
Gets outgoing mail protocol. |
String |
getOutUsername()
Gets username for outgoing mail authentication. |
long |
getPingResponseWait()
Gets ping wait timeout in milliseconds. |
int |
getReadBatchSize()
Gets number of messages fetched from mail server at a time. |
long |
getReceiverDelay()
Gets interval in milliseconds between checking for new messages. |
int |
getRemoteNodeCount()
Gets the number of remote nodes. |
Collection<UUID> |
getRemoteNodeIds()
Gets collection of remote nodes' IDs. |
List<GridNode> |
getRemoteNodes()
Gets collection of remote nodes in grid or empty collection if no remote nodes found. |
String |
getStoreFileName()
Gets locally stored full file name for all read messages. |
String |
getSubject()
Gets email message subject. |
boolean |
pingNode(UUID nodeId)
Pings the remote node to see if it's alive. |
void |
setBroadcastAddress(String bcastAddr)
Sets broadcast email address used by node to discover each other. |
void |
setFolderName(String folderName)
Sets name of email folder on mail server. |
void |
setFromAddress(String addr)
Sets 'From' address for all email messages. |
void |
setHeartbeatFrequency(long beatFreq)
Sets delay between heartbeat requests. |
void |
setInConnectionType(GridMailDiscoveryType type)
Sets type of incoming mail connection which should be one of the following: GridMailDiscoveryType.NONE
GridMailDiscoveryType.SSL
GridMailDiscoveryType.STARTTLS
If not provided the default value is GridMailDiscoveryType.NONE. |
void |
setInCustomProperties(Properties props)
Sets any custom properties required for receiving connection. |
void |
setInHost(String host)
Sets incoming host name for receiving email messages (usually either POP or IMAP). |
void |
setInPassword(String pswd)
Sets password for incoming mail authentication. |
void |
setInPort(int port)
Sets port number for incoming mail. |
void |
setInProtocol(GridMailDiscoveryInProtocol proto)
Sets incoming mail protocol. |
void |
setInUsername(String username)
Sets username for incoming mail authentication. |
void |
setLeaveMessagesOnServer(long leaveMsgsOnServer)
Sets incoming messages life-time on mail server in milliseconds. |
void |
setListener(GridDiscoveryListener listener)
Sets a listener for discovery events. |
void |
setMaxMissedHeartbeats(long maxMissedBeats)
Sets number of heartbeat requests that could be missed before remote node is considered to be failed. |
void |
setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
Sets discovery metrics provider. |
void |
setNodeAttributes(Map<String,Serializable> attrs)
Sets node attributes which will be distributed in grid during join process. |
void |
setOutConnectionType(GridMailDiscoveryType type)
Sets type of outgoing mail connection which should be one of the following: GridMailDiscoveryType.NONE
GridMailDiscoveryType.SSL
GridMailDiscoveryType.STARTTLS
If not provided the default value is GridMailDiscoveryType.NONE. |
void |
setOutCustomProperties(Properties props)
Sets any custom properties required for outgoing connection. |
void |
setOutHost(String host)
Sets outgoing host name for sending email messages (usually either SMTP or IMAP). |
void |
setOutPassword(String pswd)
Sets password for outgoing mail authentication. |
void |
setOutPort(int port)
Sets port number for outgoing mail. |
void |
setOutProtocol(GridMailDiscoveryOutProtocol proto)
Sets outgoing mail protocol. |
void |
setOutUsername(String username)
Sets username for outgoing mail authentication. |
void |
setPingResponseWait(long pingWait)
Sets ping node wait timeout in milliseconds. |
void |
setReadBatchSize(int readBatchSize)
Sets number of messages fetched from mail server at a time. |
void |
setReceiverDelay(long recvDelay)
Sets interval in milliseconds between checking for new messages. |
void |
setStoreFileName(String fileName)
Sets locally stored full file name for all read messages. |
void |
setSubject(String subj)
Sets email message subject. |
void |
spiStart(String gridName)
This method is called to start SPI. |
void |
spiStop()
This method is called to stop SPI. |
String |
toString()
|
| Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter |
|---|
assertParameter, configInfo, createSpiAttributeName, getAuthor, getGridGainHome, getLocalNodeId, getName, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, onContextDestroyed, onContextInitialized, registerMBean, setName, setSpiContext, startInfo, startStopwatch, stopInfo, unregisterMBean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gridgain.grid.spi.GridSpi |
|---|
getName, onContextDestroyed, onContextInitialized |
| Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean |
|---|
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion |
| Field Detail |
|---|
public static final long DFLT_HEARTBEAT_FREQ
public static final long DFLT_RECEIVER_DELAY
public static final long DFLT_PING_WAIT
GridMailDiscoverySpi.DFLT_RECEIVER_DELAY * 2).
public static final int DFLT_MAX_MISSED_HEARTBEATS
public static final long DFLT_LEAVE_MSGS_ON_SERVER
GridMailDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS + 2) * GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ).
public static final String DFLT_MAIL_SUBJECT
public static final String DFLT_STORE_FILE_NAME
| Constructor Detail |
|---|
public GridMailDiscoverySpi()
| Method Detail |
|---|
public long getHeartbeatFrequency()
getHeartbeatFrequency in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setHeartbeatFrequency(long beatFreq)
If not provided the default value is GridMailDiscoverySpi.DFLT_HEARTBEAT_FREQ.
beatFreq - Time in milliseconds.public long getReceiverDelay()
getReceiverDelay in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setReceiverDelay(long recvDelay)
If not provided the default value is GridMailDiscoverySpi.DFLT_RECEIVER_DELAY.
recvDelay - Interval between receiving messages.public long getPingResponseWait()
getPingResponseWait in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setPingResponseWait(long pingWait)
If not provided the default value is GridMailDiscoverySpi.DFLT_PING_WAIT.
pingWait - Timeout in milliseconds.public GridNode getLocalNode()
getLocalNode in interface GridDiscoverySpipublic long getMaximumMissedHeartbeats()
getMaximumMissedHeartbeats in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setMaxMissedHeartbeats(long maxMissedBeats)
If not provided the default value is GridMailDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS.
maxMissedBeats - Number of missed requests.public long getLeaveMessagesOnServer()
getLeaveMessagesOnServer in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setLeaveMessagesOnServer(long leaveMsgsOnServer)
If not provided the default value is GridMailDiscoverySpi.DFLT_LEAVE_MSGS_ON_SERVER.
leaveMsgsOnServer - Time to live for incoming messages.public String getOutConnectionTypeFormatted()
getOutConnectionTypeFormatted in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setOutConnectionType(GridMailDiscoveryType type)
If not provided the default value is GridMailDiscoveryType.NONE.
type - Connection type.public String getOutProtocolFormatted()
getOutProtocolFormatted in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setOutProtocol(GridMailDiscoveryOutProtocol proto)
If not provided the default value is GridMailDiscoveryOutProtocol.SMTP.
proto - Outgoing mail protocol.public String getOutHost()
getOutHost in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=false) public void setOutHost(String host)
There is no default value for the parameter.
host - Outgoing email host name.public int getOutPort()
getOutPort in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setOutPort(int port)
If not provided the default value is 25.
port - Outgoing email port number.public String getOutUsername()
getOutUsername in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setOutUsername(String username)
If not provided the default value is null.
username - Outbox username.@GridSpiConfiguration(optional=true) public void setOutPassword(String pswd)
If not provided the default value is null.
pswd - Outbox password.public String getInConnectionTypeFormatted()
getInConnectionTypeFormatted in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setInConnectionType(GridMailDiscoveryType type)
If not provided the default value is GridMailDiscoveryType.NONE.
type - Connection type.public int getReadBatchSize()
getReadBatchSize in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setReadBatchSize(int readBatchSize)
If not provided the default value is 100.
readBatchSize - Number of fetched messages.public String getInProtocolFormatted()
getInProtocolFormatted in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setInProtocol(GridMailDiscoveryInProtocol proto)
GridMailDiscoveryInProtocol.POP3GridMailDiscoveryInProtocol.POP3SGridMailDiscoveryInProtocol.IMAPGridMailDiscoveryInProtocol.IMAPS
If not provided the default value is GridMailDiscoveryInProtocol.POP3.
proto - Incoming protocol.public String getInHost()
getInHost in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=false) public void setInHost(String host)
There is no default value.
host - Incoming email host name. There is no default value.public int getInPort()
getInPort in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setInPort(int port)
If not provided the default value is 110.
port - Incoming email server port number.public String getInUsername()
getInUsername in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setInUsername(String username)
If not provided the default value is null.
username - Incoming mailbox username.@GridSpiConfiguration(optional=true) public void setInPassword(String pswd)
If not provided the default value is null.
pswd - Incoming mailbox password.public String getFolderName()
getFolderName in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setFolderName(String folderName)
If not provided the default value is Inbox.
folderName - Mail server folder name.public String getSubject()
getSubject in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setSubject(String subj)
If not provided the default value is GridMailDiscoverySpi.DFLT_MAIL_SUBJECT.
subj - Email message subject.public Properties getOutCustomProperties()
getOutCustomProperties in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setOutCustomProperties(Properties props)
If not provided the default value is null.
props - Custom parameter.public Properties getInCustomProperties()
getInCustomProperties in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setInCustomProperties(Properties props)
If not provided the default value is null.
props - Custom properties.public String getFromAddress()
getFromAddress in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=false) public void setFromAddress(String addr)
There is no default value.
addr - Email address for data exchange.public String getBroadcastAddress()
getBroadcastAddress in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=false) public void setBroadcastAddress(String bcastAddr)
There is no default value.
bcastAddr - Email address.public String getStoreFileName()
getStoreFileName in interface GridMailDiscoverySpiMBean@GridSpiConfiguration(optional=true) public void setStoreFileName(String fileName)
If not provided the default value is GridMailDiscoverySpi.DFLT_STORE_FILE_NAME.
fileName - Local storage file name.public void setNodeAttributes(Map<String,Serializable> attrs)
setNodeAttributes in interface GridDiscoverySpiattrs - Map of node attributes.public void setListener(GridDiscoveryListener listener)
GridDiscoveryEventType for a set of all possible
discovery events.
setListener in interface GridDiscoverySpilistener - Listener to discovery events.public void setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
GridDiscoveryMetricsProvider.getMetrics() method to exchange
dynamic metrics between nodes.
setMetricsProvider in interface GridDiscoverySpimetricsProvider - Provider of metrics data.
public Map<String,Serializable> getNodeAttributes()
throws GridSpiException
GridSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernel collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes.
getNodeAttributes in interface GridSpigetNodeAttributes in class GridSpiAdapterGridSpiException - Throws in case of any error.
public void spiStart(String gridName)
throws GridSpiException
spiStart in interface GridSpiGridSpiException - Throws in case of any error during SPI start.gridName - Name of grid instance this SPI is being started for
(null for default grid).
public void spiStop()
throws GridSpiException
spiStop in interface GridSpiGridSpiException - Thrown in case of any error during SPI stop.public List<GridNode> getRemoteNodes()
getRemoteNodes in interface GridDiscoverySpipublic GridNode getNode(UUID nodeId)
getNode in interface GridDiscoverySpinodeId - Node ID.
public Collection<UUID> getRemoteNodeIds()
getRemoteNodeIds in interface GridMailDiscoverySpiMBeanpublic int getRemoteNodeCount()
getRemoteNodeCount in interface GridMailDiscoverySpiMBeanpublic boolean pingNode(UUID nodeId)
pingNode in interface GridDiscoverySpinodeId - Node Id.
protected List<String> getConsistentAttributeNames()
getConsistentAttributeNames in class GridSpiAdapterpublic String toString()
toString in class Object
|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|