Ejemplo n.º 1
0
  private static void prepareJAR(PackageVersion version, List<Instance> instances) {
    List<CompiledJavaClass> classes = new ArrayList<>();
    List<Identity> identities = new ArrayList<>();
    List<Translation> translations = new ArrayList<>();
    for (Instance i : instances) {
      if (i instanceof CompiledJavaClass) {
        classes.add((CompiledJavaClass) i);
      } else if (i instanceof Identity) {
        identities.add((Identity) i);
      } else if (i instanceof Translation) {
        translations.add((Translation) i);
      }
    }

    LOG.info("Preparing JAR for package '" + version);
    String jarName = JarUtils.getPackagePath(version, true);
    try {
      // Prepare jar for this package version
      File file = new File(jarName);
      JarUtils.prepareJar(
          file, classes, identities, translations, version.getPackaze().getPackageNamespace());
    } catch (Exception e) {
      LOG.info("Package Jar not prepared for " + jarName);
      throw new RuntimeException(e);
    }
  }
Ejemplo n.º 2
0
 private static UploadedPackageMember createUploadedMembership(
     Instance component, PackageMember member, PackageVersion version) {
   // Create Uploaded Package Membership with cloned component
   UploadedPackageMember uploadMembership =
       AModelType.newInstanceOfType(SO.UPLOADED_PACKAGE_MEMBER);
   uploadMembership.setPackaze(version.getPackaze());
   uploadMembership.setPackageVersion(version);
   uploadMembership.setComponent(component);
   uploadMembership.setPackageMember(member);
   return uploadMembership;
 }
Ejemplo n.º 3
0
 /**
  * Create jar path with the given package version
  *
  * <p>appsDir/packageName_version.jar
  *
  * @param isJar
  * @param installedPackage
  * @return
  */
 public static String getPackageFileName(PackageVersion version, boolean isJar) {
   StringBuilder s = new StringBuilder();
   s.append(version.getPackaze().getPackageNamespace());
   s.append(VERSION_SEPERATOR);
   s.append(version.getNumber());
   if (isJar) {
     s.append(".jar");
   } else {
     s.append(".data");
   }
   return s.toString();
 }