Commit 63617f73 authored by Thiago Camargo's avatar Thiago Camargo Committed by thiago

Warning fixes

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6605 b35dd754-fafc-0310-a699-88a17e54d16e
parent 824912cd
......@@ -12,9 +12,8 @@ package org.jivesoftware.wildfire.mediaproxy;
import org.jivesoftware.util.Log;
import java.util.List;
import java.util.ArrayList;
import java.net.InetAddress;
import java.util.List;
/**
* MediaProxy create and bind relay channels between IP pairs.
......@@ -72,7 +71,7 @@ public class MediaProxy implements SessionListener {
return idleTime;
}
/**
/**
* Returns the maximum amount of time (in milleseconds) that a session can
* be idle before it's closed.
*
......@@ -94,7 +93,7 @@ public class MediaProxy implements SessionListener {
/**
* Get Minimal port value to listen from incoming packets.
*
* @return
* @return the minimal port value
*/
public int getMinPort() {
return minPort;
......@@ -103,7 +102,7 @@ public class MediaProxy implements SessionListener {
/**
* Set Minimal port value to listen from incoming packets.
*
* @param minPort
* @param minPort the minimal port value
*/
public void setMinPort(int minPort) {
this.minPort = minPort;
......@@ -112,7 +111,7 @@ public class MediaProxy implements SessionListener {
/**
* Get Maximum port value to listen from incoming packets.
*
* @return
* @return the maximun port value
*/
public int getMaxPort() {
return maxPort;
......@@ -121,7 +120,7 @@ public class MediaProxy implements SessionListener {
/**
* Set Maximum port value to listen from incoming packets.
*
* @param maxPort
* @param maxPort the maximun port value
*/
public void setMaxPort(int maxPort) {
this.maxPort = maxPort;
......@@ -131,6 +130,7 @@ public class MediaProxy implements SessionListener {
* Get the agent with an especified ID
*
* @param sid the session ID
* @return the session with the informed sid, if not found, returns null
*/
public MediaProxySession getAgent(String sid) {
for (MediaProxySession session : sessions) {
......@@ -157,15 +157,16 @@ public class MediaProxy implements SessionListener {
* Add a new Static Session to the mediaproxy for defined IPs and ports.
* Create a channel between two IPs. ( Point A - Point B )
*
* @param id id of the candidate returned (Could be a Jingle session ID)
* @param hostA the hostname or IP of the point A of the Channel
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @param id id of the candidate returned (Could be a Jingle session ID)
* @param creator the agent creator name or description
* @param hostA the hostname or IP of the point A of the Channel
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @return the added ProxyCandidate
*/
public ProxyCandidate addAgent(String id, String creator, String hostA, int portA, String hostB,
int portB) {
int portB) {
final MediaProxySession session =
new MediaProxySession(id, creator, localhost, hostA, portA, hostB, portB, minPort, maxPort);
if (session != null) {
......@@ -186,15 +187,16 @@ public class MediaProxy implements SessionListener {
* Every packet received from Point A will be relayed to the new Point B IP and port.
* Create a dynamic channel between two IPs. ( Dynamic Point A - Dynamic Point B )
*
* @param id id of the candidate returned (Could be a Jingle session ID)
* @param hostA the hostname or IP of the point A of the Channel
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @param id id of the candidate returned (Could be a Jingle session ID)
* @param creator the agent creator name or description
* @param hostA the hostname or IP of the point A of the Channel
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @return the added ProxyCandidate
*/
public ProxyCandidate addSmartAgent(String id, String creator, String hostA, int portA,
String hostB, int portB) {
String hostB, int portB) {
final SmartSession agent = new SmartSession(id, creator, localhost, hostA, portA, hostB, portB,
minPort, maxPort);
if (agent != null) {
......@@ -215,7 +217,8 @@ public class MediaProxy implements SessionListener {
* Every packet received from Point A will be relayed to the new Point B IP and port.
* Create a dynamic channel between two IPs. ( Dynamic Point A - Dynamic Point B )
*
* @param id id of the candidate returned (Could be a Jingle session ID)
* @param id id of the candidate returned (Could be a Jingle session ID)
* @param creator the agent creator name or description
* @return the added ProxyCandidate
*/
public ProxyCandidate addSmartAgent(String id, String creator) {
......
......@@ -251,7 +251,6 @@ public class MediaProxyService extends BasicModule implements ServerItemsProvide
//componentManager.getLog().debug(session.getLocalPortB() + "->" + session.getPortB());
} else {
Log.debug("WRONG PASS " + session.getPass() + " " + pass.getValue());
reply.setError(PacketError.Condition.forbidden);
}
......@@ -354,7 +353,7 @@ public class MediaProxyService extends BasicModule implements ServerItemsProvide
/**
* Return the list of active Agents
*
* @return
* @return list of active agents
*/
public List<MediaProxySession> getAgents() {
return mediaProxy.getAgents();
......@@ -381,18 +380,18 @@ public class MediaProxyService extends BasicModule implements ServerItemsProvide
}
/**
* Set Minimal port value to listen from incoming packets.
* Set Minimal port value to listen for incoming packets.
*
* @param minPort
* @param minPort port value to listen for incoming packets
*/
public void setMinPort(int minPort) {
mediaProxy.setMinPort(minPort);
}
/**
* Set Maximum port value to listen from incoming packets.
* Set Maximum port value to listen for incoming packets.
*
* @param maxPort
* @param maxPort port value to listen for incoming packets
*/
public void setMaxPort(int maxPort) {
mediaProxy.setMaxPort(maxPort);
......@@ -428,7 +427,7 @@ public class MediaProxyService extends BasicModule implements ServerItemsProvide
/**
* Set the service enable status.
*
* @param enabled
* @param enabled boolean value setting enabled or disabled
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
......
......@@ -56,14 +56,14 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
* Creates a new static UDP channel between Host A and Host B.
*
* @param id of the Session (Could be a Jingle session ID)
* @param creator
* @param creator the session creator name or description
* @param localAddress the localhost IP that will listen for UDP packets
* @param hostA the hostname or IP of the point A of the Channel
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @param minPort
* @param maxPort
* @param minPort the minimal port value to be used by the server
* @param maxPort the maximun port value to be used by the server
*/
public MediaProxySession(String id, String creator, String localAddress, String hostA, int portA, String hostB, int portB, int minPort, int maxPort) {
this.id = id;
......@@ -101,7 +101,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
protected int getFreePort() {
ServerSocket ss;
int freePort = 0;
int controlPort = 0;
int controlPort;
for (int i = 0; i < 10; i++) {
freePort = (int) (minPort + Math.round(Math.random() * (maxPort - minPort)));
......@@ -136,7 +136,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get the ID of the Session
*
* @return
* @return the ID of the session
*/
public String getSID() {
return id;
......@@ -154,7 +154,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
* Get the agent creator.
* This field is open to MediaProxy users and just can be set in constructor.
*
* @return
* @return the session creator name or description
*/
public String getCreator() {
return creator;
......@@ -239,7 +239,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get localhost of the Session
*
* @return
* @return the localhost of the session
*/
public InetAddress getLocalhost() {
return localAddress;
......@@ -248,7 +248,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get the Host A IP
*
* @return
* @return the host A ip
*/
public InetAddress getHostA() {
return hostA;
......@@ -257,7 +257,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get the Host B IP
*
* @return
* @return the host B ip
*/
public InetAddress getHostB() {
return hostB;
......@@ -266,7 +266,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Set port A value
*
* @param portA
* @param portA the port number for A
*/
public void setPortA(int portA) {
System.out.println("PORT CHANGED(A):" + portA);
......@@ -276,7 +276,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Set port B value
*
* @param portB
* @param portB the port number for B
*/
public void setPortB(int portB) {
System.out.println("PORT CHANGED(B):" + portB);
......@@ -286,7 +286,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Set the Host A IP
*
* @param hostA
* @param hostA the host for A
*/
public void setHostA(InetAddress hostA) {
this.hostA = hostA;
......@@ -295,7 +295,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Set the Host B IP
*
* @param hostB
* @param hostB the host for B
*/
public void setHostB(InetAddress hostB) {
this.hostB = hostB;
......@@ -313,7 +313,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get the Port B IP
*
* @return
* @return the port for B
*/
public int getPortB() {
return portB;
......@@ -322,7 +322,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get the localport that listen for Host A Packets
*
* @return
* @return the local port for A
*/
public int getLocalPortA() {
return localPortA;
......@@ -331,7 +331,7 @@ public class MediaProxySession extends Thread implements ProxyCandidate, Datagra
/**
* Get the localport that listen for Host B Packets
*
* @return
* @return the local port for B
*/
public int getLocalPortB() {
return localPortB;
......
......@@ -10,8 +10,8 @@
package org.jivesoftware.wildfire.mediaproxy;
import java.net.*;
import java.io.IOException;
import java.net.*;
/**
* A Session Class will control "receive and relay" proccess.
......@@ -37,6 +37,9 @@ public class SmartSession extends MediaProxySession {
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @param creator the created name or description of the Channel
* @param minPort the minimal port number to be used by the proxy
* @param maxPort the maximun port number to be used by the proxy
*/
public SmartSession(String id, String creator, String localhost, String hostA, int portA, String hostB, int portB, int minPort, int maxPort) {
super(id, creator, localhost, hostA, portA, hostB, portB, minPort, maxPort);
......@@ -51,6 +54,7 @@ public class SmartSession extends MediaProxySession {
* @param portA the port number point A of the Channel
* @param hostB the hostname or IP of the point B of the Channel
* @param portB the port number point B of the Channel
* @param creator the created name or description of the Channel
*/
public SmartSession(String id, String creator, String localhost, String hostA, int portA, String hostB, int portB) {
super(id, creator, localhost, hostA, portA, hostB, portB, 10000, 20000);
......@@ -99,15 +103,15 @@ public class SmartSession extends MediaProxySession {
/**
* Default Channel Constructor
*
* @param dataSocket
* @param host
* @param port
* @param dataSocket datasocket to used to send and receive packets
* @param host default destination host for received packets
* @param port default destination port for received packets
*/
public SmartChannel(DatagramSocket dataSocket, InetAddress host, int port) {
super(dataSocket, host, port);
}
/**
/**
* Thread override method
*/
public void run() {
......@@ -121,10 +125,10 @@ public class SmartSession extends MediaProxySession {
if (this.getPort() != packet.getPort())
System.out.println(dataSocket.getLocalAddress().getHostAddress() + ":" + dataSocket.getLocalPort() + " relay to: " + packet.getAddress().getHostAddress() + ":" + packet.getPort());
if (c++ < 5){
if (c++ < 5) {
System.out.println("Received:" + dataSocket.getLocalAddress().getHostAddress() + ":" + dataSocket.getLocalPort());
System.out.println("Addr: "+packet.getAddress().getHostName());
System.out.println("Addr: " + packet.getAddress().getHostName());
}
this.setHost(packet.getAddress());
......@@ -143,15 +147,15 @@ public class SmartSession extends MediaProxySession {
}
} catch (UnknownHostException e) {
if(enabled)
System.err.println("Unknown Host");
if (enabled)
System.err.println("Unknown Host");
}
catch (SocketException e) {
if(enabled)
System.err.println("Socket closed");
if (enabled)
System.err.println("Socket closed");
} catch (IOException e) {
if(enabled)
System.err.println("Communication error");
if (enabled)
System.err.println("Communication error");
e.printStackTrace();
}
}
......@@ -160,7 +164,7 @@ public class SmartSession extends MediaProxySession {
* Implement DatagramListener method.
* Set the host and port value to the host and port value from the received packet.
*
* @param datagramPacket
* @param datagramPacket the received packet
*/
public boolean datagramReceived(DatagramPacket datagramPacket) {
//InetAddress host = datagramPacket.getAddress();
......
......@@ -94,11 +94,8 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
// Do nothing let the default values to be used.
}
if (JiveGlobals.getProperty("stun.enabled") == null) {
this.enabled = true;
} else {
this.enabled = Boolean.parseBoolean(JiveGlobals.getProperty("stun.enabled"));
}
this.enabled=JiveGlobals.getProperty("stun.enabled") == null||Boolean.parseBoolean(JiveGlobals.getProperty("stun.enabled"));
}
public void destroy() {
......@@ -325,7 +322,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
/**
* Set the service enable status.
*
* @param enabled
* @param enabled boolean to enable or disable
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
......@@ -340,7 +337,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
/**
* Get the secondary Port used by the STUN server
*
* @return
* @return secondary Port used by the STUN server
*/
public int getSecondaryPort() {
return secondaryPort;
......@@ -349,7 +346,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
/**
* Get the primary Port used by the STUN server
*
* @return
* @return primary Port used by the STUN server
*/
public int getPrimaryPort() {
return primaryPort;
......@@ -358,7 +355,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
/**
* Get the secondary Address used by the STUN server
*
* @return
* @return secondary Address used by the STUN server
*/
public String getSecondaryAddress() {
return secondaryAddress;
......@@ -367,7 +364,7 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
/**
* Get the primary Address used by the STUN server
*
* @return
* @return primary Address used by the STUN server
*/
public String getPrimaryAddress() {
return primaryAddress;
......
......@@ -84,7 +84,7 @@
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16"
<td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" alt="Success"
border="0"></td>
<td class="jive-icon-label">Settings updated successfully.</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment