Search in sources :

Example 91 with ID

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));
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Example 92 with ID

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;
}
Also used : ID(org.eclipse.ecf.core.identity.ID) IRemoteServiceRegisteredEvent(org.eclipse.ecf.remoteservice.events.IRemoteServiceRegisteredEvent)

Example 93 with ID

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);
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Example 94 with ID

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));
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Example 95 with ID

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
    }
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Aggregations

ID (org.eclipse.ecf.core.identity.ID)256 IContainer (org.eclipse.ecf.core.IContainer)29 IOException (java.io.IOException)19 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)18 UUID (java.util.UUID)17 HashMap (java.util.HashMap)12 ArrayList (java.util.ArrayList)11 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)11 GUID (org.eclipse.ecf.core.identity.GUID)11 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)11 XMPPRoomID (org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID)11 Namespace (org.eclipse.ecf.core.identity.Namespace)10 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)10 Map (java.util.Map)9 Matcher (java.util.regex.Matcher)9 ECFException (org.eclipse.ecf.core.util.ECFException)9 List (java.util.List)8 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)8 IChannel (org.eclipse.ecf.datashare.IChannel)8 Iterator (java.util.Iterator)7