Package org.apache.geronimo.kernel.config

Examples of org.apache.geronimo.kernel.config.Manifest$Section


  public void createBeanCreateCloneThenCloneShouldHaveSameStructureAndValuesButEveryElementOfDifferentReference() {
   
    // create some data
    // use a.b.m2.Book which has 1:N relations (collection) to other beans
    Book book = new Book("History of Britain", "John O'Farrel", ImmutableList.copyOf(new Section[] {
      new Section("Section1", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1, "Bla bla bla"),
          new Paragraph(1, "Bla bla bla"),
      })),
      new Section("Section2", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1066, "Bla bla bla"),
      })),
      new Section("Section3", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1, "Bla bla bla"),
          new Paragraph(2, "Bla bla bla"),
          new Paragraph(3, "Bla bla bla"),
      })),
    }));
View Full Code Here


public class SimpleApp {
  public static void main(String[] args) {
    // create some data
    // use a.b.m2.Book which has 1:N relations (collection) to other beans
    Book book = new Book("History of Britain", "John O'Farrel", ImmutableList.copyOf(new Section[] {
      new Section("Section1", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1, "Bla bla bla"),
          new Paragraph(1, "Bla bla bla"),
      })),
      new Section("Section2", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1066, "Bla bla bla"),
      })),
      new Section("Section3", "no description", ImmutableSet.copyOf(new Paragraph[] {
          new Paragraph(1, "Bla bla bla"),
          new Paragraph(2, "Bla bla bla"),
          new Paragraph(3, "Bla bla bla"),
      })),
    }));
View Full Code Here

    Body body = new Body();
    Mdiv mdiv = new Mdiv();
    Score score = new Score();
    ScoreDef scoreDef = createScoreDef(stavesCount);
    score.getGapsAndSbsAndCorrs().add(scoreDef);
    Section section = new Section();
    Measure measureFirst = new Measure();
    Staff staffFirst = new Staff();
    Layer layerFirst = new Layer();
    staffFirst.getSbsAndSymbolsAndOrigs().add(layerFirst);
    measureFirst.getAnnotsAndSlursAndTupletSpen().add(staffFirst);
    for (int stavesIter = 1; stavesIter < stavesCount; stavesIter++) {
      Staff staff = new Staff();
      Layer layer = new Layer();
      staff.getSbsAndSymbolsAndOrigs().add(layer);
      measureFirst.getAnnotsAndSlursAndTupletSpen().add(staff);
    }
    section.getUnclearsAndSbsAndApps().add(measureFirst);

    for (int measureIter = 1; measureIter < measureCount; measureIter++) {
      Measure measure = new Measure();
      for (int stavesIter = 0; stavesIter < stavesCount; stavesIter++) {
        Staff staff = new Staff();
        Layer layer = new Layer();
        staff.getSbsAndSymbolsAndOrigs().add(layer);
        measure.getAnnotsAndSlursAndTupletSpen().add(staff);
      }
      section.getUnclearsAndSbsAndApps().add(measure);
    }
    score.getGapsAndSbsAndCorrs().add(section);
    mdiv.setScore(score);
    body.getMdivs().add(mdiv);
    music.setBody(body);
View Full Code Here

    tpd.setDescription(MusicMessages.MEI_documentation_generic_n);
    descriptors.add(tpd);
  }
 
  private void createDefaultSection() {
    setMeiNode(new Section());
  }
View Full Code Here

  private static MeiNode handleScoreChild(BasicElement childForm,
      boolean saveAllVariants) {
    if (childForm instanceof SectionForm) {
      SectionForm sectionForm = (SectionForm) childForm;
      Section section = (Section) sectionForm.getMeiNode();
      section.getUnclearsAndSbsAndApps().clear();
      for (BasicElement sectionChildForm : sectionForm.getChildren()) {
        section.getUnclearsAndSbsAndApps().add(
            handleScoreChild(sectionChildForm, saveAllVariants));
      }
      return section;
    } else if (childForm instanceof EndingForm) {
      EndingForm endingForm = (EndingForm) childForm;
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public Section createSectionFromString(EDataType eDataType, String initialValue) {
        Section result = Section.get(initialValue);
        if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
        return result;
    }
View Full Code Here

        SectionsType owsSections = (SectionsType) kvp.get("sections");
        if(owsSections != null) {
            Sections sections = Wcs20Factory.eINSTANCE.createSections();
            for(Object o : owsSections.getSection()) {
                String sectionName = (String) o;
                Section section = Section.get(sectionName);
                if(section == null) {
                    throw new WCS20Exception("Invalid sections value " + sectionName + ", supported values are " + Arrays.asList(Section.values()),
                            OWSExceptionCode.InvalidParameterValue, "sections");
                }
                sections.getSection().add(section);
View Full Code Here

    public void removeImportPackages(Collection<String> importPackages) {
        this.imports.removeAll(importPackages);
    }

    public Manifest getManifest() throws ManifestException {
        Manifest manifest = new Manifest();
        manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_MANIFESTVERSION, "2"));
        manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_SYMBOLICNAME, configId.getGroupId() + "." + configId.getArtifactId()));
        String versionString = "" + configId.getVersion().getMajorVersion() + "." + configId.getVersion().getMinorVersion() + "." + configId.getVersion().getIncrementalVersion();
        if (configId.getVersion().getQualifier() != null) {
            versionString += "." + configId.getVersion().getQualifier().replaceAll("[^-_\\w]{1}", "_");
        }

        manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_VERSION, versionString));

        if (bundleActivator != null) {
            manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_ACTIVATOR, bundleActivator));
        }

        if (!imports.isEmpty()) {
            manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.IMPORT_PACKAGE, imports));
        }

        if (!exports.isEmpty()) {
            manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.EXPORT_PACKAGE, exports));
        }

        if (!dynamicImports.isEmpty()) {
            manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.DYNAMICIMPORT_PACKAGE, dynamicImports));
        }

        if (!bundleClassPath.isEmpty()) {
            Manifest.Attribute bundleClassPath = new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.BUNDLE_CLASSPATH, this.bundleClassPath);
            manifest.addConfiguredAttribute(bundleClassPath);
        }

        if (!requireBundles.isEmpty()) {
            Manifest.Attribute requireBundle = new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.REQUIRE_BUNDLE, this.requireBundles);
            manifest.addConfiguredAttribute(requireBundle);
        }
        return manifest;
    }
View Full Code Here

                b.uninstall();
                break;
            }
        }
        //2. Generate the MANIFEST.MF file for the share library
        Manifest manifest = new Manifest();
        manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_MANIFESTVERSION, "2"));
        Artifact configId = name.getArtifact();
        manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_SYMBOLICNAME, configId.getGroupId() + "." + configId.getArtifactId() + "." + name.getNameProperty("name")));
        String versionString = "" + configId.getVersion().getMajorVersion() + "." + configId.getVersion().getMinorVersion() + "." + configId.getVersion().getIncrementalVersion();
        if (configId.getVersion().getQualifier() != null) {
            versionString += "." + configId.getVersion().getQualifier().replaceAll("[^-_\\w]{1}", "_");
        }
        manifest.addConfiguredAttribute(new Manifest.Attribute(Constants.BUNDLE_VERSION, versionString));
        Set<String> bundleClassPaths = generateBundleClassPath();
        if (bundleClassPaths.size() > 0) {
            Manifest.Attribute bundleClassPath = new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.BUNDLE_CLASSPATH, bundleClassPaths);
            manifest.addConfiguredAttribute(bundleClassPath);
        }
        //import packages, dynamic import packages and required bundles are from the configuration bundle.
        String importPackages = (String)bundleContext.getBundle().getHeaders().get(Constants.IMPORT_PACKAGE);
        if (importPackages != null) {
            manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.IMPORT_PACKAGE, importPackages));
        }
        String dynamicImportPackages = (String)bundleContext.getBundle().getHeaders().get(Constants.DYNAMICIMPORT_PACKAGE);
        if (dynamicImportPackages != null) {
            List<HeaderElement> headerElements = HeaderParser.parseHeader(dynamicImportPackages);
            //From shared library perspective, dynamic * should not be used
            for (Iterator<HeaderElement> it = headerElements.iterator(); it.hasNext();) {
                if (it.next().getName().equals("*")) {
                    it.remove();
                }
            }
            if (headerElements.size() > 0) {
                manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.DYNAMICIMPORT_PACKAGE, HeaderBuilder.build(headerElements)));
            }
        }
        String requiredBundles = (String)bundleContext.getBundle().getHeaders().get(Constants.REQUIRE_BUNDLE);
        if (requiredBundles != null) {
            manifest.addConfiguredAttribute(new Manifest.Attribute(Manifest.Attribute.Separator.COMMA, Constants.REQUIRE_BUNDLE, requiredBundles));
        }
        //3. Write the MANIFEST.MF file
        File metaInf = new File(baseFolder, "META-INF");
        metaInf.mkdirs();
        PrintWriter pw = null;
        try {
            pw = new PrintWriter(new FileWriter(new File(metaInf, "MANIFEST.MF")));
            manifest.write(pw);
        } finally {
            IOUtils.close(pw);
        }
        //4. Install the bundle
        sharedLibBundle = bundleContext.installBundle(bundleLocation);
View Full Code Here

        try {
            osgiMetaDataBuilder.build(env);
        } catch (IllegalConfigurationException e) {
            throw new DeploymentException(e);
        }
        Manifest manifest;
        try {
            manifest = env.getManifest();
        } catch (ManifestException e) {
            throw new DeploymentException(e);
        }

        File metaInf = new File(getConfigurationDir(), "META-INF");
        metaInf.mkdirs();
        FileWriter fw = new FileWriter(new File(metaInf, "MANIFEST.MF"));
        PrintWriter pw = new PrintWriter(fw);
        try {
            manifest.write(pw);
        } finally {
            pw.close();
            fw.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.config.Manifest$Section

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.