Extracts the tileset bundle from the supplied resource bundle
and registers it.
961500
protected void addBundle (HashIntMap<TileSet> idmap, HashMap<String, Integer> namemap,
        ResourceBundle bundle)
    {
        try {
            TileSetBundle tsb = BundleUtil.extractBundle(bundle);
            // initialize it and add it to the list
            tsb.init(bundle);
            addBundle(idmap, namemap, tsb);

        } catch (Exception e) {
            log.warning("Unable to load tileset bundle '" + BundleUtil.METADATA_PATH +
                        "' from resource bundle [rbundle=" + bundle + "].", e);
        }
    }
391143
@Override
    public Collection<ResourceBundle> bundles() {
        Set<ResourceBundle> bundles = new LinkedHashSet<>();
        for (I18nExtension extension : extensions) {
            bundles.add(extension.bundle());
        }
        return bundles;
    }
950652
function (tilesets) {
            // get the corresponding tileset
            var tileset = tilesets.getTilesetByGid(this.gid);

            if (tileset.isCollection === false) {
                // set width and height equal to tile size
                this.width = this.framewidth = tileset.tilewidth;
                this.height = this.frameheight = tileset.tileheight;
            }

            // the object corresponding tile object
            this.tile = new me.Tile(this.x, this.y, this.gid, tileset);
        }
1372057
void addBundle(EditableResourceBundle bundle) {
		Locale locale = bundle.getBundleLocale();
		if(!locales.contains(locale)) throw new AssertionError("locale not in locales: "+locale);
		bundles.put(locale, bundle);
	}
1365644
@Pure
	protected Resource createResource(ResourceSet  resourceSet) {
		URI uri = computeUnusedUri(resourceSet);
		Resource resource = getResourceFactory().createResource(uri);
		resourceSet.getResources().add(resource);
		return resource;
	}
874448
private void startBundle( final Bundle bundle )
        throws BundleException
    {
        // Don't start if bundle already active
        int bundleState = bundle.getState();
        if( bundleState == Bundle.ACTIVE )
        {
            return;
        }

        // Don't start if bundle is a fragment bundle
        Dictionary bundleHeaders = bundle.getHeaders();
        if( bundleHeaders.get( Constants.FRAGMENT_HOST ) != null )
        {
            return;
        }

        // Start bundle
        bundle.start();

        bundleState = bundle.getState();
        if( bundleState != Bundle.ACTIVE )
        {
            long bundleId = bundle.getBundleId();
            String bundleName = bundle.getSymbolicName();
            String bundleStateStr = bundleStateToString( bundleState );
            throw new BundleException(
                "Bundle (" + bundleId + ", " + bundleName + ") not started (still " + bundleStateStr + ")"
            );
        }
    }
257120
public void registerDwBundles(final List<GuiceyBundle> bundles) {
        setScope(ConfigScope.DropwizardBundle.getType());
        for (GuiceyBundle bundle : bundles) {
            register(ConfigItem.Bundle, bundle);
        }
        closeScope();
        lifecycle().bundlesFromDwResolved(bundles);
    }
193840
def download(self, request, **kwargs):
        

        # method check to avoid bad requests
        self.method_check(request, allowed=['get'])

        # create a basic bundle object for self.get_cached_obj_get.
        basic_bundle = self.build_bundle(request=request)

        # using the primary key defined in the url, obtain the tileset
        tileset = self.cached_obj_get(
            bundle=basic_bundle,
            **self.remove_api_resource_names(kwargs))

        filename = helpers.get_tileset_filename(tileset)
        filename = os.path.abspath(filename)
        if os.path.isfile(filename):
            response = serve(request, os.path.basename(filename), os.path.dirname(filename))
            response['Content-Disposition'] = 'attachment; filename="{}"'.format(os.path.basename(filename))
        else:
            response = self.create_response(request, {'status': 'not generated'})
        return response
107257
@Override
	public void storeBundle(String bundleName, JoinableResourceBundleContent bundleResourcesContent) {

		// Text version
		String bundleContent = bundleResourcesContent.getContent().toString();
		storeBundle(bundleName, bundleContent, false, textDirPath);

		// binary version
		storeBundle(bundleName, bundleContent, true, gzipDirPath);
	}
918021
public static Map<String, TileSet> parseActionTileSets (InputStream in)
        throws IOException, SAXException
    {
        Digester digester = new Digester();
        digester.addSetProperties("actions" + ActionRuleSet.ACTION_PATH);
        addTileSetRuleSet(digester, new SwissArmyTileSetRuleSet());
        addTileSetRuleSet(digester, new UniformTileSetRuleSet("/uniformTileset"));

        Map<String, TileSet> actsets = new ActionMap();
        digester.push(actsets);
        digester.parse(in);
        return actsets;
    }
787915
private void updateBundlesDirtyState(List<JoinableResourceBundle> bundles,
			CssSmartSpritesResourceReader cssSpriteResourceReader) {

		for (JoinableResourceBundle bundle : bundles) {

			List<BundlePath> bundlePaths = bundle.getItemPathList();
			for (BundlePath bundlePath : bundlePaths) {
				String path = bundlePath.getPath();
				File stdFile = cssSpriteResourceReader.getGeneratedCssFile(path);
				File bckFile = cssSpriteResourceReader.getBackupFile(path);
				if (bckFile.exists()) {
					try {
						if (!FileUtils.contentEquals(stdFile, bckFile)) {
							bundle.setDirty(true);
							break;
						}
					} catch (IOException e) {
						throw new BundlingProcessException("Issue while generating smartsprite bundle", e);
					}
				}
				cssSpriteResourceReader.getResource(bundle, path);
			}
		}
	}
503203
private void storeBundle(String bundleId, JoinableResourceBundleContent store) {

		stopProcessIfNeeded();

		if (bundleMustBeProcessedInLive(store.getContent().toString())) {
			liveProcessBundles.add(bundleId);
		}
		resourceBundleHandler.storeBundle(bundleId, store);
	}
746870
protected UniformTileSet loadCachedTileSet (String bundle, String imgPath, int width,
        int height)
    {
        String key = bundle + "::" + imgPath;
        SoftReference<UniformTileSet> ref = _handcache.get(key);
        UniformTileSet uts = (ref == null) ? null : ref.get();
        if (uts == null) {
            uts = new UniformTileSet();
            uts.setImageProvider(_defaultProvider);
            uts.setImagePath(imgPath);
            uts.setWidth(width);
            uts.setHeight(height);
            _handcache.put(key, new SoftReference<UniformTileSet>(uts));
        }
        return uts;
    }
178490
protected void register(Class<? extends NlsBundle> bundleInterface, NlsBundle bundle) {

    NlsBundle old = this.bundleMap.put(bundleInterface, bundle);
    if (old != null) {
      throw new IllegalStateException("Duplicate bundle for " + bundleInterface);
    }
  }
1075808
private void verifyIfBundleIsModified(JoinableResourceBundleImpl bundle, List<String> mappings,
			PropertiesConfigHelper props) {

		// Retrieves current available variant
		Map<String, VariantSet> variants = new TreeMap<>();
		for (String mapping : mappings) {
			variants = VariantUtils.concatVariants(variants, generatorRegistry.getAvailableVariants(mapping));
		}

		// Checks if the current variant are the same as the stored one
		if (!variants.equals(bundle.getVariants())) {
			bundle.setVariants(variants);
			bundle.setDirty(true);
		} else {

			String bundleName = bundle.getName();

			List<String> fileMappings = props.getCustomBundlePropertyAsList(bundleName,
					PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_FILEPATH_MAPPINGS);
			if (fileMappings != null) {
				List<FilePathMapping> bundleFileMappings = bundle.getFilePathMappings();
				if (bundleFileMappings.size() != fileMappings.size()) {
					bundle.setDirty(true);
				} else {

					Set<FilePathMapping> storedFilePathMapping = new HashSet<>();
					for (String filePathWithTimeStamp : fileMappings) {
						String[] tmp = filePathWithTimeStamp.split(LAST_MODIFIED_SEPARATOR);
						String filePath = tmp[0];
						long storedLastModified = Long.parseLong(tmp[1]);
						storedFilePathMapping.add(new FilePathMapping(bundle, filePath, storedLastModified));
					}

					Set<FilePathMapping> bundleFilePathMappingSet = new HashSet<>(bundleFileMappings);
					if (!bundleFilePathMappingSet.equals(storedFilePathMapping)) {
						bundle.setDirty(true);
					}
				}
			}

			// Checks if the linked resource has been modified
			fileMappings = props.getCustomBundlePropertyAsList(bundleName,
					PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_LINKED_FILEPATH_MAPPINGS);
			for (String filePathWithTimeStamp : fileMappings) {
				int idx = filePathWithTimeStamp.lastIndexOf(LAST_MODIFIED_SEPARATOR);

				if (idx != -1) {
					String filePath = filePathWithTimeStamp.substring(0, idx);
					long storedLastModified = Long.parseLong(filePathWithTimeStamp.substring(idx + 1));
					long currentLastModified = rsReaderHandler.getLastModified(filePath);
					FilePathMapping fPathMapping = new FilePathMapping(bundle, filePath, currentLastModified);
					bundle.getLinkedFilePathMappings().add(fPathMapping);
					if (storedLastModified != currentLastModified) {
						bundle.setDirty(true);
					}
				}
			}
		}

	}
564235
private String getResourceText(String key) {
        String text = null;
        if (key != null) {
            ResourceBundle bundle = null;

            // retrieve the resource bundle
            try {
                bundle = ResourceBundle.getBundle(DIST_EX_RESOURCE_BUNDLE_NAME);
            } catch (MissingResourceException e) {
                // do nothing
            }

            // if the resource bundle was successfully retrieved, get the specific text based
            // on the resource key
            if (bundle != null) {
                try {
                    text = bundle.getString(key);
                } catch (MissingResourceException e) {
                    // do nothing
                }
            }
        } else { // no key was provided
            // do nothing
        }
        return text;
    }
298233
public TileSet getTileSetByGID(int gid) {
		for (int i = 0; i < tileSets.size(); i++) {
			TileSet set = (TileSet) tileSets.get(i);

			if (set.contains(gid)) {
				return set;
			}
		}

		return null;
	}