All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.liveSense.server.i18n.loader.PathEntry Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.liveSense.server.i18n.loader;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.liveSense.server.i18n.loader.ManifestHeader.Entry;
import org.osgi.framework.Bundle;

/**
 * A path entry from the manifest for initial content.
 */
public class PathEntry {

    /** The manifest header to specify initial configuration to be loaded. */
    public static final String CONFIGURATION_HEADER = "I18n-ResourceBundles";

    /**
     * The overwrite directive specifying if content should be overwritten or
     * just initially added.
     */
    public static final String OVERWRITE_DIRECTIVE = "overwrite";

    /** The uninstall directive specifying if content should be uninstalled. */
    public static final String UNINSTALL_DIRECTIVE = "uninstall";

    /**
     * The path directive specifying the target node where initial content will
     * be loaded.
     */
    public static final String PATH_DIRECTIVE = "path";

    /** The path for the initial configuration. */
    private final String path;

    /** Should existing content be overwritten? */
    private final boolean overwrite;

    /** Should existing content be uninstalled? */
    private final boolean uninstall;


    public static Iterator getEntries(final Bundle bundle) {
        final List entries = new ArrayList();

        final String root = (String) bundle.getHeaders().get(CONFIGURATION_HEADER);
        if (root != null) {
            final ManifestHeader header = ManifestHeader.parse(root);
            Entry[] all_entries = header.getEntries();
            for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy