Example usage for java.util LinkedList addLast

List of usage examples for java.util LinkedList addLast

Introduction

In this page you can find the example usage for java.util LinkedList addLast.

Prototype

public void addLast(E e) 

Source Link

Document

Appends the specified element to the end of this list.

Usage

From source file:com.multimedia.service.wallpaper.CmsWallpaperService.java

@Override
public void preUploadWallpapers(StatusBean usb) {
    File upload_dir = new File(wallpaper_service.getUploadPath());
    OnlyFilesFilter filenameFilter = new OnlyFilesFilter();
    usb.setDone(0);/*from   w  w  w. j a  va2s. c  o  m*/
    usb.setTotal(scanFolder(upload_dir));
    if (upload_dir.exists()) {
        boolean upload_made = true;
        int upload_count = 0;

        File pre_upload_directory = new File(wallpaper_service.getUploadPath(), "pre_upload");
        if (!pre_upload_directory.exists())
            pre_upload_directory.mkdir();

        File cur_dir = null;

        File description_file;
        boolean pre_uploaded;

        Long id_pages_cur;
        String page_name;

        LinkedList<File> files = new LinkedList<File>();
        files.addLast(upload_dir);

        while (!files.isEmpty()) {
            if (upload_made) {
                cur_dir = new File(pre_upload_directory, String.valueOf(upload_count));
                while (cur_dir.exists()) {
                    cur_dir = new File(pre_upload_directory, String.valueOf(upload_count));
                    upload_count++;
                }
                cur_dir.mkdir();
                Iterator<String> dimmensions = wallpaper_service.getDimmensions().keySet().iterator();
                while (dimmensions.hasNext()) {
                    String dimmension = dimmensions.next();
                    File pre_uploaded_dimm = new File(cur_dir, dimmension);
                    if (!pre_uploaded_dimm.exists())
                        pre_uploaded_dimm.mkdir();
                }
                upload_count++;
            }

            File f = files.removeLast();
            pre_uploaded = false;
            upload_made = false;
            //logger.debug("test file: '"+f.getAbsolutePath()+"'");
            if (f.isDirectory()) {
                id_pages_cur = null;
                page_name = null;
                //search for DESCRIPTION_FILE
                description_file = new File(f, DESCRIPTION_FILE);
                if (description_file.exists()) {
                    id_pages_cur = null;
                    try {
                        BufferedReader reader = new BufferedReader(
                                new InputStreamReader(new FileInputStream(description_file), "UTF-8"));
                        String line;
                        while ((line = reader.readLine()) != null) {
                            if (line.startsWith("id=")) {
                                id_pages_cur = Long.parseLong(line.substring(3), 10);
                            } else if (line.startsWith("name=")) {
                                page_name = line.substring(5);
                            } else if (line.startsWith("pre_uploaded=true")) {
                                //means that this folder contains subfolders with pre uploaded images
                                //i.e. wallpapers are allready resized and are stored in an appropriate folders
                                //but they still must be checked
                                pre_uploaded = true;
                            }
                        }
                    } catch (IOException ex) {
                        logger.error("", ex);
                    }
                }

                File[] files_temp = f.listFiles();

                for (File tmp : files_temp) {
                    if (tmp.isFile()) {
                        if (!tmp.getName().equals(DESCRIPTION_FILE) && id_pages_cur != null) {
                            usb.setCur_name(tmp.getAbsolutePath());
                            logger.debug("preparing upload file: '" + tmp.getAbsolutePath() + "'");

                            if (Utils.saveScaledImageFileToDisk(tmp, wallpaper_service.getDimmensions(),
                                    cur_dir)) {
                                tmp.delete();
                                usb.increaseDone(1);
                                upload_made = true;
                            }
                        } //else error
                    } else if (!pre_uploaded) {
                        files.addLast(tmp);
                    }
                }
                //create a description file
                if (upload_made) {
                    createDescriptionFile(cur_dir, id_pages_cur, page_name, true);
                    cur_dir = null;
                }
            }
        }
        if (cur_dir != null) {
            description_file = new File(cur_dir, DESCRIPTION_FILE);
            if (!description_file.exists())
                FileUtils.deleteFiles(cur_dir, true);
        }
    }
}

From source file:alma.acs.nc.sm.generic.AcsScxmlEngine.java

/**
 * Gets the signals that would trigger transitions for the current state.
 * <p>/*from w ww.ja  va  2  s .c o m*/
 * When actually sending such signals later on, the SM may have moved to a different state.
 * To prevent this, you can synchronize on this AcsScxmlEngine, which will block concurrent calls to {@link #fireSignal(Enum)}.
 * <p>
 * This method can be useful for displaying applicable signals in a GUI,
 * or to reject signals (with exception etc) that do not "fit" the current state
 * (while normally such signals would be silently ignored). 
 * The latter gets used in {@link #fireSignalWithErrorFeedback(Enum)}.
 * 
 * @see org.apache.commons.scxml.semantics.SCXMLSemanticsImpl#enumerateReachableTransitions(SCXML, Step, ErrorReporter)
 */
public synchronized Set<S> getApplicableSignals() {
    Set<String> events = new HashSet<String>();

    @SuppressWarnings("unchecked")
    Set<TransitionTarget> stateSet = new HashSet<TransitionTarget>(exec.getCurrentStatus().getStates());
    LinkedList<TransitionTarget> todoList = new LinkedList<TransitionTarget>(stateSet);

    while (!todoList.isEmpty()) {
        TransitionTarget tt = todoList.removeFirst();
        @SuppressWarnings("unchecked")
        List<Transition> transitions = tt.getTransitionsList();
        for (Transition t : transitions) {
            String event = t.getEvent();
            events.add(event);
        }
        TransitionTarget parentTT = tt.getParent();
        if (parentTT != null && !stateSet.contains(parentTT)) {
            stateSet.add(parentTT);
            todoList.addLast(parentTT);
        }
    }

    // convert signal names to enum constants
    Set<S> ret = new HashSet<S>();
    for (String signalName : events) {
        S signal = Enum.valueOf(signalType, signalName);
        ret.add(signal);
    }
    return ret;
}

From source file:com.multimedia.service.wallpaper.CmsWallpaperService.java

@Override
public long uploadWallpapers(User uploader, Long id_pages, StatusBean usb) {
    File upload_dir = new File(wallpaper_service.getUploadPath());
    OnlyFilesFilter filenameFilter = new OnlyFilesFilter();
    usb.setDone(0);/*from  w w  w  . ja va2s . c om*/
    usb.setTotal(scanFolder(upload_dir));
    //logger.debug("starting upload process id_pages="+id_pages);
    if (upload_dir.exists()) {
        File description_file;
        Long id_pages_cur;
        boolean pre_uploaded;
        Wallpaper wallpaper;
        LinkedList<File> files = new LinkedList<File>();
        files.addLast(upload_dir);

        Set<String> dimmensions_set = wallpaper_service.getDimmensions().keySet();

        int restart_count = 0;

        while (!files.isEmpty()) {
            File f = files.removeLast();
            pre_uploaded = false;
            //logger.debug("test file: '"+f.getAbsolutePath()+"'");
            if (f.isDirectory()) {
                //search for DESCRIPTION_FILE
                description_file = new File(f, DESCRIPTION_FILE);
                if (description_file.exists()) {
                    id_pages_cur = null;
                    try {
                        BufferedReader reader = new BufferedReader(
                                new InputStreamReader(new FileInputStream(description_file), "UTF-8"));
                        String line;
                        while ((line = reader.readLine()) != null) {
                            if (line.startsWith("id=")) {
                                id_pages_cur = Long.parseLong(line.substring(3), 10);
                            } else if (line.startsWith("pre_uploaded=true")) {
                                //means that this folder contains subfolders with pre uploaded images
                                //i.e. wallpapers are allready resized and are stored in an appropriate folders
                                //but they still must be checked
                                pre_uploaded = true;
                            }
                        }
                    } catch (IOException ex) {
                        logger.error("", ex);
                    }
                } else {
                    id_pages_cur = id_pages;
                }
                File[] files_temp = f.listFiles();
                for (File tmp : files_temp) {
                    if (tmp.isFile()) {
                        if (!tmp.getName().equals(DESCRIPTION_FILE) && id_pages_cur != null) {
                            wallpaper = new Wallpaper();
                            wallpaper.setUser(uploader);
                            wallpaper.setId_pages(id_pages_cur);
                            wallpaper.setActive(Boolean.TRUE);
                            wallpaper.setContent_file(tmp);

                            usb.setCur_name(tmp.getAbsolutePath());
                            logger.debug("normal file uploading: '" + tmp.getAbsolutePath() + "'");

                            if (insert(wallpaper)) {
                                tmp.delete();
                                usb.increaseDone(1);
                                restart_count++;
                                if (restart_count == UPLOAD_RESTART_COUNT) {
                                    restart_count = 0;
                                    wallpaper_service.restartTransaction();
                                }
                            }
                        } //else error
                    } else if (!pre_uploaded) {
                        files.addLast(tmp);
                    }
                }
                if (pre_uploaded) {
                    //uploading pre_uploaded files if any
                    File pre_uploaded_folder = new File(f, Utils.FULL_DIMMENSION_NAME);
                    if (pre_uploaded_folder.exists() && pre_uploaded_folder.isDirectory()) {
                        files_temp = pre_uploaded_folder.listFiles(filenameFilter);
                        for (File tmp : files_temp) {
                            wallpaper = new Wallpaper();
                            wallpaper.setUser(uploader);
                            wallpaper.setId_pages(id_pages_cur);
                            wallpaper.setActive(Boolean.TRUE);
                            wallpaper.setContent_file(tmp);

                            logger.debug("pre_uploaded file uploading: '" + tmp.getAbsolutePath() + "'");
                            if (insert(wallpaper, f)) {
                                Iterator<String> dimmensions = dimmensions_set.iterator();
                                while (dimmensions.hasNext()) {
                                    String dimmension = dimmensions.next();
                                    File pre_uploaded_image = new File(f,
                                            dimmension + File.separator + tmp.getName());
                                    if (!pre_uploaded_image.delete()) {
                                        pre_uploaded_image.deleteOnExit();
                                    }
                                }
                                usb.increaseDone(1);
                                restart_count++;
                                if (restart_count == UPLOAD_RESTART_COUNT) {
                                    restart_count = 0;
                                    wallpaper_service.restartTransaction();
                                }
                            }
                        }
                        //deleting pre_uploaded folder if it contains no images
                        if (pre_uploaded_folder.listFiles(filenameFilter).length == 0) {
                            FileUtils.deleteFiles(f, true);
                        }
                    }
                }
            }
        }
    }
    return usb.getDone();
}

From source file:org.mule.endpoint.AbstractEndpointBuilder.java

protected Map<Object, Object> getProperties() {
    // Add properties from builder, endpointURI and then seal (make unmodifiable)
    LinkedList<Object> maps = new LinkedList<Object>();
    // properties from url come first
    if (null != uriBuilder) {
        uriBuilder.setMuleContext(muleContext);
        // properties from the URI itself
        maps.addLast(uriBuilder.getEndpoint().getParams());
    }//from w  w  w .  java  2s .  c  om
    // properties on builder may override url
    if (properties != null) {
        maps.addLast(properties);
    }
    MapCombiner combiner = new MapCombiner();
    combiner.setList(maps);
    return Collections.unmodifiableMap(combiner);
}

From source file:com.mirth.connect.plugins.dashboardstatus.DashboardConnectorStatusMonitor.java

public synchronized Object invoke(String method, Object object, String sessionId) {
    if (method.equals(METHOD_GET_STATES)) {
        return connectorStateMap;
    } else if (method.equals(METHOD_GET_CONNECTION_INFO_LOGS)) {
        String channelName;//from ww  w.j a va 2s.  c om
        LinkedList<String[]> channelLog;

        if (object == null) {
            /*
             * object is null - no channel is selected. return the latest
             * entire log entries of all channels combined. ONLY new
             * entries.
             */
            channelName = STATE_NO_SELECTION;
            channelLog = entireConnectorInfoLogs;
        } else {
            // object is not null - a channel is selected. return the latest
            // (LOG_SIZE) of that particular channel.
            channelName = object.toString();
            // return only the newly added log entries for the client with
            // matching sessionId.
            channelLog = connectorInfoLogs.get(channelName);

            if (channelLog == null) {
                channelLog = new LinkedList<String[]>();
                connectorInfoLogs.put(channelName, channelLog);
            }
        }

        HashMap<String, Long> lastDisplayedLogIdByChannel;

        if (lastDisplayedLogIndexBySessionId.containsKey(sessionId)) {
            // client exist with the sessionId.
            lastDisplayedLogIdByChannel = lastDisplayedLogIndexBySessionId.get(sessionId);

            if (lastDisplayedLogIdByChannel.containsKey(channelName)) {
                // existing channel on an already open client.
                // -> only display new log entries.
                long lastDisplayedLogId = lastDisplayedLogIdByChannel.get(channelName);
                LinkedList<String[]> newChannelLogEntries = new LinkedList<String[]>();

                // FYI, channelLog.size() will never be larger than LOG_SIZE
                // = 1000.
                for (String[] aChannelLog : channelLog) {
                    if (lastDisplayedLogId < Long.parseLong(aChannelLog[0])) {
                        newChannelLogEntries.addLast(aChannelLog);
                    }
                }

                if (newChannelLogEntries.size() > 0) {
                    /*
                     * put the lastDisplayedLogId into the HashMap. index 0
                     * is the most recent entry, and index0 of that entry
                     * contains the logId.
                     */
                    lastDisplayedLogIdByChannel.put(channelName,
                            Long.parseLong(newChannelLogEntries.get(0)[0]));
                    lastDisplayedLogIndexBySessionId.put(sessionId, lastDisplayedLogIdByChannel);
                }

                try {
                    return SerializationUtils.clone(newChannelLogEntries);
                } catch (SerializationException e) {
                    logger.error(e);
                }
            } else {
                /*
                 * new channel viewing on an already open client. -> all log
                 * entries are new. display them all. put the
                 * lastDisplayedLogId into the HashMap. index0 is the most
                 * recent entry, and index0 of that entry object contains
                 * the logId.
                 */
                if (channelLog.size() > 0) {
                    lastDisplayedLogIdByChannel.put(channelName, Long.parseLong(channelLog.get(0)[0]));
                    lastDisplayedLogIndexBySessionId.put(sessionId, lastDisplayedLogIdByChannel);
                }

                try {
                    return SerializationUtils.clone(channelLog);
                } catch (SerializationException e) {
                    logger.error(e);
                }
            }

        } else {
            // brand new client.
            // thus also new channel viewing.
            // -> all log entries are new. display them all.
            lastDisplayedLogIdByChannel = new HashMap<String, Long>();

            if (channelLog.size() > 0) {
                lastDisplayedLogIdByChannel.put(channelName, Long.parseLong(channelLog.get(0)[0]));
            } else {
                // no log exist at all. put the currentLogId-1, which is the
                // very latest logId.
                lastDisplayedLogIdByChannel.put(channelName, logId - 1);
            }

            lastDisplayedLogIndexBySessionId.put(sessionId, lastDisplayedLogIdByChannel);

            try {
                return SerializationUtils.clone(channelLog);
            } catch (SerializationException e) {
                logger.error(e);
            }
        }

    } else if (method.equals(METHOD_CHANNELS_DEPLOYED)) {
        if (channelsDeployedFlagForEachClient.containsKey(sessionId)) {
            // sessionId found. no (re)deploy occurred.
            return false;
        } else {
            // no sessionId found, which means channels have just been
            // (re)deployed - clear out all clients' Dashboard Connector
            // Logs.
            channelsDeployedFlagForEachClient.put(sessionId, true);
            return true;
        }
    } else if (method.equals(METHOD_REMOVE_SESSIONID)) {
        // client shut down, or user logged out -> remove everything
        // involving this sessionId.
        if (lastDisplayedLogIndexBySessionId.containsKey(sessionId)) {
            lastDisplayedLogIndexBySessionId.remove(sessionId);
        }

        if (channelsDeployedFlagForEachClient.containsKey(sessionId)) {
            channelsDeployedFlagForEachClient.remove(sessionId);
        }

        return null;
    }

    return null;
}

From source file:com.thoughtworks.studios.journey.JourneyService.java

/**
 * API for getting all ignored actions/*from   www .  j  a v a2 s.co m*/
 * @param ns: namespace under operation
 * @return list of action label in json format
 * @throws IOException
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{ns}/ignored_action_labels")
public Response ignoredActionLabels(@PathParam("ns") String ns) throws IOException {
    Application app = new Application(graphDB, ns);
    LinkedList<String> labels = new LinkedList<>();
    try (Transaction ignored = graphDB.beginTx()) {
        Iterable<Node> actions = app.actions().allIgnored();
        for (Node action : actions) {
            labels.addLast(app.actions().getActionLabel(action));
        }
    }
    return jsonOkResponse(labels);
}

From source file:org.commoncrawl.service.crawler.CrawlSegmentLog.java

/** flush and add all pending buffers into the passed in list **/
public void flushLog(LinkedList<LogItemBuffer> collector) {
    for (LogItemBuffer buffer : _buffers) {
        if (buffer.getItemCount() != 0) {
            collector.addLast(buffer);
        }/*  w w w.  j ava 2 s .c  o m*/
    }
    _buffers.clear();
    _buffers.addFirst(new LogItemBuffer(getListId(), getSegmentId()));
}

From source file:com.wordnik.swaggersocket.server.SwaggerSocketProtocolInterceptor.java

private final void attachWriter(final AtmosphereResource r) {
    final AtmosphereRequest request = r.getRequest();

    AtmosphereResponse res = r.getResponse();
    AsyncIOWriter writer = res.getAsyncIOWriter();

    BlockingQueue<AtmosphereResource> queue = (BlockingQueue<AtmosphereResource>) getContextValue(request,
            SUSPENDED_RESPONSE);//from w  ww.  j  a v  a2 s .co m
    if (queue == null) {
        queue = new LinkedBlockingQueue<AtmosphereResource>();
        request.getSession().setAttribute(SUSPENDED_RESPONSE, queue);
    }

    if (AtmosphereInterceptorWriter.class.isAssignableFrom(writer.getClass())) {
        // WebSocket already had one.
        if (r.transport() != AtmosphereResource.TRANSPORT.WEBSOCKET) {
            writer = new AtmosphereInterceptorWriter() {

                @Override
                protected void writeReady(AtmosphereResponse response, byte[] data) throws IOException {

                    // We are buffering response.
                    if (data == null)
                        return;

                    BlockingQueue<AtmosphereResource> queue = (BlockingQueue<AtmosphereResource>) getContextValue(
                            request, SUSPENDED_RESPONSE);
                    if (queue != null) {
                        AtmosphereResource resource;
                        try {
                            // TODO: Should this be configurable
                            // We stay suspended for 60 seconds
                            resource = queue.poll(60, TimeUnit.SECONDS);
                        } catch (InterruptedException e) {
                            logger.trace("", e);
                            return;
                        }

                        if (resource == null) {
                            logger.debug("No resource was suspended, resuming the second connection.");
                        } else {

                            logger.trace("Resuming {}", resource.uuid());

                            try {
                                OutputStream o = resource.getResponse().getResponse().getOutputStream();
                                o.write(data);
                                o.flush();

                                resource.resume();
                            } catch (IOException ex) {
                                logger.warn("", ex);
                            }
                        }
                    } else {
                        logger.error("Queue was null");
                    }
                }

                /**
                 * Add an {@link AsyncIOInterceptor} that will be invoked in the order it was added.
                 *
                 * @param filter {@link AsyncIOInterceptor
                 * @return this
                 */
                public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) {
                    if (!filters.contains(filter)) {
                        filters.addLast(filter);
                    }
                    return this;
                }
            };
            res.asyncIOWriter(writer);
        }
        //REVIST need a better way to add a custom filter at the first entry and not at the last as
        // e.g. interceptor(AsyncIOInterceptor interceptor, int position)
        LinkedList<AsyncIOInterceptor> filters = AtmosphereInterceptorWriter.class.cast(writer).filters();
        if (!filters.contains(interceptor)) {
            filters.addFirst(interceptor);
        }
    }
}

From source file:org.springframework.cloud.dataflow.server.service.impl.DefaultStreamService.java

private void updateStreamDefinitionFromReleaseManifest(String streamName, String releaseManifest) {

    List<SpringCloudDeployerApplicationManifest> appManifests = new SpringCloudDeployerApplicationManifestReader()
            .read(releaseManifest);/*from   w  ww .  j  a  va  2  s.c o  m*/

    Map<String, SpringCloudDeployerApplicationManifest> appManifestMap = new HashMap<>();

    for (SpringCloudDeployerApplicationManifest am : appManifests) {
        String name = am.getSpec().getApplicationProperties().get(DataFlowPropertyKeys.STREAM_APP_LABEL);
        appManifestMap.put(name, am);
    }

    StreamDefinition streamDefinition = this.streamDefinitionRepository.findById(streamName)
            .orElseThrow(() -> new NoSuchStreamDefinitionException(streamName));

    LinkedList<StreamAppDefinition> updatedStreamAppDefinitions = new LinkedList<>();
    for (StreamAppDefinition appDefinition : streamDefinition.getAppDefinitions()) {
        StreamAppDefinition.Builder appDefinitionBuilder = StreamAppDefinition.Builder.from(appDefinition);
        SpringCloudDeployerApplicationManifest applicationManifest = appManifestMap
                .get(appDefinition.getName());
        // overrides app definition properties with those from the release manifest
        appDefinitionBuilder.setProperties(applicationManifest.getSpec().getApplicationProperties());
        updatedStreamAppDefinitions.addLast(appDefinitionBuilder.build(streamDefinition.getName()));
    }

    String dslText = new StreamDefinitionToDslConverter().toDsl(updatedStreamAppDefinitions);

    StreamDefinition updatedStreamDefinition = new StreamDefinition(streamName, dslText);
    logger.debug("Updated StreamDefinition: " + updatedStreamDefinition);

    // TODO consider adding an explicit UPDATE method to the streamDefRepository
    // Note: Not transactional and can lead to loosing the stream definition
    this.streamDefinitionRepository.delete(updatedStreamDefinition);
    this.streamDefinitionRepository.save(updatedStreamDefinition);
    this.auditRecordService.populateAndSaveAuditRecord(AuditOperationType.STREAM, AuditActionType.UPDATE,
            streamName, this.auditServiceUtils.convertStreamDefinitionToAuditData(streamDefinition));
}

From source file:spade.reporter.CDM.java

@Override
public boolean launch(String arguments) {
    Map<String, String> argsMap = CommonFunctions.parseKeyValPairs(arguments);

    String inputFileArgument = argsMap.get("inputFile");
    String rotateArgument = argsMap.get("rotate");
    String waitForLogArgument = argsMap.get("waitForLog");

    if (CommonFunctions.isNullOrEmpty(inputFileArgument)) {
        logger.log(Level.SEVERE, "NULL/Empty 'inputFile' argument: " + inputFileArgument);
        return false;
    } else {//from ww w.j a v a  2s  .  c  o m
        inputFileArgument = inputFileArgument.trim();
        File inputFile = null;
        try {
            inputFile = new File(inputFileArgument);
            if (!inputFile.exists()) {
                logger.log(Level.SEVERE, "No file at path: " + inputFileArgument);
                return false;
            }
            if (!inputFile.isFile()) {
                logger.log(Level.SEVERE, "Not a regular file at path: " + inputFileArgument);
                return false;
            }
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Failed to check if file exists: " + inputFileArgument, e);
            return false;
        }
        boolean rotate = false;
        if (rotateArgument != null) {
            if (rotateArgument.equalsIgnoreCase("true")) {
                rotate = true;
            } else if (rotateArgument.equalsIgnoreCase("false")) {
                rotate = false;
            } else {
                logger.log(Level.SEVERE, "Invalid 'rotate' (only 'true'/'false') argument: " + rotateArgument);
                return false;
            }
        }
        if (waitForLogArgument != null) {
            if (waitForLogArgument.equalsIgnoreCase("true")) {
                waitForLog = true;
            } else if (waitForLogArgument.equalsIgnoreCase("false")) {
                waitForLog = false;
            } else {
                logger.log(Level.SEVERE,
                        "Invalid 'waitForLog' (only 'true'/'false') argument: " + waitForLogArgument);
                return false;
            }
        }
        LinkedList<String> inputFilePaths = new LinkedList<String>(); // ordered
        inputFilePaths.addLast(inputFile.getAbsolutePath());
        if (rotate) {
            try {
                String inputFileParentPath = inputFile.getParentFile().getAbsolutePath();
                String inputFileName = inputFile.getName();
                int totalFilesCount = inputFile.getParentFile().list().length;
                for (int a = 1; a < totalFilesCount; a++) {
                    File file = new File(inputFileParentPath + File.separatorChar + inputFileName + "." + a);
                    if (file.exists()) {
                        inputFilePaths.addLast(file.getAbsolutePath());
                    }
                }
            } catch (Exception e) {
                logger.log(Level.SEVERE, "Failed to gather all input files", e);
                return false;
            }
        }

        String schemaFilePath = null;
        Map<String, String> configMap = readDefaultConfigFile();
        if (configMap == null || configMap.isEmpty()) {
            logger.log(Level.SEVERE, "NULL/Empty config map: " + configMap);
            return false;
        } else {
            schemaFilePath = configMap.get(CONFIG_KEY_SCHEMA);
            if (CommonFunctions.isNullOrEmpty(schemaFilePath)) {
                logger.log(Level.SEVERE,
                        "NULL/Empty '" + CONFIG_KEY_SCHEMA + "' in config file: " + schemaFilePath);
                return false;
            } else {
                schemaFilePath = schemaFilePath.trim();
                try {
                    File schemaFile = new File(schemaFilePath);
                    if (!schemaFile.exists()) {
                        logger.log(Level.SEVERE, "Schema file doesn't exist: " + schemaFilePath);
                        return false;
                    }
                    if (!schemaFile.isFile()) {
                        logger.log(Level.SEVERE, "Schema path is not a regular file: " + schemaFilePath);
                        return false;
                    }
                } catch (Exception e) {
                    logger.log(Level.SEVERE, "Failed to check if schema file exists: " + schemaFilePath, e);
                    return false;
                }
            }
        }

        try {
            boolean binaryFormat = false;
            if (inputFileArgument.endsWith(".json")) {
                binaryFormat = false;
            } else {
                binaryFormat = true;
            }
            for (String inputFilePath : inputFilePaths) {
                DataReader dataReader = null;
                if (binaryFormat) {
                    dataReader = new BinaryReader(inputFilePath, schemaFilePath);
                } else {
                    dataReader = new JsonReader(inputFilePath, schemaFilePath);
                }
                dataReaders.addLast(dataReader);
            }
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Failed to build data reader", e);
            return false;
        }

        initReporting(configMap.get("reportingIntervalSeconds"));

        try {
            uuidToVertexMap = initCacheMap(configMap.get(CONFIG_KEY_CACHE_DATABASE_PARENT_PATH),
                    configMap.get(CONFIG_KEY_CACHE_DATABASE_NAME), configMap.get(CONFIG_KEY_CACHE_SIZE),
                    configMap.get(CONFIG_KEY_BLOOMFILTER_FALSE_PROBABILITY),
                    configMap.get(CONFIG_KEY_BLOOMFILTER_EXPECTED_ELEMENTS));
            if (uuidToVertexMap == null) {
                logger.log(Level.SEVERE, "NULL external memory map");
                return false;
            }
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Failed to create external memory map", e);
            return false;
        }

        try {
            datumProcessorThread.start();
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Failed to start data processor thread", e);
            doCleanup();
            return false;
        }

        logger.log(Level.INFO, "Arguments: rotate='" + rotate + "', waitForLog='" + waitForLog
                + "', inputFile='" + inputFileArgument + "'");
        logger.log(Level.INFO, "Input files: " + inputFilePaths);

        return true;
    }
}