Example #1
0
    /**
     * Called by {@link #getDefault} to load the configuration the
     * first time. Will not complain about inability to load
     * configuration file from one of the default directories, but if
     * it cannot find the JAR's configuration file, will throw a
     * run time exception.
     */
    protected static void load()
    {
		_default = Configuration.loadProperties( Property.ResourceName, Property.FileName);

		// Parse XML namespace and package list
		_nspackages = new Hashtable();
		String prop = _default.getProperty( Property.NamespacePackages, "");
		StringTokenizer tokens = new StringTokenizer(prop, ",");
		while(tokens.hasMoreTokens())
		{
			String token = tokens.nextToken();
			int comma = token.indexOf('=');
			if(comma==-1)
				continue;
			String ns = token.substring(0,comma).trim();
			String javaPackage = token.substring(comma+1).trim();
			_nspackages.put(ns, javaPackage);
		}

		//-- bound properties
		prop = _default.getProperty( Property.BOUND_PROPERTIES, "");
		_boundProperties = prop.equalsIgnoreCase("true");

        //-- Equals method?
        prop = _default.getProperty( Property.EqualsMethod, "");
		_equalsMethod = prop.equalsIgnoreCase("true");

		initBindingType();

    } //-- load
Example #2
0
	/**
	 * Gets a Java package to an XML namespace URL
	 */
	public static String getJavaPackage(String nsURL)
	{
        if (nsURL == null) return "";

		//-- Ensure properties have been loaded
		getDefault();

		// Lookup Java package via NS
		String javaPackage = (String) _nspackages.get(nsURL);
		if(javaPackage==null)
			return "";
		else
			return javaPackage;
	}