Skip to content

Commit

Permalink
Fixed all checkstyle issues. Issues #37 and #38. PR #48
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Mendioroz committed Oct 4, 2016
1 parent 08f125c commit 56a87f0
Show file tree
Hide file tree
Showing 56 changed files with 2,550 additions and 2,554 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@
*/
public class ClientSLgSessionDataReplicatedImpl extends SLgSessionDataReplicatedImpl implements IClientSLgSessionData {

/**
* @param nodeFqn
* @param mobicentsCluster
* @param iface
*/
public ClientSLgSessionDataReplicatedImpl(Fqn<?> nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) {
super(nodeFqn, mobicentsCluster, container);
/**
* @param nodeFqn
* @param mobicentsCluster
* @param iface
*/
public ClientSLgSessionDataReplicatedImpl(Fqn<?> nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) {
super(nodeFqn, mobicentsCluster, container);

if (super.create()) {
setAppSessionIface(this, ClientSLgSession.class);
setSLgSessionState(SLgSessionState.IDLE);
}
if (super.create()) {
setAppSessionIface(this, ClientSLgSession.class);
setSLgSessionState(SLgSessionState.IDLE);
}
}

/**
* @param sessionId
* @param mobicentsCluster
* @param iface
*/
public ClientSLgSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) {
this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container);
}
/**
* @param sessionId
* @param mobicentsCluster
* @param iface
*/
public ClientSLgSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) {
this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container);
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@
*/
public class ClientSLhSessionDataReplicatedImpl extends SLhSessionDataReplicatedImpl implements IClientSLhSessionData {

/**
* @param nodeFqn
* @param mobicentsCluster
* @param iface
*/
public ClientSLhSessionDataReplicatedImpl(Fqn<?> nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) {
super(nodeFqn, mobicentsCluster, container);
/**
* @param nodeFqn
* @param mobicentsCluster
* @param iface
*/
public ClientSLhSessionDataReplicatedImpl(Fqn<?> nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) {
super(nodeFqn, mobicentsCluster, container);

if (super.create()) {
setAppSessionIface(this, ClientSLhSession.class);
setSLhSessionState(SLhSessionState.IDLE);
}
if (super.create()) {
setAppSessionIface(this, ClientSLhSession.class);
setSLhSessionState(SLhSessionState.IDLE);
}
}

/**
* @param sessionId
* @param mobicentsCluster
* @param iface
*/
public ClientSLhSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) {
this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container);
}
/**
* @param sessionId
* @param mobicentsCluster
* @param iface
*/
public ClientSLhSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) {
this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,34 @@
*/
public class SLgReplicatedSessionDataFactory implements IAppSessionDataFactory<ISLgSessionData> {

private ReplicatedSessionDatasource replicatedSessionDataSource;
private MobicentsCluster mobicentsCluster;
private ReplicatedSessionDatasource replicatedSessionDataSource;
private MobicentsCluster mobicentsCluster;

/**
* @param replicatedSessionDataSource
*/
public SLgReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok?
super();
this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource;
this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster();
}
/**
* @param replicatedSessionDataSource
*/
public SLgReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok?
super();
this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource;
this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster();
}

/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String)
*/
public ISLgSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientSLgSession.class)) {
ClientSLgSessionDataReplicatedImpl data = new ClientSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer());
return data;
}
else if (clazz.equals(ServerSLgSession.class)) {
ServerSLgSessionDataReplicatedImpl data = new ServerSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer());
return data;
}
throw new IllegalArgumentException();
/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String)
*/
public ISLgSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientSLgSession.class)) {
ClientSLgSessionDataReplicatedImpl data = new ClientSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster,
this.replicatedSessionDataSource.getContainer());
return data;
} else if (clazz.equals(ServerSLgSession.class)) {
ServerSLgSessionDataReplicatedImpl data = new ServerSLgSessionDataReplicatedImpl(sessionId, this.mobicentsCluster,
this.replicatedSessionDataSource.getContainer());
return data;
}
throw new IllegalArgumentException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,108 +45,105 @@
*/
public abstract class SLgSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements ISLgSessionData {

private static final Logger logger = LoggerFactory.getLogger(SLgSessionDataReplicatedImpl.class);
private static final Logger logger = LoggerFactory.getLogger(SLgSessionDataReplicatedImpl.class);

private static final String STATE = "STATE";
private static final String BUFFER = "BUFFER";
private static final String TS_TIMERID = "TS_TIMERID";
private static final String STATE = "STATE";
private static final String BUFFER = "BUFFER";
private static final String TS_TIMERID = "TS_TIMERID";

private IMessageParser messageParser;
private IMessageParser messageParser;

/**
* @param nodeFqn
* @param mobicentsCluster
* @param iface
*/
public SLgSessionDataReplicatedImpl(Fqn<?> nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) {
super(nodeFqn, mobicentsCluster);
this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class);
}
/**
* @param nodeFqn
* @param mobicentsCluster
* @param iface
*/
public SLgSessionDataReplicatedImpl(Fqn<?> nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) {
super(nodeFqn, mobicentsCluster);
this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class);
}

/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#setSLgSessionState(org.jdiameter.common.api.app.slg.SLgSessionState)
*/
public void setSLgSessionState(SLgSessionState state) {
if (exists()) {
getNode().put(STATE, state);
}
else {
throw new IllegalStateException();
}
/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#setSLgSessionState(org.jdiameter.common.api.app.slg.SLgSessionState)
*/
public void setSLgSessionState(SLgSessionState state) {
if (exists()) {
getNode().put(STATE, state);
} else {
throw new IllegalStateException();
}
}

/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#getSLgSessionState()
*/
public SLgSessionState getSLgSessionState() {
if (exists()) {
return (SLgSessionState) getNode().get(STATE);
}
else {
throw new IllegalStateException();
}
/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#getSLgSessionState()
*/
public SLgSessionState getSLgSessionState() {
if (exists()) {
return (SLgSessionState) getNode().get(STATE);
}
else {
throw new IllegalStateException();
}
}

/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#getTsTimerId()
*/
public Serializable getTsTimerId() {
if (exists()) {
return (Serializable) getNode().get(TS_TIMERID);
}
else {
throw new IllegalStateException();
}
/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#getTsTimerId()
*/
public Serializable getTsTimerId() {
if (exists()) {
return (Serializable) getNode().get(TS_TIMERID);
}
else {
throw new IllegalStateException();
}
}

/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#setTsTimerId(java.io.Serializable)
*/
public void setTsTimerId(Serializable tid) {
if (exists()) {
getNode().put(TS_TIMERID, tid);
}
else {
throw new IllegalStateException();
}
/*
* (non-Javadoc)
*
* @see org.jdiameter.common.api.app.slg.ISLgSessionData#setTsTimerId(java.io.Serializable)
*/
public void setTsTimerId(Serializable tid) {
if (exists()) {
getNode().put(TS_TIMERID, tid);
}
else {
throw new IllegalStateException();
}
}

public Request getBuffer() {
byte[] data = (byte[]) getNode().get(BUFFER);
if (data != null) {
try {
return (Request) this.messageParser.createMessage(ByteBuffer.wrap(data));
}
catch (AvpDataException e) {
logger.error("Unable to recreate message from buffer.");
return null;
}
}
else {
return null;
}
public Request getBuffer() {
byte[] data = (byte[]) getNode().get(BUFFER);
if (data != null) {
try {
return (Request) this.messageParser.createMessage(ByteBuffer.wrap(data));
} catch (AvpDataException e) {
logger.error("Unable to recreate message from buffer.");
return null;
}
} else {
return null;
}
}

public void setBuffer(Request buffer) {
if (buffer != null) {
try {
byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array();
getNode().put(BUFFER, data);
}
catch (ParseException e) {
logger.error("Unable to encode message to buffer.");
}
}
else {
getNode().remove(BUFFER);
}
public void setBuffer(Request buffer) {
if (buffer != null) {
try {
byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array();
getNode().put(BUFFER, data);
}
catch (ParseException e) {
logger.error("Unable to encode message to buffer.");
}
}
else {
getNode().remove(BUFFER);
}
}
}
Loading

0 comments on commit 56a87f0

Please sign in to comment.