Example usage for java.lang Boolean getBoolean

List of usage examples for java.lang Boolean getBoolean

Introduction

In this page you can find the example usage for java.lang Boolean getBoolean.

Prototype

public static boolean getBoolean(String name) 

Source Link

Document

Returns true if and only if the system property named by the argument exists and is equal to, ignoring case, the string "true" .

Usage

From source file:org.apache.geode.admin.jmx.internal.AgentImpl.java

private void removeShutdownHook() {
    if (!Boolean.getBoolean(
            org.apache.geode.distributed.internal.InternalDistributedSystem.DISABLE_SHUTDOWN_HOOK_PROPERTY)) {
        Runtime.getRuntime().removeShutdownHook(shutdownHook);
    }/*from   www . j av a  2  s.  co  m*/
}

From source file:org.openlaszlo.sc.SWF9External.java

/**
 * Return a boolean value given by a property in the LPS properties.
 *//*  w  w w . j  av a 2 s.  co  m*/
public static boolean getLPSBoolean(String propname, boolean defaultValue) {
    String valueString = LPS.getProperty(propname);
    if (valueString == null)
        return defaultValue;

    return Boolean.getBoolean(valueString);
}

From source file:org.openconcerto.sql.PropsConfiguration.java

public void tearDownLogging() {
    this.tearDownLogging(Boolean.getBoolean(REDIRECT_TO_FILE));
}

From source file:org.wso2.andes.test.utils.QpidBrokerTestCase.java

/**
 * Get the default connection factory for the currently used broker
 * Default factory is "local"/* w ww .j  av a 2  s  .  c o m*/
 *
 * @return A conection factory
 *
 * @throws Exception if there is an error getting the tactory
 */
public AMQConnectionFactory getConnectionFactory() throws NamingException
{
    _logger.info("get ConnectionFactory");
    if (_connectionFactory == null)
    {
        if (Boolean.getBoolean("profile.use_ssl"))
        {
            _connectionFactory = getConnectionFactory("default.ssl");
        }
        else
        {
            _connectionFactory = getConnectionFactory("default");
        }
    }
    return _connectionFactory;
}

From source file:com.marklogic.tree.CompressedTreeDecoder.java

private void assignOrdinals(ExpandedTree rep) {
    long ordinal = 0;
    int nodeID = 0;
    if (rep.nodeKind[0] == NodeKind.LINK) {
        rep.ordinal = rep.linkNodeNodeCount[rep.nodeRepID[0]];
        rep.nodeOrdinal[0] = 0;//from   w w w. ja  v  a  2 s.c o  m
        nodeID = 1;
    }
    while (nodeID != Integer.MAX_VALUE) {
        rep.nodeOrdinal[nodeID] = ordinal++;
        switch (rep.nodeKind[nodeID]) {
        case NodeKind.ELEM: {
            int elemID = rep.nodeRepID[nodeID];
            for (int i = 0; i < rep.elemNodeNumAttributes[elemID]; i++) {
                int attrNodeID = rep.elemNodeAttrNodeRepID[elemID] + i;
                rep.nodeOrdinal[attrNodeID] = ordinal++;
            }
            int childNodeID = rep.elemNodeChildNodeRepID[elemID];
            if (childNodeID != Integer.MAX_VALUE) {
                nodeID = childNodeID;
                continue;
            }
            break;
        }
        case NodeKind.LINK: {
            int linkID = rep.nodeRepID[nodeID];
            ordinal += rep.linkNodeNodeCount[linkID] - 1;
            break;
        }
        case NodeKind.DOC: {
            int docID = rep.nodeRepID[nodeID];
            int childNodeID = rep.docNodeChildNodeRepID[docID];
            if (childNodeID != Integer.MAX_VALUE) {
                nodeID = childNodeID;
                continue;
            }
            break;
        }
        case NodeKind.ARRAY:
        case NodeKind.OBJECT: {
            int docID = rep.nodeRepID[nodeID];
            int childNodeID = rep.arrayNodeChildNodeRepID[docID];
            if (childNodeID != Integer.MAX_VALUE) {
                nodeID = childNodeID;
                continue;
            }
            break;
        }
        default:
            break;
        }
        int parentNodeID = rep.nodeParentNodeRepID[nodeID];
        for (;;) {
            if (parentNodeID == Integer.MAX_VALUE) {
                nodeID = Integer.MAX_VALUE;
                break;
            }
            if (rep.nodeKind[parentNodeID] == NodeKind.ELEM) {
                int elemID = rep.nodeRepID[parentNodeID];
                if (++nodeID < rep.elemNodeChildNodeRepID[elemID] + rep.elemNodeNumChildren[elemID])
                    break;
            } else if (rep.nodeKind[parentNodeID] == NodeKind.DOC) {
                int docID = rep.nodeRepID[parentNodeID];
                if (++nodeID < rep.docNodeChildNodeRepID[docID] + rep.docNodeNumChildren[docID])
                    break;
            } else if (rep.nodeKind[parentNodeID] == NodeKind.ARRAY
                    || rep.nodeKind[parentNodeID] == NodeKind.OBJECT) {
                int docID = rep.nodeRepID[parentNodeID];
                if (++nodeID < rep.arrayNodeChildNodeRepID[docID] + rep.arrayNodeNumChildren[docID])
                    break;
            }
            nodeID = parentNodeID;
            parentNodeID = rep.nodeParentNodeRepID[nodeID];
        }
    }
    for (int j = rep.numNodeReps - rep.numNSNodeReps - rep.numPermNodeReps; j < rep.numNodeReps; ++j)
        rep.nodeOrdinal[j] = ordinal++;
    for (int k = rep.numNodeReps - rep.numPermNodeReps; k < rep.numNodeReps; ++k)
        rep.nodeOrdinal[k] = ordinal++;
    // TODO: compared performance
    if (Boolean.getBoolean("xcc.decode.atoms")) {
        for (int x = 0; x < rep.atomLimit; ++x)
            rep.atomString(x);
    }
}

From source file:com.imag.nespros.gui.plugin.GraphEditor.java

private void load(File file) throws FileNotFoundException {
    DeviceFactory.resetCounters();/*ww w.  j  a v a2  s  . c o  m*/
    ComLinkFactory.resetCounter();
    BufferedReader fileReader = new BufferedReader(new FileReader(file));
    Transformer<GraphMetadata, Graph<Device, ComLink>> graphTransformer = new Transformer<GraphMetadata, Graph<Device, ComLink>>() {
        @Override
        public Graph<Device, ComLink> transform(GraphMetadata metadata) {
            return new CustomUndirectedGraph<Device, ComLink>();
        }
    };
    Transformer<NodeMetadata, Device> vertexTransformer = new Transformer<NodeMetadata, Device>() {
        public Device transform(NodeMetadata metadata) {
            Device v;
            String deviceName = metadata.getProperty("deviceName");
            double cpuSpeeed = Double.parseDouble(metadata.getProperty("cpuSpeed"));
            int totalMemory = Integer.parseInt(metadata.getProperty("totalMemory"));
            if (metadata.getProperty("deviceType").equals("Smart Meter")) {
                v = new AMIDevice(deviceName, cpuSpeeed, totalMemory);
                DeviceFactory.setAmiCount(DeviceFactory.getAmiCount() + 1);
            } else if (metadata.getProperty("deviceType").equals("SACOMUT")) {
                v = new SacomutDevice(deviceName, cpuSpeeed, totalMemory);
                DeviceFactory.setSacomutCount(DeviceFactory.getSacomutCount() + 1);
            } else if (metadata.getProperty("deviceType").equals("HTA Coordinator")) {
                v = new HTACoordDevice(deviceName, cpuSpeeed, totalMemory);
                DeviceFactory.setHtaCount(DeviceFactory.getHtaCount() + 1);
            } else if (metadata.getProperty("deviceType").equals("Utility")) {
                v = new UtilityDevice(deviceName, cpuSpeeed, totalMemory);
                DeviceFactory.setUtilityCount(DeviceFactory.getUtilityCount() + 1);
            } else if (metadata.getProperty("deviceType").equals("POSTE ASSERVI")) {
                v = new PADevice(deviceName, cpuSpeeed, totalMemory);
                DeviceFactory.setPaCount(DeviceFactory.getPaCount() + 1);
            } else {
                v = new DCDevice(deviceName, cpuSpeeed, totalMemory);
                DeviceFactory.setDcCount(DeviceFactory.getDcCount() + 1);
            }

            v.setX(Double.parseDouble(metadata.getProperty("x")));
            v.setY(Double.parseDouble(metadata.getProperty("y")));
            Random r = new Random();
            int red = r.nextInt(255);
            int green = r.nextInt(255);
            int blue = r.nextInt(255);
            v.setPacketColor(new Color(red, green, blue));
            return v;
        }
    };
    Transformer<EdgeMetadata, ComLink> edgeTransformer = new Transformer<EdgeMetadata, ComLink>() {
        public ComLink transform(EdgeMetadata metadata) {
            int latency = Integer.parseInt(metadata.getProperty("latency"));
            String ID = metadata.getProperty("ID");
            boolean ok = Boolean.getBoolean(metadata.getProperty("down"));
            ComLink e = new ComLink(ID);
            e.setLatency(latency);
            e.setDefinedlatency(latency);
            e.setDown(ok);
            ComLinkFactory.updateLinkCount();
            return e;
        }
    };
    Transformer<HyperEdgeMetadata, ComLink> hyperEdgeTransformer = new Transformer<HyperEdgeMetadata, ComLink>() {
        public ComLink transform(HyperEdgeMetadata metadata) {
            ComLink e = ComLinkFactory.getInstance().create();
            return e;
        }
    };

    GraphMLReader2<Graph<Device, ComLink>, Device, ComLink> graphReader = new GraphMLReader2<Graph<Device, ComLink>, Device, ComLink>(
            fileReader, graphTransformer, vertexTransformer, edgeTransformer, hyperEdgeTransformer);
    try {
        /* Get the new graph object from the GraphML file */

        Graph<Device, ComLink> g = graphReader.readGraph();
        Topology.getInstance().setGraph((CustomUndirectedGraph<Device, ComLink>) g);
        graph = g;
    } catch (GraphIOException ex) {
    }

    Layout l = new StaticLayout<Device, ComLink>(Topology.getInstance().getGraph(),
            new Transformer<Device, Point2D>() {
                @Override
                public Point2D transform(Device v) {
                    Point2D p = new Point2D.Double(v.getX(), v.getY());
                    return p;
                }
            });
    l.setInitializer(vv.getGraphLayout());
    l.setSize(vv.getSize());
    LayoutTransition<Device, ComLink> lt = new LayoutTransition<>(vv, vv.getGraphLayout(), l);
    Animator animator = new Animator(lt);
    animator.start();
    vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
    //vv.getModel().setGraphLayout(l);
    vv.repaint();
}

From source file:org.wso2.andes.test.utils.QpidBrokerTestCase.java

/**
 * Get the default xa connection factory for the currently used broker
 * Default factory is "local"/*w  w w  .ja  va 2s .c om*/
 *
 * @return A conection factory
 *
 * @throws Exception if there is an error getting the factory
 */
public AMQXAConnectionFactory getXAConnectionFactory() throws NamingException
{
    _logger.info("get ConnectionFactory");
    if (_xaConnectionFactory == null)
    {
        if (Boolean.getBoolean("profile.use_ssl"))
        {
            _xaConnectionFactory = getXAConnectionFactory("default.ssl");
        }
        else
        {
            _xaConnectionFactory = getXAConnectionFactory("default");
        }
    }
    return _xaConnectionFactory;
}

From source file:com.diversityarrays.kdxplore.trials.TrialExplorerPanel.java

private void initClientLog(DALClient client) {
    if (Boolean.getBoolean("log_dalclient")) {
        Log log = org.apache.commons.logging.LogFactory.getLog("dalclient");
        log.info("==== Starting log_dalclient ====");
        client.setLog(log);//from w  w w  . ja  v a  2  s . co m
    }
}

From source file:org.apache.qpid.test.utils.QpidBrokerTestCase.java

/**
 * Get the default connection factory for the currently used broker
 * Default factory is "local"//from w w w  .j ava  2 s. c o m
 *
 * @return A connection factory
 *
 * @throws Exception if there is an error getting the factory
 */
public AMQConnectionFactory getConnectionFactory() throws NamingException
{
    _logger.info("get ConnectionFactory");
    if (_connectionFactory == null)
    {
        if (Boolean.getBoolean(PROFILE_USE_SSL))
        {
            _connectionFactory = getConnectionFactory("default.ssl");
        }
        else
        {
            _connectionFactory = getConnectionFactory("default");
        }
    }
    return _connectionFactory;
}

From source file:org.wso2.carbon.apimgt.rest.api.publisher.v1.utils.mappings.APIMappingUtil.java

/**
 * Return the REST API DTO representation of API Lifecycle state information
 *
 * @param apiLCData API lifecycle state information
 * @return REST API DTO representation of API Lifecycle state information
 *//*from w w w.java 2 s  . co m*/
public static LifecycleStateDTO fromLifecycleModelToDTO(Map<String, Object> apiLCData) {

    LifecycleStateDTO lifecycleStateDTO = new LifecycleStateDTO();

    String currentState = (String) apiLCData.get(APIConstants.LC_STATUS);
    lifecycleStateDTO.setState(currentState);

    String[] nextStates = (String[]) apiLCData.get(APIConstants.LC_NEXT_STATES);
    if (nextStates != null) {
        List<LifecycleStateAvailableTransitionsDTO> transitionDTOList = new ArrayList<>();
        for (String state : nextStates) {
            LifecycleStateAvailableTransitionsDTO transitionDTO = new LifecycleStateAvailableTransitionsDTO();
            transitionDTO.setEvent(state);
            //todo: Set target state properly
            transitionDTO.setTargetState("");
            transitionDTOList.add(transitionDTO);
        }
        lifecycleStateDTO.setAvailableTransitions(transitionDTOList);
    }

    List checkListItems = (List) apiLCData.get(APIConstants.LC_CHECK_ITEMS);
    if (checkListItems != null) {
        List<LifecycleStateCheckItemsDTO> checkItemsDTOList = new ArrayList<>();
        for (Object checkListItemObj : checkListItems) {
            CheckListItem checkListItem = (CheckListItem) checkListItemObj;
            LifecycleStateCheckItemsDTO checkItemsDTO = new LifecycleStateCheckItemsDTO();
            checkItemsDTO.setName(checkListItem.getName());
            checkItemsDTO.setValue(Boolean.getBoolean(checkListItem.getValue()));
            //todo: Set targets properly
            checkItemsDTO.setRequiredStates(new ArrayList<>());

            checkItemsDTOList.add(checkItemsDTO);
        }
        lifecycleStateDTO.setCheckItems(checkItemsDTOList);
    }
    return lifecycleStateDTO;
}