Package net.rim.tumbler.file

Examples of net.rim.tumbler.file.Library$Configuration


     
      _extensionJSFiles.addAll(getJSRelativePaths(_curPaths));
     
      // extension can be found in lookup table for sure, otherwise
      // exception would have been thrown in ExtensionDependencyManager.resolve
      Library lib = _extensionLookupTable.get(extensionId).getLibrary();
      _extensionClasses.add(lib.getEntryClass());
    }
  }
View Full Code Here


   *         <configuration>, <platform> or <src> is not specified correctly
   * @throws Exception
   */
  private Hashtable<String, ExtensionInfo> parseFeaturesInLibraryXML(
      File libraryXML, boolean allowBackwardCompatibility) throws Exception {
    Library lib = parseLibraryXML(libraryXML);
   
    if (lib == null) {
      return null;
    }   
   
    ArrayList<WidgetFeature> features = lib.getFeatures();
    HashSet<String> javaPaths = new HashSet<String>();
    HashSet<String> jsPaths = new HashSet<String>();
    Hashtable<String, ExtensionInfo> availableFeatures = new Hashtable<String, ExtensionInfo>();   
   
    if (allowBackwardCompatibility) {
      // have to work for library.xml that doesn't contain configuration and platform elements
      File[] files = _temporaryDirectory.listFiles();
     
      for (File f : files) {
        javaPaths.add(f.getAbsolutePath());
      }       
    } else {
      ExtensionInfo info = new ExtensionInfo(lib, javaPaths, jsPaths);
      boolean extensionIdFound = false;
     
      if (lib.getExtension() != null) {
        Extension extension = lib.getExtension();
        String id = extension.getId();

        if (id != null && !id.isEmpty()) {
          if (_extensionLookupTable.contains(id)) {
            // more than one library.xml contain the same extension id
            Logger.logMessage(LogType.WARNING,
                "VALIDATION_EXTENSION_DEFINED_MORE_THAN_ONCE",
                new String[] { id });
          }
             
          _extensionLookupTable.put(id, info);
         
          info.setExtensionFolder(libraryXML.getParentFile());
         
          extensionIdFound = true;
        }
      }
     
      if (!extensionIdFound) {
        // not considered an error, this extension might not be used
        // by the app being compiled
        Logger.logMessage(LogType.WARNING,
            "VALIDATION_LIBRARYXML_EXTENSION_ID_NOT_DEFINED",
            new String[] { libraryXML.getAbsolutePath() });
      }     
     
      Configuration config = getTargetConfiguration(lib);
     
      if (config == null) {
                Logger.logMessage(LogType.WARNING, "VALIDATION_LIBRARYXML_NO_CONFIG",
                        new String[] { libraryXML.getAbsolutePath() });
                return null;
      }

      ArrayList<Src> src = config.getSrc();

      if (src == null || src.isEmpty()) {
                Logger.logMessage(LogType.WARNING, "VALIDATION_LIBRARYXML_NO_SRC",
                    new String[] { libraryXML.getAbsolutePath() });
                return null;
      }

      File extensionDir = libraryXML.getParentFile();

      for (Src s : src) {
        String path = s.getPath();
       
        if (s.getType().equalsIgnoreCase("text/java")) {
          javaPaths.add(extensionDir.getAbsolutePath() + File.separator
              + path);
        } else if (s.getType().equalsIgnoreCase("text/javascript")) {
          jsPaths.add(extensionDir.getAbsolutePath() + File.separator
              + path);
        }
      }
    }

    ExtensionInfo info = new ExtensionInfo(lib, javaPaths, jsPaths);
   
    for (WidgetFeature feature : features) {
      availableFeatures.put(feature.getID(), info);
    }
   
    if (lib.getCompiledJARDependencies() != null) {
      for (Jar j : lib.getCompiledJARDependencies()) {
        String path = j.getPath();
        File temp = new File(path);
       
        if (temp.isAbsolute()) {
          info.addCompiledJARPath(path);
View Full Code Here

  private static final String ATTR_REQUIRED = "required";
 
  private Library _library = null;

  public LibraryXMLParser() {
    _library = new Library();
  }
View Full Code Here

    }

    @Test
    public void testSubset()
    {
        Configuration subset = config.subset("dictionary");
        Iterator<String> keys = subset.getKeys();

        String key = keys.next();
        assertEquals("1st key", "key1", key);
        assertEquals("1st value", "value1", subset.getString(key));

        key = keys.next();
        assertEquals("2nd key", "key2", key);
        assertEquals("2nd value", "value2", subset.getString(key));

        key = keys.next();
        assertEquals("3rd key", "key3", key);
        assertEquals("3rd value", "value3", subset.getString(key));

        assertFalse("more than 3 properties founds", keys.hasNext());
    }
View Full Code Here

        assertFalse("empty array", list.isEmpty());
        assertEquals("size", 2, list.size());

        // 1st dictionary
        ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(0));
        Configuration conf1 = (Configuration) list.get(0);
        assertFalse("configuration 1 is empty", conf1.isEmpty());
        assertEquals("configuration element", "bar", conf1.getProperty("foo"));

        // 2nd dictionary
        ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(1));
        Configuration conf2 = (Configuration) list.get(1);
        assertFalse("configuration 2 is empty", conf2.isEmpty());
        assertEquals("configuration element", "value", conf2.getProperty("key"));
    }
View Full Code Here

        EasyMock.replay(detector);
        ReloadingController controller = new ReloadingController(detector);
        BasicConfigurationBuilder<Configuration> builder =
                new BasicConfigurationBuilder<Configuration>(
                        PropertiesConfiguration.class);
        Configuration configuration = builder.getConfiguration();

        builder.connectToReloadingController(controller);
        controller.checkForReloading(null);
        assertTrue("Not in reloading state", controller.isInReloadingState());
        assertNotSame("No new configuration created", configuration,
View Full Code Here

        assertFalse("empty array", list.isEmpty());
        assertEquals("size", 2, list.size());

        // 1st dictionary
        ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(0));
        Configuration conf1 = (Configuration) list.get(0);
        assertFalse("configuration 1 is empty", conf1.isEmpty());
        assertEquals("configuration element", "bar", conf1.getProperty("foo"));

        // 2nd dictionary
        ObjectAssert.assertInstanceOf("the dict element is not parsed as a Configuration", Configuration.class, list.get(1));
        Configuration conf2 = (Configuration) list.get(1);
        assertFalse("configuration 2 is empty", conf2.isEmpty());
        assertEquals("configuration element", "value", conf2.getProperty("key"));
    }
View Full Code Here

    public ConfigurationBuilder<? extends Configuration> getConfigurationBuilder(
            ConfigurationDeclaration decl) throws ConfigurationException
    {
        ConfigurationBuilder<? extends Configuration> multiBuilder =
                super.getConfigurationBuilder(decl);
        Configuration wrapConfig = createWrapperConfiguration(multiBuilder);
        return createWrapperBuilder(multiBuilder, wrapConfig);
    }
View Full Code Here

     * Set up instance variables required by this test case.
     */
    @Before
    public void setUp() throws Exception
    {
        Configuration configuration = createConfiguration();

        for (int i = 0; i < properties.length; i++)
        {
            configuration.setProperty(properties[i], values[i]);
        }

        for (int element : intArray) {
            configuration.addProperty("intIndexed", new Integer(element));
        }

        for (String element : stringArray) {
            configuration.addProperty("stringIndexed", element);
        }

        List<String> list = Arrays.asList(stringArray);
        configuration.addProperty("listIndexed", list);

        bean = new ConfigurationDynaBean(configuration);

        bean.set("listIndexed", list);
        bean.set("intArray", intArray);
View Full Code Here

        // get configuration property
        Object result = getConfiguration().getProperty(name);
        if (result == null)
        {
            // otherwise attempt to create bean from configuration subset
            Configuration subset = new SubsetConfiguration(getConfiguration(), name, PROPERTY_DELIMITER);
            if (!subset.isEmpty())
            {
                result = new ConfigurationDynaBean(subset);
            }
        }
View Full Code Here

TOP

Related Classes of net.rim.tumbler.file.Library$Configuration

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.