@Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    MemberIsAvailable that = (MemberIsAvailable) o;

    if (!clusterUri.equals(that.clusterUri)) {
      return false;
    }
    if (!instanceId.equals(that.instanceId)) {
      return false;
    }
    if (!role.equals(that.role)) {
      return false;
    }
    if (!roleUri.equals(that.roleUri)) {
      return false;
    }

    return true;
  }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   MutableResourceInfoImpl other = (MutableResourceInfoImpl) obj;
   if (accessed == null) {
     if (other.accessed != null) return false;
   } else if (!accessed.equals(other.accessed)) return false;
   if (bytes == null) {
     if (other.bytes != null) return false;
   } else if (!bytes.equals(other.bytes)) return false;
   if (created == null) {
     if (other.created != null) return false;
   } else if (!created.equals(other.created)) return false;
   if (inProject == null) {
     if (other.inProject != null) return false;
   } else if (!inProject.equals(other.inProject)) return false;
   if (metadata == null) {
     if (other.metadata != null) return false;
   } else if (!metadata.equals(other.metadata)) return false;
   if (modified == null) {
     if (other.modified != null) return false;
   } else if (!modified.equals(other.modified)) return false;
   if (name == null) {
     if (other.name != null) return false;
   } else if (!name.equals(other.name)) return false;
   if (owner == null) {
     if (other.owner != null) return false;
   } else if (!owner.equals(other.owner)) return false;
   if (parent == null) {
     if (other.parent != null) return false;
   } else if (!parent.equals(other.parent)) return false;
   if (shared == null) {
     if (other.shared != null) return false;
   } else if (!shared.equals(other.shared)) return false;
   if (tags == null) {
     if (other.tags != null) return false;
   } else if (!tags.equals(other.tags)) return false;
   if (type == null) {
     if (other.type != null) return false;
   } else if (!type.equals(other.type)) return false;
   if (url == null) {
     if (other.url != null) return false;
   } else if (!url.equals(other.url)) return false;
   if (version == null) {
     if (other.version != null) return false;
   } else if (!version.equals(other.version)) return false;
   return true;
 }
Esempio n. 3
0
 @Override
 public boolean equals(Object o) {
   if (o == null) {
     return false;
   }
   if (o == this) {
     return true;
   }
   if (!(o instanceof Edge)) {
     return false;
   }
   Edge other = (Edge) o;
   if (address == null && other.address != null) {
     return false;
   }
   if (address != null && !address.equals(other.address)) {
     return false;
   }
   if (tag == null && other.tag != null) {
     return false;
   }
   if (tag != null && !tag.equals(other.tag)) {
     return false;
   }
   if (weight == null && other.weight != null) {
     return false;
   }
   if (weight != null && !weight.equals(other.weight)) {
     return false;
   }
   return true;
 }
Esempio n. 4
0
  @SuppressWarnings({"RedundantIfStatement"})
  @Override
  public boolean equals(final Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    final Module module = (Module) o;

    if (this.inheritOutput != module.inheritOutput) return false;
    if (this.contentRootUrl != null
        ? !contentRootUrl.equals(module.contentRootUrl)
        : module.contentRootUrl != null) return false;
    if (!setEquals(this.dependencies, module.dependencies)) return false;
    if (this.moduleDescriptor != null
        ? !moduleDescriptor.equals(module.moduleDescriptor)
        : module.moduleDescriptor != null) return false;
    if (this.name != null ? !name.equals(module.name) : module.name != null) return false;
    if (this.outputUrl != null ? !outputUrl.equals(module.outputUrl) : module.outputUrl != null)
      return false;
    if (!setEquals(this.sourceUrls, module.sourceUrls)) return false;
    if (this.testOutputUrl != null
        ? !testOutputUrl.equals(module.testOutputUrl)
        : module.testOutputUrl != null) return false;
    if (!setEquals(this.testSourceUrls, module.testSourceUrls)) return false;

    return true;
  }
Esempio n. 5
0
  public ObjectNode buildFormatsData(final ObjectMapper objectMapper, final Model model) {

    final ObjectNode formatsNode = objectMapper.createObjectNode();

    final Context context = model.getContext();
    final FormatLoader formatLoader = context.getFormatLoader();
    final SortedSet<URI> formatUris = formatLoader.getLoadedFormatUris();
    final URI defaultFormatUri = formatLoader.getDefaultFormatUri();

    for (final URI formatUri : formatUris) {
      final Formatter formatter = formatLoader.getFormatter(formatUri);
      if (formatter.isApplicableTo(model.getSchemaUri())) {

        final Format format = formatLoader.loadFormat(formatUri);
        final String mediaTypeString = String.valueOf(format.getMediaType());
        final ObjectNode formatNode = objectMapper.createObjectNode();
        formatsNode.put(mediaTypeString, formatNode);

        formatNode.put("uri", String.valueOf(formatUri));
        formatNode.put("title", format.getTitle());
        formatNode.put("mediaType", mediaTypeString);
        formatNode.put("fileExtension", format.getFileExtension());
        formatNode.put("isDefault", formatUri.equals(defaultFormatUri));
      }
    }

    return formatsNode;
  }
Esempio n. 6
0
  /*
   * (non-Javadoc)
   * @see net.java.treaty.ContractVocabulary#getSubProperties(java.net.URI)
   */
  public Set<URI> getSubProperties(URI relationshipOrProperty) throws TreatyException {

    Set<URI> result;
    result = new HashSet<URI>();

    OntModel model;
    model = getOntology();

    OntProperty property;
    property = model.getOntProperty(relationshipOrProperty.toString());

    for (Iterator<? extends OntProperty> iterator = property.listSubProperties(false);
        iterator.hasNext(); ) {

      try {
        URI next;
        next = new URI(iterator.next().getURI());

        /* It seems that jena returns the URI itself. */
        if (!relationshipOrProperty.equals(next)) {
          result.add(next);
        }
        // no else.
      } catch (URISyntaxException e) {
        throw new TreatyException(e);
      }
      // end catch.
    }
    // end for.

    return result;
  }
  /**
   * Process the buffer transition to check if the current buffer is visiting a file and if that
   * file is different from the file visited by the buffer during the last wakeup. Its element
   * consists of the the (absolute) file name (or last-time-visited file name) from which an user is
   * visiting, the (absolute) file name (or current-visiting file name) to which the user is
   * visiting, and the modification status of the last-time-visited file.
   */
  public void processBuffTrans() {
    // check if BufferTran property is enable
    if (this.activeTextEditor == null || (this.previousTextEditor == null)) {
      return;
    }
    URI toFile = this.getFileResource(this.activeTextEditor);
    URI fromFile = this.getFileResource(this.previousTextEditor);
    if (fromFile != null && toFile != null && !toFile.equals(fromFile)) {
      String buffTrans = fromFile.toString() + "->" + toFile.toString();
      // :RESOVED: 5/21/04 ISSUE:HACK109
      if (!latestBuffTrans.equals(buffTrans)) {
        HashMap<String, String> buffTranKeyValuePairs = new HashMap<String, String>();

        buffTranKeyValuePairs.put(EclipseSensorConstants.SUBTYPE, "BufferTransition");
        buffTranKeyValuePairs.put("From-Buff-Name", fromFile.toString());
        buffTranKeyValuePairs.put("To-Buff-Name", toFile.toString());
        buffTranKeyValuePairs.put("Modified", String.valueOf(this.isModifiedFromFile));

        String message =
            "BuffTrans : "
                + this.extractFileName(fromFile)
                + " --> "
                + this.extractFileName(toFile);

        this.addDevEvent(
            EclipseSensorConstants.DEVEVENT_EDIT, toFile, buffTranKeyValuePairs, message);
        latestBuffTrans = buffTrans;
      }
    }
  }
Esempio n. 8
0
 @Override
 public boolean equals(final Object o) {
   if (!(o instanceof MixerEndpoint)) {
     return false;
   }
   return _uri.equals(((MixerEndpoint) o).getURI());
 }
 @Override
 protected HazelcastClientCacheManager createHazelcastCacheManager(
     URI uri, ClassLoader classLoader, Properties properties) {
   final HazelcastInstance instance;
   // uri is null or default or a non hazelcast one, then we use the internal shared instance
   if (uri == null || uri.equals(getDefaultURI())) {
     if (hazelcastInstance == null) {
       try {
         hazelcastInstance = instanceFromProperties(classLoader, properties, true);
       } catch (Exception e) {
         throw ExceptionUtil.rethrow(e);
       }
     }
     instance = hazelcastInstance;
   } else {
     try {
       instance = instanceFromProperties(classLoader, properties, false);
       if (instance == null) {
         throw new IllegalArgumentException(INVALID_HZ_INSTANCE_SPECIFICATION_MESSAGE);
       }
     } catch (Exception e) {
       throw ExceptionUtil.rethrow(e);
     }
   }
   return new HazelcastClientCacheManager(this, instance, uri, classLoader, properties);
 }
Esempio n. 10
0
 @Override
 public boolean equals(Object o) {
   if (!(o instanceof TachyonURI)) {
     return false;
   }
   return mUri.equals(((TachyonURI) o).mUri);
 }
Esempio n. 11
0
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    CommonContextState that = (CommonContextState) o;

    if (lastKnownLearnedInstanceInCluster != that.lastKnownLearnedInstanceInCluster) {
      return false;
    }
    if (nextInstanceId != that.nextInstanceId) {
      return false;
    }
    if (boundAt != null ? !boundAt.equals(that.boundAt) : that.boundAt != null) {
      return false;
    }
    if (configuration != null
        ? !configuration.equals(that.configuration)
        : that.configuration != null) {
      return false;
    }

    return true;
  }
 private boolean inBundles(SourceManipulator manipulator, File osgiTarget) throws IOException {
   URI location = osgiTarget.toURI();
   BundleInfo[] bundles = manipulator.getBundles();
   for (int i = 0; i < bundles.length; i++) {
     if (location.equals(bundles[i].getLocation())) return true;
   }
   return false;
 }
Esempio n. 13
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   TagEntityMap other = (TagEntityMap) obj;
   if (method == null) {
     if (other.method != null) return false;
   } else if (!method.equals(other.method)) return false;
   if (resource == null) {
     if (other.resource != null) return false;
   } else if (!resource.equals(other.resource)) return false;
   if (tags == null) {
     if (other.tags != null) return false;
   } else if (!tags.equals(other.tags)) return false;
   return true;
 }
  /**
   * Get a {@link org.kitesdk.data.PartitionKey} corresponding to a partition's filesystem path
   * represented as a {@link URI}. If the path is not a valid partition, then {@link
   * IllegalArgumentException} is thrown. Note that the partition does not have to exist.
   *
   * @param dataset the filesystem dataset
   * @param partitionPath a directory path where the partition data is stored
   * @return a partition key representing the partition at the given path
   * @since 0.4.0
   */
  @SuppressWarnings("deprecation")
  public static PartitionKey partitionKeyForPath(Dataset dataset, URI partitionPath) {
    Preconditions.checkState(
        dataset.getDescriptor().isPartitioned(),
        "Attempt to get a partition on a non-partitioned dataset (name:%s)",
        dataset.getName());

    Preconditions.checkArgument(
        dataset instanceof FileSystemDataset, "Dataset is not a FileSystemDataset");
    FileSystemDataset fsDataset = (FileSystemDataset) dataset;

    FileSystem fs = fsDataset.getFileSystem();
    URI partitionUri = fs.makeQualified(new Path(partitionPath)).toUri();
    URI directoryUri = fsDataset.getDirectory().toUri();
    URI relativizedUri = directoryUri.relativize(partitionUri);

    if (relativizedUri.equals(partitionUri)) {
      throw new IllegalArgumentException(
          String.format(
              "Partition URI %s has different " + "root directory to dataset (directory: %s).",
              partitionUri, directoryUri));
    }

    Iterable<String> parts = Splitter.on('/').split(relativizedUri.getPath());

    PartitionStrategy partitionStrategy = dataset.getDescriptor().getPartitionStrategy();
    List<FieldPartitioner> fieldPartitioners = partitionStrategy.getFieldPartitioners();
    if (Iterables.size(parts) > fieldPartitioners.size()) {
      throw new IllegalArgumentException(
          String.format(
              "Too many partition directories " + "for %s (%s), expecting %s.",
              partitionUri, Iterables.size(parts), fieldPartitioners.size()));
    }

    List<Object> values = Lists.newArrayList();
    int i = 0;
    for (String part : parts) {
      Iterator<String> split = Splitter.on('=').split(part).iterator();
      String fieldName = split.next();
      FieldPartitioner fp = fieldPartitioners.get(i++);
      if (!fieldName.equals(fp.getName())) {
        throw new IllegalArgumentException(
            String.format(
                "Unrecognized partition name " + "'%s' in partition %s, expecting '%s'.",
                fieldName, partitionUri, fp.getName()));
      }
      if (!split.hasNext()) {
        throw new IllegalArgumentException(
            String.format(
                "Missing partition value for " + "'%s' in partition %s.", fieldName, partitionUri));
      }
      String stringValue = split.next();
      Object value = fp.valueFromString(stringValue);
      values.add(value);
    }
    return org.kitesdk.data.impl.Accessor.getDefault()
        .newPartitionKey(values.toArray(new Object[values.size()]));
  }
  private void updateUI() {
    if (!isAdded()) {
      return;
    }
    if (isSessionOpen()) {
      connectedStateLabel.setTextColor(
          getResources().getColor(R.color.com_facebook_usersettingsfragment_connected_text_color));
      connectedStateLabel.setShadowLayer(
          1f,
          0f,
          -1f,
          getResources()
              .getColor(R.color.com_facebook_usersettingsfragment_connected_shadow_color));

      if (user != null) {
        ImageRequest request = getImageRequest();
        if (request != null) {
          URI requestUrl = request.getImageUri();
          // Do we already have the right picture? If so, leave it alone.
          if (!requestUrl.equals(connectedStateLabel.getTag())) {
            if (user.getId().equals(userProfilePicID)) {
              connectedStateLabel.setCompoundDrawables(null, userProfilePic, null, null);
              connectedStateLabel.setTag(requestUrl);
            } else {
              ImageDownloader.downloadAsync(request);
            }
          }
        }
        connectedStateLabel.setText(user.getName());
      } else {
        connectedStateLabel.setText(
            getResources().getString(R.string.com_facebook_usersettingsfragment_logged_in));
        Drawable noProfilePic =
            getResources().getDrawable(R.drawable.com_facebook_profile_default_icon);
        noProfilePic.setBounds(
            0,
            0,
            getResources()
                .getDimensionPixelSize(
                    R.dimen.com_facebook_usersettingsfragment_profile_picture_width),
            getResources()
                .getDimensionPixelSize(
                    R.dimen.com_facebook_usersettingsfragment_profile_picture_height));
        connectedStateLabel.setCompoundDrawables(null, noProfilePic, null, null);
      }
    } else {
      int textColor =
          getResources()
              .getColor(R.color.com_facebook_usersettingsfragment_not_connected_text_color);
      connectedStateLabel.setTextColor(textColor);
      connectedStateLabel.setShadowLayer(0f, 0f, 0f, textColor);
      connectedStateLabel.setText(
          getResources().getString(R.string.com_facebook_usersettingsfragment_not_logged_in));
      connectedStateLabel.setCompoundDrawables(null, null, null, null);
      connectedStateLabel.setTag(null);
    }
  }
  /**
   * Process the state change activity whose element consists of the (absolute) file name and its
   * buffer size (or file size).
   */
  public void processStateChangeActivity() {
    if (this.activeTextEditor == null) {
      return;
    }

    URI fileResource = this.getFileResource(this.activeTextEditor);
    if (fileResource != null) {
      int activeBufferSize = this.activeBufferSize;

      // Will not send out data if there is no state change at all.
      if (fileResource.equals(this.latestStateChangeFile)
          && this.latestStateChangeFileSize == activeBufferSize) {
        return;
      }

      // Makes up state change data
      // StringBuffer statechangeData = new StringBuffer();
      // statechangeData.append(activeFileName);

      // Calculate test methods and assertions if it is a java file.
      IFileEditorInput fileEditorInput = (IFileEditorInput) this.activeTextEditor.getEditorInput();
      IFile file = fileEditorInput.getFile();
      if (file.exists()) {
        Map<String, String> statechangeMetricsMap = computeFileMetrics(file);

        // Status message for display
        StringBuffer msgBuf = new StringBuffer();
        msgBuf.append("statechange : ").append(file.getName());
        msgBuf.append(" [").append(statechangeMetricsMap.get(PROP_CURRENT_SIZE));

        String className = statechangeMetricsMap.get(PROP_CLASS_NAME);
        if (className != null) {
          msgBuf.append(", ").append(className);
        }

        String currentMethods = statechangeMetricsMap.get(PROP_CURRENT_METHODS);
        if (currentMethods != null) {
          msgBuf.append(", methods=").append(currentMethods);
        }

        String currentStatements = statechangeMetricsMap.get(PROP_CURRENT_STATEMENTS);
        if (currentStatements != null) {
          msgBuf.append(", stms=").append(currentStatements);
        }
        msgBuf.append(']');

        this.addDevEvent(
            EclipseSensorConstants.DEVEVENT_EDIT,
            fileResource,
            statechangeMetricsMap,
            msgBuf.toString());
      }

      this.latestStateChangeFile = fileResource;
      this.latestStateChangeFileSize = activeBufferSize;
    }
  }
Esempio n. 17
0
 /**
  * Test for quality with other objects.
  *
  * @param object the object to be test for equality.
  * @return boolean - returns true if the given object is of type HostIdentifier and its URI field
  *     is equal to this object's URI field. Otherwise, returns false.
  * @see java.net.URI#equals(Object)
  */
 public boolean equals(Object object) {
   if (object == this) {
     return true;
   }
   if (!(object instanceof HostIdentifier)) {
     return false;
   }
   return uri.equals(((HostIdentifier) object).uri);
 }
 @Override
 public boolean hasDescendants(URI uri) {
   for (URI candidate : objectResolver.keySet()) {
     if (!candidate.equals(uri) && candidate.toString().startsWith(uri.toString())) {
       return true;
     }
   }
   return false;
 }
Esempio n. 19
0
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof EvalSourceIdentifier) {
     return name.equals(((EvalSourceIdentifier) obj).name);
   }
   if (obj instanceof SourceIdentifier) {
     return uri.equals(((SourceIdentifier) obj).toUri());
   }
   return false;
 }
 static boolean isSystemFragmentBundle(URI location, LocationInfo info) {
   boolean ret = false;
   if (info.systemFragmentedBundleLocations == null) return false;
   for (int i = 0; i < info.systemFragmentedBundleLocations.length; i++)
     if (location.equals(info.systemFragmentedBundleLocations[i])) {
       ret = true;
       break;
     }
   return ret;
 }
Esempio n. 21
0
  protected String getLabel(Measure measure, String locale, URI resourceRole, URI linkRole)
      throws XBRLException {

    URI namespace = measure.getNamespace();
    String name = measure.getLocalname();
    String query =
        "for $root in #roots#[@type='"
            + MeasureResourceImpl.class.getName()
            + "'] let $data:=$root/xbrlapi:data/* where $data/@namespace='"
            + namespace
            + "' and $data/@name='"
            + name
            + "' return $root";
    List<MeasureResource> unitResources = getStore().<MeasureResource>queryForXMLResources(query);
    for (MeasureResource unitResource : unitResources) {
      List<LabelResource> labels =
          unitResource.getLabelsWithLanguageAndResourceRoleAndLinkRole(
              locale, resourceRole, linkRole);
      if (!labels.isEmpty()) {
        return labels.get(0).getStringValue();
      }
    }

    // Try for a label on an equivalent unit resource.
    Set<MeasureResource> equivalentResources = new HashSet<MeasureResource>();
    for (MeasureResource unitResource : unitResources) {
      equivalentResources.addAll(unitResource.getEquivalents());
    }
    equivalentResources.removeAll(unitResources);
    for (MeasureResource unitResource : equivalentResources) {
      List<LabelResource> labels =
          unitResource.getLabelsWithLanguageAndResourceRoleAndLinkRole(
              locale, resourceRole, linkRole);
      if (!labels.isEmpty()) {
        return labels.get(0).getStringValue();
      }
    }

    if (namespace.equals(Constants.ISO4217)) return "Currency:" + name;
    if (namespace.equals(Constants.XBRL21Namespace) && name.equals("pure")) return "none";

    return namespace + "#" + name;
  }
Esempio n. 22
0
 /**
  * @param physicalURI
  * @return
  */
 protected boolean isLoadedOntologyFromLocation(URI physicalURI) {
   Set<OWLOntology> loadedOntos =
       getOWLModelManager().getOntologies(); // getOWLOntologyManager().getOntologies();
   for (OWLOntology onto : loadedOntos) {
     URI curURI = getOWLModelManager().getOntologyPhysicalURI(onto);
     if (curURI != null && curURI.equals(physicalURI)) {
       return true;
     }
   }
   return false;
 }
Esempio n. 23
0
 @Override
 public boolean equals(final Object o) {
   if (this == o) {
     return true;
   }
   if (o == null || !(o instanceof MutableUri)) {
     return false;
   }
   MutableUri that = (MutableUri) o;
   return uri.equals(that.uri);
 }
Esempio n. 24
0
  @Test
  public void test() throws Exception {

    URI uri = new URI("http://www.google.de");

    assertEquals(uri, URIFactory.getUri(uri.toString()));

    uri = new URI("http://soundcloud.com/search?q[fulltext]=balkan");

    assertFalse(uri.equals(URIFactory.getUri(uri.toString())));
  }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   MutableBlobPropertiesImpl other = (MutableBlobPropertiesImpl) obj;
   if (url == null) {
     if (other.url != null) return false;
   } else if (!url.equals(other.url)) return false;
   return true;
 }
Esempio n. 26
0
 /* (non-Javadoc)
  * @see org.eclipse.core.filesystem.provider.FileStore#isParentOf(org.eclipse.core.filesystem.IFileStore)
  */
 @Override
 public boolean isParentOf(IFileStore other) {
   if (other instanceof VirtualFile) {
     VirtualFile otherFile = (VirtualFile) other;
     return baseURI.equals(otherFile.baseURI)
         && ((path.isRoot() && !otherFile.path.isRoot())
             || (path.matchingFirstSegments(otherFile.path) == path.segmentCount()
                 && path.segmentCount() <= otherFile.path.segmentCount()));
   }
   return false;
 }
  static boolean isPrerequisiteBundles(URI location, LocationInfo info) {
    boolean ret = false;

    if (info.prerequisiteLocations == null) return false;
    for (int i = 0; i < info.prerequisiteLocations.length; i++)
      if (location.equals(info.prerequisiteLocations[i])) {
        ret = true;
        break;
      }

    return ret;
  }
Esempio n. 28
0
  private void clusterDiscovery()
      throws URISyntaxException, ParserConfigurationException, SAXException, IOException {
    determineUri();

    readClustersXml();

    // Now try to join or create cluster
    if (clusters != null) {
      Clusters.Cluster clusterConfig =
          clusters.getCluster(config.get(ClusterSettings.cluster_name));
      if (clusterConfig != null) {
        for (Clusters.Member member : clusterConfig.getMembers()) {
          URI joinUri = new URI("cluster://" + member.getHost());
          if (!joinUri.equals(serverId)) {
            Future<ClusterConfiguration> config = cluster.join(joinUri);
            try {
              logger.logMessage("Joined cluster:" + config.get());

              try {
                updateMyInfo();
              } catch (TransformerException e) {
                throw new RuntimeException(e);
              }

              return;
            } catch (InterruptedException e) {
              e.printStackTrace();
            } catch (ExecutionException e) {
              logger.logMessage("Could not join cluster member " + member.getHost());
            }
          }
        }
      }

      // Could not find cluster or not join nodes in cluster - create it!
      if (clusterConfig == null) {
        clusterConfig = new Clusters.Cluster(config.get(ClusterSettings.cluster_name));
        clusters.getClusters().add(clusterConfig);
      }

      cluster.create(clusterConfig.getName());

      if (clusterConfig.getByUri(serverId) == null) {
        clusterConfig.getMembers().add(new Clusters.Member(serverId.toString()));

        try {
          updateMyInfo();
        } catch (TransformerException e) {
          logger.logMessage("Could not update cluster discovery file:" + clustersUri, e);
        }
      }
    }
  }
Esempio n. 29
0
  /**
   * Given a URI for mapreduce intermediate output, swizzle the it to point to the local file
   * system. This can be called in case the caller decides to run in local mode (in which case all
   * intermediate data can be stored locally)
   *
   * @param originalURI uri to localize
   * @return localized path for map-red intermediate data
   */
  public String localizeMRTmpFileURI(String originalURI) {
    Path o = new Path(originalURI);
    Path mrbase = new Path(getMRScratchDir());

    URI relURI = mrbase.toUri().relativize(o.toUri());
    if (relURI.equals(o.toUri())) {
      throw new RuntimeException(
          "Invalid URI: " + originalURI + ", cannot relativize against" + mrbase.toString());
    }

    return getLocalScratchDir(!explain) + Path.SEPARATOR + relURI.getPath();
  }
Esempio n. 30
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (!super.equals(obj)) return false;
   if (getClass() != obj.getClass()) return false;
   DriveInfo other = (DriveInfo) obj;
   if (autoexpanding == null) {
     if (other.autoexpanding != null) return false;
   } else if (!autoexpanding.equals(other.autoexpanding)) return false;
   if (bits == null) {
     if (other.bits != null) return false;
   } else if (!bits.equals(other.bits)) return false;
   if (claimed == null) {
     if (other.claimed != null) return false;
   } else if (!claimed.equals(other.claimed)) return false;
   if (description == null) {
     if (other.description != null) return false;
   } else if (!description.equals(other.description)) return false;
   if (driveType == null) {
     if (other.driveType != null) return false;
   } else if (!driveType.equals(other.driveType)) return false;
   if (encryptionCipher == null) {
     if (other.encryptionCipher != null) return false;
   } else if (!encryptionCipher.equals(other.encryptionCipher)) return false;
   if (encryptionKey == null) {
     if (other.encryptionKey != null) return false;
   } else if (!encryptionKey.equals(other.encryptionKey)) return false;
   if (free == null) {
     if (other.free != null) return false;
   } else if (!free.equals(other.free)) return false;
   if (imaging == null) {
     if (other.imaging != null) return false;
   } else if (!imaging.equals(other.imaging)) return false;
   if (installNotes == null) {
     if (other.installNotes != null) return false;
   } else if (!installNotes.equals(other.installNotes)) return false;
   if (metrics == null) {
     if (other.metrics != null) return false;
   } else if (!metrics.equals(other.metrics)) return false;
   if (os == null) {
     if (other.os != null) return false;
   } else if (!os.equals(other.os)) return false;
   if (status != other.status) return false;
   if (type != other.type) return false;
   if (url == null) {
     if (other.url != null) return false;
   } else if (!url.equals(other.url)) return false;
   if (user == null) {
     if (other.user != null) return false;
   } else if (!user.equals(other.user)) return false;
   return true;
 }