Package com.puppetlabs.geppetto.forge.model

Examples of com.puppetlabs.geppetto.forge.model.ModuleName$BadOwnerCharactersException


        for(ExportSpec spec : getExportSpecs(whiteCheckedResources)) {
          try {
            Metadata md = getForge().createFromModuleDirectory(
              spec.getModuleRoot(), false, spec.getFileFilter(), null, diag);
            if(md != null) {
              ModuleName name = md.getName();
              if(owner == null)
                owner = name.getOwner();
              else if(!owner.equals(name.getOwner())) {
                setErrorMessage(plugin.getString("_UI_MultipleModuleOwners"));
                return false;
              }
            }
          }
View Full Code Here


    }
    addPositions(call);
  }

  public synchronized void addDependency(String moduleName, String versionRequirement) {
    ModuleName m;
    try {
      m = ModuleName.fromString(moduleName);
      moduleName = m.toString('/');
    }
    catch(IllegalArgumentException e) {
      m = null;
    }

    if(m != null) {
      for(Dependency dep : dependencies)
        try {
          ModuleName candidate = ModuleName.fromString(dep.getModuleName());
          if(m.equals(candidate)) {
            dep.setNameAndVersion(moduleName, versionRequirement);
            return;
          }
        }
View Full Code Here

  public boolean hasDependencyErrors() {
    return dependencyErrors;
  }

  private boolean isResolved(Dependency dep) {
    ModuleName name;
    VersionRange range;
    try {
      name = ModuleName.create(dep.getModuleName(), false);
      range = VersionRange.create(dep.getVersionRequirement());
      return PPModuleMetadataBuilder.getBestMatchingProject(name, range) != null;
View Full Code Here

      if(tst.equals(moduleSource))
        throw new IllegalArgumentException("Destination cannot reside within the module itself");
    }

    ModuleName fullName = md.getName();
    Version ver = md.getVersion();
    if(fullName == null || ver == null)
      // Reason has been added to the Diagnostic result
      return null;
View Full Code Here

  public void parse(File file, String content, Diagnostic chain) throws JsonParseException, IOException {
    JElement root = parse(file, content);
    if(!(root instanceof JObject))
      throw new JsonParseException("Excpected Json Object", JsonLocation.NA);

    ModuleName fullName = null;
    boolean nameSeen = false;
    boolean versionSeen = false;

    for(JEntry entry : ((JObject) root).getEntries()) {
      try {
        CallSymbol symbol = CallSymbol.valueOf(entry.getKey());
        if(symbol == CallSymbol.dependency)
          // Not recognized in metadata.json
          throw new IllegalArgumentException();

        JElement args = entry.getElement();
        if(symbol == CallSymbol.name) {
          fullName = createModuleName(args, false, chain);
          nameSeen = true;
        }
        else if(symbol == CallSymbol.version) {
          createVersion(args, chain);
          versionSeen = true;
        }
        else
          switch(symbol) {
            case dependencies:
              validateDependencies(args, symbol.name(), chain);
              break;
            case types:
              validateTypes(args, symbol.name(), chain);
              break;
            case checksums:
              validateChecksums(args, symbol.name(), chain);
              break;
            default:
              validateString(args, symbol.name(), chain);
          }

        if(args instanceof JArray)
          call(symbol, entry.getLine(), entry.getOffset(), entry.getLength(), ((JArray) args).getValues());
        else
          call(
            symbol, entry.getLine(), entry.getOffset(), entry.getLength(),
            Collections.singletonList(entry.getElement()));
      }
      catch(IllegalArgumentException e) {
        chain.addChild(createDiagnostic(entry, ERROR, "Unrecognized call: " + entry.getKey()));
      }
    }

    if(!nameSeen || fullName != null && (fullName.getOwner() == null || fullName.getName() == null)) {
      chain.addChild(new FileDiagnostic(ERROR, PACKAGE, "A full name (user-module) must be specified", file));
    }

    if(!versionSeen) {
      chain.addChild(new FileDiagnostic(ERROR, PACKAGE, "A version must be specified", file));
View Full Code Here

          tracer.trace("Project not accessible: ", p.getName());
        continue;
      }

      Version version = null;
      ModuleName moduleName = null;
      try {
        String mn = p.getPersistentProperty(PROJECT_PROPERTY_MODULENAME);
        moduleName = mn == null
            ? null
            : ModuleName.fromString(mn);
View Full Code Here

      createResourceMarkers(moduleFile, diagnostic);

      // sync version and name project data
      Version version = null;
      ModuleName moduleName = null;
      if(metadata != null) {
        version = metadata.getVersion();
        moduleName = metadata.getName();
      }

      if(version == null)
        version = Version.fromString("0.0.0");

      if(moduleName != null) {
        if(!project.getName().toLowerCase().contains(moduleName.getName().toString().toLowerCase()))
          createWarningMarker(moduleFile, "Mismatched name - project does not reflect module: '" +
              moduleName + "'", null);
      }

      try {
        IProject p = getProject();
        String storedVersion = p.getPersistentProperty(PROJECT_PROPERTY_MODULEVERSION);
        String vstr = version.toString();
        if(!vstr.equals(storedVersion))
          p.setPersistentProperty(PROJECT_PROPERTY_MODULEVERSION, vstr);

        String storedName = p.getPersistentProperty(PROJECT_PROPERTY_MODULENAME);
        if(moduleName == null) {
          if(storedName != null)
            p.setPersistentProperty(PROJECT_PROPERTY_MODULENAME, null);
        }
        else {
          String mstr = moduleName.toString();
          if(!mstr.equals(storedName))
            p.setPersistentProperty(PROJECT_PROPERTY_MODULENAME, mstr.toString());
        }
      }
      catch(CoreException e1) {
View Full Code Here

      return;
    }

    InputStream gzInput = new FileInputStream(moduleArchive);
    try {
      ModuleName name = metadata.getName();
      releaseService.create(
        name.getOwner(), name.getName(), "Published using GitHub trigger", gzInput, moduleArchive.length());
      result.addChild(new Diagnostic(INFO, PUBLISHER, "Module file " + moduleArchive.getName() +
          " has been uploaded"));
    }
    finally {
      StreamUtil.close(gzInput);
View Full Code Here

      if("name".equals(key))
        name = entry.getElement().toStringOrNull();
      else if("version_requirement".equals(key) || "versionRequirement".equals(key))
        vreq = entry.getElement().toStringOrNull();
    }
    ModuleName mname = createModuleName(name);
    if(mname == null)
      return null;

    Dependency dep = new DependencyWithPosition(jsonDep);
    dep.setName(mname);
View Full Code Here

   *
   * @param d
   * @return
   */
  protected IProject getBestMatchingProject(Dependency d) {
    ModuleName name = d.getName();
    if(name == null)
      return null;

    String namepart = name + "-";
    BiMap<IProject, Version> candidates = HashBiMap.create();
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.forge.model.ModuleName$BadOwnerCharactersException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.