Beispiel #1
0
  private List<IceInternal.EndpointI> parsePublishedEndpoints() {
    //
    // Parse published endpoints. If set, these are used in proxies
    // instead of the connection factory Endpoints.
    //
    String endpts =
        _instance.initializationData().properties.getProperty(_name + ".PublishedEndpoints");
    List<IceInternal.EndpointI> endpoints = parseEndpoints(endpts, false);
    if (endpoints.isEmpty()) {
      //
      // If the PublishedEndpoints property isn't set, we compute the published enpdoints
      // from the OA endpoints, expanding any endpoints that may be listening on INADDR_ANY
      // to include actual addresses in the published endpoints.
      //
      for (IncomingConnectionFactory factory : _incomingConnectionFactories) {
        endpoints.addAll(factory.endpoint().expand());
      }
    }

    if (_instance.traceLevels().network >= 1 && !endpoints.isEmpty()) {
      StringBuffer s = new StringBuffer("published endpoints for object adapter `");
      s.append(_name);
      s.append("':\n");
      boolean first = true;
      for (IceInternal.EndpointI endpoint : endpoints) {
        if (!first) {
          s.append(":");
        }
        s.append(endpoint.toString());
        first = false;
      }
      _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
    }
    return endpoints;
  }
Beispiel #2
0
 @Override
 public synchronized Endpoint[] getEndpoints() {
   List<Endpoint> endpoints = new ArrayList<Endpoint>();
   for (IncomingConnectionFactory factory : _incomingConnectionFactories) {
     endpoints.add(factory.endpoint());
   }
   return endpoints.toArray(new Endpoint[0]);
 }
Beispiel #3
0
  public boolean isLocal(ObjectPrx proxy) {
    //
    // NOTE: it's important that isLocal() doesn't perform any blocking operations as
    // it can be called for AMI invocations if the proxy has no delegate set yet.
    //

    IceInternal.Reference ref = ((ObjectPrxHelperBase) proxy).__reference();
    if (ref.isWellKnown()) {
      //
      // Check the active servant map to see if the well-known
      // proxy is for a local object.
      //
      return _servantManager.hasServant(ref.getIdentity());
    } else if (ref.isIndirect()) {
      //
      // Proxy is local if the reference adapter id matches this
      // adapter id or replica group id.
      //
      return ref.getAdapterId().equals(_id) || ref.getAdapterId().equals(_replicaGroupId);
    } else {
      IceInternal.EndpointI[] endpoints = ref.getEndpoints();

      synchronized (this) {
        checkForDeactivation();

        //
        // Proxies which have at least one endpoint in common with the
        // endpoints used by this object adapter's incoming connection
        // factories are considered local.
        //
        for (IceInternal.EndpointI endpoint : endpoints) {
          for (IceInternal.EndpointI p : _publishedEndpoints) {
            if (endpoint.equivalent(p)) {
              return true;
            }
          }
          for (IncomingConnectionFactory p : _incomingConnectionFactories) {
            if (endpoint.equivalent(p.endpoint())) {
              return true;
            }
          }
        }

        //
        // Proxies which have at least one endpoint in common with the
        // router's server proxy endpoints (if any), are also considered
        // local.
        //
        if (_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter())) {
          for (IceInternal.EndpointI endpoint : endpoints) {
            for (IceInternal.EndpointI p : _routerEndpoints) {
              if (endpoint.equivalent(p)) {
                return true;
              }
            }
          }
        }
      }
    }

    return false;
  }