use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class AbstractClientContainer method disconnect.
public void disconnect() {
ID oldId = connectedID;
fireContainerEvent(new ContainerDisconnectingEvent(containerID, oldId));
synchronized (connectLock) {
connectedID = null;
connectContext = null;
}
fireContainerEvent(new ContainerDisconnectedEvent(containerID, oldId));
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class AbstractRSAClientContainer method registerEndpoint.
public RemoteServiceClientRegistration registerEndpoint(ID targetID, String[] interfaces, Map<String, Object> endpointDescriptionProperties) {
final RemoteServiceClientRegistration registration = createRSAClientRegistration(targetID, interfaces, endpointDescriptionProperties);
this.registry.registerRegistration(registration);
// notify
fireRemoteServiceEvent(new IRemoteServiceRegisteredEvent() {
public IRemoteServiceReference getReference() {
return registration.getReference();
}
public ID getLocalContainerID() {
return registration.getContainerID();
}
public ID getContainerID() {
return getID();
}
public String[] getClazzes() {
return registration.getClazzes();
}
});
return registration;
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class AbstractRSAClientContainer method importEndpoint.
public IRemoteServiceReference[] importEndpoint(Map<String, Object> endpointDescriptionProperties) throws ContainerConnectException, InvalidSyntaxException {
// ecf.endpoint.id
String ecfid = EndpointDescriptionPropertiesUtil.verifyStringProperty(endpointDescriptionProperties, Constants.ENDPOINT_ID);
if (ecfid == null)
// $NON-NLS-1$
ecfid = EndpointDescriptionPropertiesUtil.verifyStringProperty(endpointDescriptionProperties, "endpoint.id");
// ecf.endpoint.ts
Long timestamp = EndpointDescriptionPropertiesUtil.verifyLongProperty(endpointDescriptionProperties, Constants.ENDPOINT_TIMESTAMP);
if (timestamp == null)
timestamp = getServiceId(endpointDescriptionProperties);
// ecf.endpoint.ns
String idNamespace = EndpointDescriptionPropertiesUtil.verifyStringProperty(endpointDescriptionProperties, Constants.ENDPOINT_CONTAINER_ID_NAMESPACE);
// Create/verify endpointContainerID
ID endpointContainerID = EndpointDescriptionPropertiesUtil.verifyIDProperty(idNamespace, ecfid);
// Get rsId
Long rsId = EndpointDescriptionPropertiesUtil.verifyLongProperty(endpointDescriptionProperties, Constants.SERVICE_ID);
// if null, then set to service.id
if (rsId == null)
// $NON-NLS-1$
rsId = EndpointDescriptionPropertiesUtil.verifyLongProperty(endpointDescriptionProperties, "endpoint.service.id");
// Get connectTargetID
ID connectTargetID = EndpointDescriptionPropertiesUtil.verifyIDProperty(idNamespace, EndpointDescriptionPropertiesUtil.verifyStringProperty(endpointDescriptionProperties, Constants.ENDPOINT_CONNECTTARGET_ID));
// If not explicitly set, then set to endpointContainerID
if (connectTargetID == null)
connectTargetID = endpointContainerID;
// Get idFilter
ID[] idFilter = EndpointDescriptionPropertiesUtil.verifyIDArray(endpointDescriptionProperties, Constants.ENDPOINT_IDFILTER_IDS, idNamespace);
// If not set, then set to endpointContainerID
idFilter = (idFilter == null) ? new ID[] { endpointContainerID } : idFilter;
// Get rsFilter
String rsFilter = getRemoteServiceFilter(endpointDescriptionProperties, rsId);
// Get interfaces
List<String> interfaces = EndpointDescriptionPropertiesUtil.verifyObjectClassProperty(endpointDescriptionProperties);
// register locally
registerEndpoint(connectTargetID, interfaces.toArray(new String[interfaces.size()]), endpointDescriptionProperties);
// If we have a non-null targetID we connect
if (connectTargetID != null)
connectToEndpoint(connectTargetID);
return getRemoteServiceReferences(idFilter, interfaces.iterator().next(), rsFilter);
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class BaseSharedObject method isPrimary.
/**
* @return <code>true</code> if this shared object replica is the <b>primary</b>. The definition of primary
* is whether the {@link #getLocalContainerID()} and {@link #getHomeContainerID()} values are equal.
*/
protected final boolean isPrimary() {
ID local = getLocalContainerID();
ID home = getHomeContainerID();
if (local == null || home == null) {
return false;
}
return (local.equals(home));
}
use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.
the class TwoPhaseCommitEventProcessor method handleCreateResponse.
protected void handleCreateResponse(ISharedObjectCreateResponseEvent event) {
// $NON-NLS-1$ //$NON-NLS-2$
trace("handleCreateResponse(" + event + ")");
if (isPrimary()) {
synchronized (lock) {
Throwable except = event.getException();
ID remoteID = event.getRemoteContainerID();
long ident = event.getSequence();
if (getTransactionState() == ISharedObjectContainerTransaction.VOTING) {
if (except == null) {
removeParticipant(remoteID);
} else {
addFailed(remoteID, except);
}
} else {
handleVotingCompletedCreateResponse(remoteID, except, ident);
}
lock.notifyAll();
}
} else {
// we don't care as we are note transaction monitor
}
}
Aggregations