/* (non-Javadoc)
@see com.ibm.jaggr.service.cache.ICache#dump(java.io.Writer, java.util.regex.Pattern)
964033
@Override
	public void dump(Writer writer, Pattern filter) throws IOException {
		_layerCache.dump(writer, filter);
		_moduleCache.dump(writer, filter);
		_gzipCache.dump(writer, filter);
		for (IGenericCache cache : _namedCaches.values()) {
			cache.dump(writer, filter);
		}
	}
761145
public void dumpTo(AreaTree tree, PrintWriter out)
    {
        if (produceHeader)
        {
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>" + tree.getRoot().getPage().getTitle() + "</title>");
            out.println("<meta charset=\"utf-8\">");
            out.println("<meta name=\"generator\" content=\"FITLayout - area tree dump\">");
            out.println("</head>");
            out.println("<body>");
        }
        recursiveDumpArea(tree.getRoot(), 1, out);
        if (produceHeader)
        {
            out.println("</body>");
            out.println("</html>");
        }
    }
1024099
public final void dumpTo(StringBuilder builder) {
      StringWriter stringWriter = new StringWriter();
      globalContainer.dumpTo(new PrintWriter(stringWriter));
      builder.append(stringWriter.getBuffer());
   }
545883
public synchronized String format(final String pattern, final Object... args) {
		Map<String, Object> model = Collections.emptyMap();
		ModelAdaptor modelAdaptor = new ModelAdaptor() {

			@Override
			public Object getValue(TemplateContext context, Token token, List<String> segments, String expression) {
				int index = Integer.parseInt(expression) - 1;
				return args[index];
			}

            @Override
            public Iterable<Object> getIterable(Object value) {
                return null;
            }

            @Override
            public String getSpecialIteratorVariable() {
                return null;
            }

        };

		String output = transformInternal(pattern, null, model, modelAdaptor, null);
		return output;
	}
546813
@Override
    public String dump() {
        final StringBuilder builder = new StringBuilder();
        if (mExecutor instanceof ThreadPoolExecutor) {
            // thread pool info
            final ThreadPoolExecutor executor = (ThreadPoolExecutor) mExecutor;
            final int corePoolSize = executor.getCorePoolSize();
            final int poolSize = executor.getPoolSize();
            final int activeCount = executor.getActiveCount();
            final long taskCount = executor.getTaskCount();
            final long completedCount = executor.getCompletedTaskCount();
            final boolean isShutdown = executor.isShutdown();
            final boolean isTerminated = executor.isTerminated();
            builder.append(TAG).append("[ ");
            builder.append("ThreadPool:{")
                    .append(" coreSize:").append(corePoolSize).append(";")
                    .append(" poolSize:").append(poolSize).append(";")
                    .append(" isShutdown:").append(isShutdown).append(";")
                    .append(" isTerminated:").append(isTerminated).append(";")
                    .append(" activeCount:").append(activeCount).append(";")
                    .append(" taskCount:").append(taskCount).append(";")
                    .append(" completedCount:").append(completedCount).append(";")
                    .append("}\n");
        } else {
            // thread pool info
            final ExecutorService executor = mExecutor;
            final boolean isShutdown = executor.isShutdown();
            final boolean isTerminated = executor.isTerminated();
            builder.append(TAG).append("[ ");
            builder.append("ThreadPool:{")
                    .append(" isShutdown:").append(isShutdown).append(";")
                    .append(" isTerminated:").append(isTerminated).append(";")
                    .append("}\n");
        }
        // group map
        final Map<String, List<String>> callerMap = mGroups;
        builder.append("Groups:{");
        for (Map.Entry<String, List<String>> entry : callerMap.entrySet()) {
            builder.append(" group:").append(entry.getKey())
                    .append(", tags:").append(ThreadUtils.toString(entry.getValue())).append(";");
        }
        builder.append("}\n");
        builder.append("]");

        // task map
        Map<String, ITaskRunnable> taskMap = mTasks;
        builder.append("Tasks:{");
        for (Map.Entry<String, ITaskRunnable> entry : taskMap.entrySet()) {
            builder.append(" tag:").append(entry.getKey())
                    .append(", runnable:").append(entry.getValue()).append(";");
        }
        builder.append("}\n");

        final String info = builder.toString();
        Log.v(TAG, info);
        return info;
    }
984678
private static DateTimeFormatter createFormatterForPattern(String pattern) {
        if (pattern == null || pattern.length() == 0) {
            throw new IllegalArgumentException("Invalid pattern specification");
        }
        DateTimeFormatter formatter = cPatternCache.get(pattern);
        if (formatter == null) {
            DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
            parsePatternTo(builder, pattern);
            formatter = builder.toFormatter();
            if (cPatternCache.size() < PATTERN_CACHE_SIZE) {
                // the size check is not locked against concurrent access,
                // but is accepted to be slightly off in contention scenarios.
                DateTimeFormatter oldFormatter = cPatternCache.putIfAbsent(pattern, formatter);
                if (oldFormatter != null) {
                    formatter = oldFormatter;
                }
            }
        }
        return formatter;
    }
995272
public static final String convertPattern(String pattern) {
        if (pattern == null) {
            return null;
        }
        else {
            String convertedPattern = pattern;
            for (PatternConverter converter : PATTERN_CONVERTERS) {
                convertedPattern = converter.convert(convertedPattern);
            }

            return convertedPattern;
        }
    }
199559
@Override
	public synchronized void dump(boolean close)
	{
		if (logfile != null)
		{
			PrintWriter writer = null;

			try
			{
				writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(logfile, true), "UTF-8"));
			} catch (FileNotFoundException e)
			{
				e.printStackTrace();
				return;
			} catch (UnsupportedEncodingException e)
			{
				e.printStackTrace();
				return;
			}

			for (RTMessage event : events)
			{
				writer.println(event.getMessage());
			}

			writer.flush();
			events.clear();

			writer.close();
		}
	}
110192
public void dumpTo(AreaTree tree, PrintWriter out)
    {
        if (produceHeader)
            out.println("<?xml version=\"1.0\"?>");
        out.println("<areaTree base=\"" + HTMLEntities(tree.getRoot().getPage().getSourceURL().toString()) + "\">");
        recursiveDump(tree.getRoot(), 1, out);
        out.println("</areaTree>");
    }
600111
private static SimpleDateFormat buildDateFormat(final String pattern) {

    SimpleDateFormat simpleDateFormat = simpleDateFormatCache.get();
    if (simpleDateFormat == null) {
      simpleDateFormat = new SimpleDateFormat();
      simpleDateFormatCache.set(simpleDateFormat);
    }
    simpleDateFormat.applyPattern(pattern);
    return simpleDateFormat;
  }
1205311
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        // Restore an un-cached message to we can dump its state
        if (msg == null)
            getJSMessage(true);

        try
        {
            if (msg != null)
            {
                writer.newLine();
                writer.taggedValue("JsMessage", msg.getClass().getName());
                writer.newLine();
                writer.taggedValue("systemMessageId", msg.getSystemMessageId());

                if (msg instanceof JsApiMessage)
                {
                    writer.newLine();
                    writer.taggedValue("APIMessageId", ((JsApiMessage) msg).getApiMessageId());
                    writer.newLine();
                    writer.taggedValue("APICorrelId", ((JsApiMessage) msg).getCorrelationId());
                }
                else
                {
                    if (msg.getApiMessageIdAsBytes() != null)
                    {
                        writer.newLine();
                        writer.taggedValue("APIMessageId", new String(msg.getApiMessageIdAsBytes()));
                    }
                    if (msg.getCorrelationIdAsBytes() != null)
                    {
                        writer.newLine();
                        writer.taggedValue("APICorrelId", new String(msg.getCorrelationIdAsBytes()));
                    }
                }

                writer.newLine();
                writer.taggedValue("putTime", new Date(msg.getTimestamp()));

                // If this MessageItem is sitting on an xmit ItemStream then we're probably
                // going to be interested in the GD data in the message.
                try
                {
                    ItemStream is = getItemStream();
                    if (is instanceof PtoPXmitMsgsItemStream)
                    {
                        writer.newLine();
                        writer.startTag("xmitData");
                        writer.indent();

                        writer.newLine();
                        writer.taggedValue("startTick", msg.getGuaranteedValueStartTick());
                        writer.newLine();
                        writer.taggedValue("endTick", msg.getGuaranteedValueEndTick());
                        writer.newLine();
                        writer.taggedValue("priority", msg.getPriority());
                        writer.newLine();
                        writer.taggedValue("reliability", msg.getReliability());
                        writer.newLine();
                        writer.taggedValue("streamId", msg.getGuaranteedStreamUUID());
                        if (msg.getRoutingDestination() != null)
                        {
                            writer.newLine();
                            writer.taggedValue("routingDestination", msg.getRoutingDestination());
                        }

                        writer.outdent();
                        writer.newLine();
                        writer.endTag("xmitData");
                    }
                } catch (SevereMessageStoreException se)
                {
                    // No FFDC code needed
                } catch (RuntimeException re)
                {
                    // No FFDC code needed
                }

                String text = null;
                //if we can easily get the text of the message then use that
                if (msg instanceof JsJmsTextMessage)
                {
                    try
                    {
                        text = ((JsJmsTextMessage) msg).getText();
                        if (text != null && text.length() > 40)
                            text = text.substring(0, 37) + "...";
                    } catch (UnsupportedEncodingException e)
                    {
                        // No FFDC code needed
                        text = "Unsupported message encoding";
                    }
                }
                else
                    text = String.valueOf(msg);

                writer.newLine();
                writer.taggedValue("data", text);
            }
        } catch (RuntimeException e)
        {
            // No FFDC code needed

            // As we're not locking the state down there's very slim chance of hitting
            // something like a NPE while we do this, we'll just catch it and ignore it
        }
    }
1211630
@Override
    public String[] getCacheIDsInPushPullTable(String cacheInstance, String pattern) throws javax.management.AttributeNotFoundException { // LI4337-17

        // Get the cache for this cacheInstance
        DCache cache1 = getCache(cacheInstance);
        // Check that the input pattern is a valid regular expression
        Pattern cpattern = checkPattern(pattern);

        // retrieve all the cache ids from PushPullTable
        List<String> matchSet = new ArrayList<String>(10);
        int count = 0;
        Object[] list = cache1.getCacheIdsInPushPullTable().toArray();
        for (int i = 0; i < list.length; i++) {
            String skey = list[i].toString();
            boolean matches = checkMatch(cpattern, skey);
            if (matches) {
                matchSet.add(skey);
                count++;
                //if (tc.isDebugEnabled()) {
                //  Tr.debug(tc,"getCacheIDsInPushPullTable:  Cache element # " + count +" = " + skey + " matches the pattern " + pattern + " for cacheInstance = " + cacheInstance);
                //}    
            }
        }
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "getCacheIDsInPushPullTable" + "/" + cacheInstance + "/" + "Exiting. Number of matches found = " + count);
        }
        //Allocate output String array #entries matched and return
        //Convert to string array and return 
        String[] cids = matchSet.toArray(new String[matchSet.size()]);
        return cids;
    }
1321382
private void writeObject(final java.io.ObjectOutputStream out)
     throws IOException {
     out.writeObject(field);
     out.writeObject(pattern.pattern());
   }
284622
private void dumpThreads() {

        if (LOG.isDebugEnabled()) {
            StringBuffer b = new StringBuffer(512);
            Iterator<CmsUUID> i = m_threads.keySet().iterator();
            while (i.hasNext()) {
                CmsUUID key = i.next();
                A_CmsReportThread thread = m_threads.get(key);
                b.append(thread.getName());
                b.append(" - ");
                b.append(thread.getUUID());
                b.append('\n');
            }
            LOG.debug(
                Messages.get().getBundle().key(
                    Messages.LOG_THREADSTORE_POOL_CONTENT_2,
                    new Integer(m_threads.size()),
                    b.toString()));
        }
    }
565434
public void writeRegex(Pattern pattern) throws IOException {
		_writeArrayFieldNameIfNeeded();
		_verifyValueWrite("write regex");
		_buffer.putByte(_typeMarker, BsonConstants.TYPE_REGEX);
		_writeCString(pattern.pattern());
		_writeCString(flagsToRegexOptions(pattern.flags()));
		flushBuffer();
	}
1232635
public function dump(
        $target = 'web/js',
        $pattern = self::DEFAULT_TRANSLATION_PATTERN,
        array $formats = array(),
        \stdClass $merge = null
    ) {
        $availableFormats  = array('js', 'json');

        $parts = array_filter(explode('/', $pattern));
        $this->filesystem->remove($target. '/' . current($parts));

        foreach ($formats as $format) {
            if (!in_array($format, $availableFormats)) {
                throw new \RuntimeException('The ' . $format . ' format is not available. Use only: ' . implode(', ', $availableFormats) . '.');
            }
        }

        if (empty($formats)) {
            $formats = $availableFormats;
        }

        $this->dumpConfig($pattern, $formats, $target);

        if ($merge && $merge->domains) {
            $this->dumpTranslationsPerLocale($pattern, $formats, $target);
        } else {
            $this->dumpTranslationsPerDomain($pattern, $formats, $target);
        }
    }
364896
private void patternSource(PatternDescrBuilder<?> pattern) throws RecognitionException {
        match(input,
                DRL6Lexer.ID,
                DroolsSoftKeywords.FROM,
                null,
                DroolsEditorType.KEYWORD);
        if (state.failed)
            return;

        if (state.backtracking == 0) {
            helper.emit(Location.LOCATION_LHS_FROM);
        }

        if (helper.validateIdentifierKey(DroolsSoftKeywords.ACCUMULATE) || helper.validateIdentifierKey(DroolsSoftKeywords.ACC)) {
            fromAccumulate(pattern);
        } else if (helper.validateIdentifierKey(DroolsSoftKeywords.COLLECT)) {
            fromCollect(pattern);
        } else if (helper.validateIdentifierKey(DroolsSoftKeywords.ENTRY) &&
                helper.validateLT(2,
                        "-") &&
                helper.validateLT(3,
                        DroolsSoftKeywords.POINT)) {
            fromEntryPoint(pattern);
            if (state.failed)
                return;
        } else if (helper.validateIdentifierKey(DroolsSoftKeywords.WINDOW)) {
            fromWindow(pattern);
        } else {
            fromExpression(pattern);
            if (!lastTokenWasWhiteSpace() && input.LA(1) == DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_FROM);
                throw new RecognitionException();
            }
            if (state.failed)
                return;
        }
        if (input.LA(1) == DRL6Lexer.SEMICOLON) {
            match(input,
                    DRL6Lexer.SEMICOLON,
                    null,
                    null,
                    DroolsEditorType.SYMBOL);
            if (state.failed)
                return;
        }
    }