/*
* Copyright (c) 2005-2016 Vincent Vandenschrick. All rights reserved.
*
* This file is part of the Jspresso framework.
*
* Jspresso is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Jspresso is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Jspresso. If not, see <http://www.gnu.org/licenses/>.
*/
package org.jspresso.framework.util.remote;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.jspresso.framework.util.automation.IPermIdSource;
/**
* An object remote server peer.
*
* @author Vincent Vandenschrick
*/
public abstract class RemotePeer implements IRemotePeer, IPermIdSource,
Serializable {
private static final long serialVersionUID = 2174357777581427148L;
private String permId;
private String guid;
/**
* Constructs a new {@code RemotePeer} instance. Only used for
* serialization support.
*/
public RemotePeer() {
// For serialization support
}
/**
* Constructs a new {@code RemoteServerPeer} instance generating its UID.
*
* @param guid
* the guid.
*/
protected RemotePeer(String guid) {
this.guid = guid;
}
/**
* Gets the permId.
*
* @return the permId.
*/
@Override
public String getPermId() {
return permId;
}
/**
* {@inheritDoc}
*/
@Override
public String getGuid() {
return guid;
}
/**
* Sets the permanent identifier to this application element. Permanent
* identifiers are used by different framework parts, like dynamic security or
* record/replay controllers to uniquely identify an application element.
* Permanent identifiers are generated by the SJS build based on the element
* id but must be explicitly set if Spring XML is used.
*
* @param permId
* the permId to set.
*/
@Override
public void setPermId(String permId) {
this.permId = permId;
}
/**
* Sets the guid.
*
* @param guid
* the guid to set.
*/
public void setGuid(String guid) {
this.guid = guid;
}
/**
* to string.
*
* @return original toString completed with permId.
*/
@Override
public String toString() {
return new ToStringBuilder(this).append("permId", getPermId()).toString();
}
}