Examples of Conf


Examples of org.lilyproject.runtime.conf.Conf

     * @param startWith starting pointer
     */
    public ConfNodeIterator(NodePointer parent, NodeTest nodeTest, NodePointer startWith) {
        this.parent = parent;

        Conf conf = (Conf) parent.getNode();
        for (Conf child : conf.getChildren()) {
            if (ConfNodePointer.testNode(child, nodeTest)) {
                children.add(child);
            }
        }

        if (startWith != null) {
            Conf wanted = (Conf)startWith.getNode();
            for (int i = 0; i < children.size(); i++) {
                if (children.get(i) == wanted) {
                    position = i + 1;
                    break;
                }
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

        try {
            String confPath = placeholder.substring(0, colonPos);
            String confExpr = placeholder.substring(colonPos + 1);

            Conf conf = confRegistry.getConfiguration(confPath);
            JXPathContext context = JXPathContext.newContext(conf);
            Object value = context.getValue(confExpr);

            return value == null ? "" : value.toString();
        } catch (Exception e) {
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

    private LilyRuntimeModelBuilder() {
    }

    public static LilyRuntimeModel build(File runtimeConfig, Set<String> disabledModuleIds,
            ArtifactRepository repository) throws Exception {
        Conf conf = XmlConfBuilder.build(runtimeConfig);
        return build(conf, disabledModuleIds, repository, new SourceLocations());
    }
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

        return build(conf, disabledModuleIds, repository, new SourceLocations());
    }

    public static LilyRuntimeModel build(File runtimeConfig, Set<String> disabledModuleIds,
            ArtifactRepository repository, SourceLocations artifactSourceLocations) throws Exception {
        Conf conf = XmlConfBuilder.build(runtimeConfig);
        return build(conf, disabledModuleIds, repository, artifactSourceLocations);
    }
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

    }

    private static void buildModules(List<ModuleDefinition> modules, Stack<String> wiringFileStack, Conf runtimeConf,
            ArtifactRepository repository, SourceLocations artifactSourceLocations) throws Exception {

        Conf modulesConf = runtimeConf.getRequiredChild("modules");
        List<Conf> importConfs = modulesConf.getChildren();
        for (Conf importConf : importConfs) {
            File fileToImport = null;
            ModuleSourceType sourceType = null;
            String version = "unknown";
            String id = null;
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

        if (wiringFileStack.contains(key)) {
            throw new LilyRTException("Recursive loading of wiring.xml-type file detected: " + key);
        }

        Conf conf = XmlConfBuilder.build(file);

        // go recursive
        wiringFileStack.push(key);
        buildModules(modules, wiringFileStack, conf, repository, artifactSourceLocations);
        wiringFileStack.pop();
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

    public VersionManager(LilyRuntime runtime) {
        this.runtime = runtime;
    }

    public String getPreferredVersion(String groupId, String artifactId) {
        Conf versionsConf = runtime.getConfManager().getRuntimeConfRegistry().getConfiguration("versions", false, true);
        String preferred = null;

        if (versionsConf != null) {
            for (Conf conf: versionsConf.getChildren("version")) {
                String vGroupId = conf.getAttribute("groupId", null);
                String vArtifactId = conf.getAttribute("artifactId", null);

                if ((vGroupId == null || vGroupId.equals(groupId)) &&
                        (vArtifactId == null || vArtifactId.equals(artifactId))) {
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

                    + getClass().getName() + " instance concurrently or sequentially without proper shutdown?");
        }

        executor = Executors.newScheduledThreadPool(1);

        Conf conf = getConfRegistry(RUNTIME_CONF_NAME).getConfiguration("configuration", true);
        Conf reloadingConf = conf.getChild("reloading");
        boolean reloadingEnabled = reloadingConf.getAttributeAsBoolean("enabled", true);
        int delay = reloadingConf.getAttributeAsInteger("delay", 5000);

        if (reloadingEnabled) {
            executor.scheduleWithFixedDelay(new Runnable() {
                public void run() {
                    refresh(true);
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

        long runDelay = 1000 * blobManagerConf.getChild("blobIncubatorMonitor").getAttributeAsLong("runDelay");
        blobIncubatorMonitor = new BlobIncubatorMonitor(zookeeper, hbaseTableFactory, tableManager,
                                        blobManager, typeManager, minimalAge, monitorDelay, runDelay);

        List<String> blobIncubatorNodes = Collections.EMPTY_LIST;
        Conf nodesConf = blobManagerConf.getChild("blobIncubatorMonitor").getChild("nodes");
        if (nodesConf != null) {
            String nodes = nodesConf.getValue("");
            if (!nodes.isEmpty()) {
                blobIncubatorNodes = Arrays.asList(nodes.split(","));
            }
        }
        if (blobIncubatorNodes.isEmpty() || blobIncubatorNodes.contains(hostName)) {
View Full Code Here

Examples of org.lilyproject.runtime.conf.Conf

public class ConfModelTest extends TestCase {
    public void testConfig1() throws Exception {
        String configPath = "config1.xml";
        InputStream configStream = getClass().getResourceAsStream(configPath);

        Conf config = XmlConfBuilder.build(configStream, configPath);
        assertEquals("value1", config.getAttribute("att1"));
        assertEquals("value2", config.getAttribute("att2"));

        assertEquals(3, config.getChildren().size());
        assertEquals(2, config.getChildren("element").size());

        for (Conf childConf : config.getChildren("element")) {
            assertEquals("element", childConf.getName());
            assertEquals("abc", childConf.getValue());
        }

        assertEquals(2, config.getChild("parent").getChildren("child").size());

        for (Conf childConf : config.getChild("parent").getChildren("child")) {
            assertEquals("def", childConf.getValue());
        }

        assertEquals(0, config.getChild("parent").getChild("child").getChildren().size());

        assertNotNull(config.getChild("nonexistingchild"));
        assertNull(config.getChild("nonexistingchild", false));

        // Getting the value of a node without a value should throw an error
        try {
            config.getChild("nonexistingchild").getValue();
            fail("expected exception");
        } catch (ConfException e) { /* ignore */ }

        assertEquals("zit", config.getChild("nonexistingchild").getValue("zit"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.