Package org.apache.wookie.w3c.impl

Examples of org.apache.wookie.w3c.impl.WidgetManifestModel


      throw new BadWidgetZipFileException();
    }
    if (WidgetPackageUtils.hasManifest(zip)){
      try {
        // build the model
        WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, encodings, zip, defaultIdentifier);                             

        // get the widget identifier
        String manifestIdentifier = widgetModel.getIdentifier();           
        // create the folder structure to unzip the zip into
        unzippedWidgetDirectory = WidgetPackageUtils.createUnpackedWidgetFolder(outputDirectory, manifestIdentifier);
        // now unzip it into that folder
        WidgetPackageUtils.unpackZip(zip, unzippedWidgetDirectory);
        // checks for validity of widget using digital signatures
        if (digitalSignatureParser != null) {
          digitalSignatureParser
              .processDigitalSignatures(unzippedWidgetDirectory
                  .getAbsolutePath());
        }
        // Iterate over all start files and update paths
        for (IContent content: widgetModel.getContentList()){
          // now update the js links in the start page
          File startFile = new File(unzippedWidgetDirectory.getCanonicalPath() + File.separator + content.getSrc());
          String relativestartUrl = (WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, content.getSrc()));          
          content.setSrc(relativestartUrl);
          if(startFile.exists() && startPageProcessor != null){   
            startPageProcessor.processStartFile(startFile, widgetModel, content);
          }
        }
        if (widgetModel.getContentList().isEmpty()){
          throw new InvalidStartFileException("Widget has no start page");
        }
       
        // get the path to the root of the unzipped folder
        String thelocalPath = WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, "");
        // now pass this to the model which will prepend the path to local resources (not web icons)
        widgetModel.updateIconPaths(thelocalPath);
       
        // check to see if this widget already exists in the DB - using the ID (guid) key from the manifest
        return widgetModel;

      }catch(InsecuredWidgetContentException ex){
View Full Code Here


      throw new BadWidgetZipFileException();
    }
    if (WidgetPackageUtils.hasManifest(zip)){
      try {
        // build the model
        WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, encodings, zip, defaultIdentifier);                             

        // get the widget identifier
        String manifestIdentifier = widgetModel.getIdentifier();           
        // create the folder structure to unzip the zip into
        unzippedWidgetDirectory = WidgetPackageUtils.createUnpackedWidgetFolder(outputDirectory, manifestIdentifier);
        // now unzip it into that folder
        WidgetPackageUtils.unpackZip(zip, unzippedWidgetDirectory)
       
        // Iterate over all start files and update paths
        for (IContentEntity content: widgetModel.getContentList()){
          // now update the js links in the start page
          File startFile = new File(unzippedWidgetDirectory.getCanonicalPath() + File.separator + content.getSrc());
          String relativestartUrl = (WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, content.getSrc()));          
          content.setSrc(relativestartUrl);
          if(startFile.exists() && startPageProcessor != null){   
            startPageProcessor.processStartFile(startFile, widgetModel, content);
         
        }
        if (widgetModel.getContentList().isEmpty()){
          throw new InvalidStartFileException("Widget has no start page");
        }
       
        // get the path to the root of the unzipped folder
        String thelocalPath = WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, "");
        // now pass this to the model which will prepend the path to local resources (not web icons)
        widgetModel.updateIconPaths(thelocalPath);       
       
        // check to see if this widget already exists in the DB - using the ID (guid) key from the manifest
        return widgetModel;
      } catch (InvalidStartFileException e) {
        throw e;
View Full Code Here

    assertFalse(pref.isReadOnly());
  }
 
  @Test
  public void widget() throws JDOMException, IOException, BadManifestException{
    WidgetManifestModel widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\"><name>test</name></widget>",null,null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals("test",widget.getLocalName("en"));
    assertEquals("floating",widget.getViewModes());
   
    widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\" viewmodes=\"fullscreen\"></widget>",null,null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals(IW3CXMLConfiguration.UNKNOWN,widget.getLocalName("en"));
    assertEquals("fullscreen",widget.getViewModes());
  }
View Full Code Here

    assertFalse(pref.isReadOnly());
  }
 
  @Test
  public void widget() throws JDOMException, IOException, BadManifestException{
    WidgetManifestModel widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\"><name>test</name></widget>",null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals("test",widget.getLocalName("en"));
    assertEquals("floating",widget.getViewModes());
   
    widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\" viewmodes=\"fullscreen\"></widget>",null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals(IW3CXMLConfiguration.UNKNOWN,widget.getLocalName("en"));
    assertEquals("fullscreen",widget.getViewModes());
  }
View Full Code Here

      throw new BadWidgetZipFileException();
    }
    if (WidgetPackageUtils.hasManifest(zip)){
      try {
        // build the model
        WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, encodings, zip, defaultIdentifier);                             

        // get the widget identifier
        String manifestIdentifier = widgetModel.getIdentifier();           
        // create the folder structure to unzip the zip into
        unzippedWidgetDirectory = WidgetPackageUtils.createUnpackedWidgetFolder(outputDirectory, manifestIdentifier);
        // now unzip it into that folder
        WidgetPackageUtils.unpackZip(zip, unzippedWidgetDirectory)
       
        // Iterate over all start files and update paths
        for (IContentEntity content: widgetModel.getContentList()){
          // now update the js links in the start page
          File startFile = new File(unzippedWidgetDirectory.getCanonicalPath() + File.separator + content.getSrc());
          String relativestartUrl = (WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, content.getSrc()));          
          content.setSrc(relativestartUrl);
          if(startFile.exists() && startPageProcessor != null){   
            startPageProcessor.processStartFile(startFile, widgetModel, content);
         
        }
        if (widgetModel.getContentList().isEmpty()){
          throw new InvalidStartFileException("Widget has no start page");
        }
       
        // get the path to the root of the unzipped folder
        String thelocalPath = WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, "");
        // now pass this to the model which will prepend the path to local resources (not web icons)
        widgetModel.updateIconPaths(thelocalPath);       
       
        // check to see if this widget already exists in the DB - using the ID (guid) key from the manifest
        return widgetModel;
      } catch (InvalidStartFileException e) {
        throw e;
View Full Code Here

    assertFalse(pref.isReadOnly());
  }
 
  @Test
  public void widget() throws JDOMException, IOException, BadManifestException{
    WidgetManifestModel widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\"><name>test</name></widget>",null,null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals("test",widget.getLocalName("en"));
    assertEquals("floating",widget.getViewModes());
   
    widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\" viewmodes=\"fullscreen\"></widget>",null,null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals(IW3CXMLConfiguration.UNKNOWN,widget.getLocalName("en"));
    assertEquals("fullscreen",widget.getViewModes());
  }
View Full Code Here

        if (locales.length == 1 && locales[0].equals("*")){
          locales = WidgetPackageUtils.getLocalesFromZipFile(zip);
        }
       
        // build the model
        WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, encodings, zip, defaultIdentifier);                             

        // get the widget identifier
        String manifestIdentifier = widgetModel.getIdentifier();           
        // create the folder structure to unzip the zip into
        unzippedWidgetDirectory = WidgetPackageUtils.createUnpackedWidgetFolder(outputDirectory, manifestIdentifier);
        // now unzip it into that folder
        WidgetPackageUtils.unpackZip(zip, unzippedWidgetDirectory);
        // checks for validity of widget using digital signatures
        if (digitalSignatureParser != null) {
          digitalSignatureParser
          .processDigitalSignatures(unzippedWidgetDirectory
              .getAbsolutePath());
        }
        // Iterate over all start files and update paths
        for (IContent content: widgetModel.getContentList()){
          // now update the js links in the start page
          File startFile = new File(unzippedWidgetDirectory.getCanonicalPath() + File.separator + content.getSrc());
          String relativestartUrl = (WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, content.getSrc()));          
          content.setSrc(relativestartUrl);
          if(startFile.exists() && startPageProcessor != null){   
            startPageProcessor.processStartFile(startFile, widgetModel, content);
          }
        }
        if (widgetModel.getContentList().isEmpty()){
          throw new InvalidStartFileException("Widget has no start page");
        }

        // get the path to the root of the unzipped folder
        String thelocalPath = WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, "");
        // now pass this to the model which will prepend the path to local resources (not web icons)
        widgetModel.updateIconPaths(thelocalPath);

        // check to see if this widget already exists in the DB - using the ID (guid) key from the manifest
        return widgetModel;

      }catch(InsecuredWidgetContentException ex){
View Full Code Here

    assertFalse(pref.isReadOnly());
  }
 
  @Test
  public void widget() throws JDOMException, IOException, BadManifestException{
    WidgetManifestModel widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\"><name>test</name></widget>",null,null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals("test",widget.getLocalName("en"));
    assertEquals("floating",widget.getViewModes());
   
    widget = new WidgetManifestModel("<widget xmlns=\""+IW3CXMLConfiguration.MANIFEST_NAMESPACE+"\" viewmodes=\"fullscreen\"></widget>",null,null,null,null,null);
    assertNull(widget.getAuthor());
    assertEquals(IW3CXMLConfiguration.UNKNOWN,widget.getLocalName("en"));
    assertEquals("fullscreen",widget.getViewModes());
  }
View Full Code Here

      throw new BadWidgetZipFileException();
    }
    if (WidgetPackageUtils.hasManifest(zip)){
      try {
        // build the model
        WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, encodings, zip);                             

        // get the widget identifier
        String manifestIdentifier = widgetModel.getIdentifier();           
        // create the folder structure to unzip the zip into
        unzippedWidgetDirectory = WidgetPackageUtils.createUnpackedWidgetFolder(outputDirectory, manifestIdentifier);
        // now unzip it into that folder
        WidgetPackageUtils.unpackZip(zip, unzippedWidgetDirectory)
       
        // Iterate over all start files and update paths
        for (IContentEntity content: widgetModel.getContentList()){
          // now update the js links in the start page
          File startFile = new File(unzippedWidgetDirectory.getCanonicalPath() + File.separator + content.getSrc());
          String relativestartUrl = (WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, content.getSrc()));          
          content.setSrc(relativestartUrl);
          if(startFile.exists() && startPageProcessor != null){   
            startPageProcessor.processStartFile(startFile, widgetModel);
         
        }
        if (widgetModel.getContentList().isEmpty()){
          throw new InvalidStartFileException("Widget has no start page");
        }
       
        // get the path to the root of the unzipped folder
        String thelocalPath = WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, "");
        // now pass this to the model which will prepend the path to local resources (not web icons)
        widgetModel.updateIconPaths(thelocalPath);       
       
        // check to see if this widget already exists in the DB - using the ID (guid) key from the manifest
        return widgetModel;
      } catch (InvalidStartFileException e) {
        throw e;
View Full Code Here

      throw new BadWidgetZipFileException();
    }
    if (WidgetPackageUtils.hasManifest(zip)){
      try {
        // build the model
        WidgetManifestModel widgetModel = new WidgetManifestModel(WidgetPackageUtils.extractManifest(zip), locales, features, encodings, zip, defaultIdentifier);                             

        // get the widget identifier
        String manifestIdentifier = widgetModel.getIdentifier();           
        // create the folder structure to unzip the zip into
        unzippedWidgetDirectory = WidgetPackageUtils.createUnpackedWidgetFolder(outputDirectory, manifestIdentifier);
        // now unzip it into that folder
        WidgetPackageUtils.unpackZip(zip, unzippedWidgetDirectory)
       
        // Iterate over all start files and update paths
        for (IContent content: widgetModel.getContentList()){
          // now update the js links in the start page
          File startFile = new File(unzippedWidgetDirectory.getCanonicalPath() + File.separator + content.getSrc());
          String relativestartUrl = (WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, content.getSrc()));          
          content.setSrc(relativestartUrl);
          if(startFile.exists() && startPageProcessor != null){   
            startPageProcessor.processStartFile(startFile, widgetModel, content);
         
        }
        if (widgetModel.getContentList().isEmpty()){
          throw new InvalidStartFileException("Widget has no start page");
        }
       
        // get the path to the root of the unzipped folder
        String thelocalPath = WidgetPackageUtils.getURLForWidget(localPath, manifestIdentifier, "");
        // now pass this to the model which will prepend the path to local resources (not web icons)
        widgetModel.updateIconPaths(thelocalPath);       
       
        // check to see if this widget already exists in the DB - using the ID (guid) key from the manifest
        return widgetModel;
      } catch (InvalidStartFileException e) {
        throw e;
View Full Code Here

TOP

Related Classes of org.apache.wookie.w3c.impl.WidgetManifestModel

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.