EPackage.Registry.INSTANCE.put(JSF_LIBRARY_REGISTRY_NSURI, TapestryLibraryRegistryPackageImpl.init());
URI jsfLibRegURI = TapestryLibraryRegistryUpgradeUtil.getRegistryURI(TapestryLibraryRegistryUpgradeUtil.JSF_LIBRARY_REGISTRY_LATESTVERSION_URL);
TapestryLibraryRegistryUpgradeUtil.getInstance().upgradeRegistryIfNecessary(TapestryLibraryRegistryUpgradeUtil.LATESTVERSION);
TapestryLibraryRegistryResourceFactoryImpl resourceFactory = new TapestryLibraryRegistryResourceFactoryImpl();
jsfLibraryRegistryResource = (TapestryLibraryRegistryResourceImpl)resourceFactory.createResource(jsfLibRegURI);
try {
Map options = new HashMap();
//disable notifications during load to avoid changing stored default implementation
options.put(XMLResource.OPTION_DISABLE_NOTIFY, Boolean.TRUE);
jsfLibraryRegistryResource.load(options);
tapestryLibraryRegistry = (TapestryLibraryRegistry)jsfLibraryRegistryResource.getContents().get(0);
loadJSFLibraryExtensions();
loadDeprecatedJSFLibraryExtensions();//to be removed
} catch(IOException ioe) {
//Create a new Registry instance
tapestryLibraryRegistry = TapestryLibraryRegistryFactory.eINSTANCE.createTapestryLibraryRegistry();
jsfLibraryRegistryResource = (TapestryLibraryRegistryResourceImpl)resourceFactory.createResource(jsfLibRegURI);
jsfLibraryRegistryResource.getContents().add(tapestryLibraryRegistry);
loadJSFLibraryExtensions();
loadDeprecatedJSFLibraryExtensions();//to be removed
saveJSFLibraryRegistry();
}