return null; SourceHint sourceHint = new SourceHint(); if (matcher.group(1) != null) { sourceHint.setUseAliases(true); sourceHint.setGeneralHint(normalizeStringLiteral(generalHint)); while (matcher.find(end)) { end = matcher.end(); sourceHint.setSourceHint(matcher.group(1), normalizeStringLiteral(matcher.group(3)), matcher.group(2) != null);
public static SourceHint combine(SourceHint sourceHint, SourceHint sourceHint2) { if (sourceHint == null) { if (sourceHint2 == null) { return null; } return sourceHint2; } else if (sourceHint2 == null) { return sourceHint; } SourceHint newHint = new SourceHint(); addHints(sourceHint, newHint); addHints(sourceHint2, newHint); return newHint; }
public String getSourceHint(String sourceName) { SpecificHint sp = getSpecificHint(sourceName); if (sp != null) { return sp.getHint(); } return null; }
private static void addHints(SourceHint sourceHint, SourceHint newHint) { if (sourceHint.sourceHints != null) { for (Map.Entry<String, SpecificHint> entry : sourceHint.sourceHints.entrySet()) { for (String hint : entry.getValue().hints) { newHint.setSourceHint(entry.getKey(), hint, entry.getValue().useAliases); } } } newHint.setUseAliases(sourceHint.isUseAliases()); if (sourceHint.generalHint != null) { if (newHint.generalHint == null) { newHint.generalHint = new LinkedHashSet<String>(); } newHint.generalHint.addAll(sourceHint.generalHint); } }
private void addSourceHint(SourceHint sh) { if (sh != null) { append(SPACE); append(BEGIN_HINT); append("sh"); //$NON-NLS-1$ if (sh.isUseAliases()) { append(SPACE); append("KEEP ALIASES"); //$NON-NLS-1$ } if (sh.getGeneralHint() != null) { appendSourceHintValue(sh.getGeneralHint()); } else { append(SPACE); } if (sh.getSpecificHints() != null) { for (Map.Entry<String, SpecificHint> entry : sh.getSpecificHints().entrySet()) { append(entry.getKey()); if (entry.getValue().isUseAliases()) { append(SPACE); append("KEEP ALIASES"); //$NON-NLS-1$ } appendSourceHintValue(entry.getValue().getHint()); } } append(END_HINT); } }
private static void combineSourceHints(PlanNode accessNode, PlanNode parentNode) { accessNode.setProperty(Info.SOURCE_HINT, SourceHint.combine((SourceHint)parentNode.getProperty(Info.SOURCE_HINT), (SourceHint)accessNode.getProperty(Info.SOURCE_HINT))); }
SpecificHint sp = null; if (sourceNames.size() == 1) { sp = sh.getSpecificHint(sourceNames.get(0)); if (sh.isUseAliases() || (sp != null && sp.isUseAliases())) { visitor.setAliasMapping(context.getAliasMapping());
SourceHint hint = message.getCommand().getSourceHint(); if (hint != null) { this.securityContext.setGeneralHints(hint.getGeneralHints()); SpecificHint specificHint = hint.getSpecificHint(message.getConnectorName()); if (specificHint != null) { this.securityContext.setHints(specificHint.getHints());
@Override public TupleSource registerRequest(CommandContext context, Command command, String modelName, RegisterRequestParameter parameterObject) throws TeiidComponentException { if (hints[i*2] == null && hints[i*2+1] == null) { assertNull(command.getSourceHint()); } else { assertEquals(hints[i*2], command.getSourceHint().getGeneralHint()); //$NON-NLS-1$ assertEquals(hints[i*2+1], command.getSourceHint().getSourceHint("bar")); //$NON-NLS-1$ } i = ++i%(hints.length/2); if (getData(command.toString()) != null) { return super.registerRequest(context, command, modelName, parameterObject); } return CollectionTupleSource.createNullTupleSource(); } };
@Test public void testSourcHints() throws Exception { Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$ command.setSourceHint(new SourceHint()); AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1); arm.setCommand(command); ConnectorManager cm = TestConnectorManager.getConnectorManager(); cm.registerRequest(arm); }
private void addSourceHint(SourceHint sh) { if (sh != null) { append(SPACE); append(BEGIN_HINT); append("sh"); //$NON-NLS-1$ if (sh.isUseAliases()) { append(SPACE); append("KEEP ALIASES"); //$NON-NLS-1$ } if (sh.getGeneralHint() != null) { appendSourceHintValue(sh.getGeneralHint()); } else { append(SPACE); } if (sh.getSpecificHints() != null) { for (Map.Entry<String, SpecificHint> entry : sh.getSpecificHints().entrySet()) { append(entry.getKey()); if (entry.getValue().isUseAliases()) { append(SPACE); append("KEEP ALIASES"); //$NON-NLS-1$ } appendSourceHintValue(entry.getValue().getHint()); } } append(END_HINT); } }
private static void addHints(SourceHint sourceHint, SourceHint newHint) { if (sourceHint.sourceHints != null) { for (Map.Entry<String, SpecificHint> entry : sourceHint.sourceHints.entrySet()) { for (String hint : entry.getValue().hints) { newHint.setSourceHint(entry.getKey(), hint, entry.getValue().useAliases); } } } newHint.setUseAliases(sourceHint.isUseAliases()); if (sourceHint.generalHint != null) { if (newHint.generalHint == null) { newHint.generalHint = new LinkedHashSet<String>(); } newHint.generalHint.addAll(sourceHint.generalHint); } }
private static void combineSourceHints(PlanNode accessNode, PlanNode parentNode) { accessNode.setProperty(Info.SOURCE_HINT, SourceHint.combine((SourceHint)parentNode.getProperty(Info.SOURCE_HINT), (SourceHint)accessNode.getProperty(Info.SOURCE_HINT))); }
SpecificHint sp = null; if (sourceNames.size() == 1) { sp = sh.getSpecificHint(sourceNames.get(0)); if (sh.isUseAliases() || (sp != null && sp.isUseAliases())) { visitor.setAliasMapping(context.getAliasMapping());
SourceHint hint = message.getCommand().getSourceHint(); if (hint != null) { this.securityContext.setGeneralHints(hint.getGeneralHints()); SpecificHint specificHint = hint.getSpecificHint(message.getConnectorName()); if (specificHint != null) { this.securityContext.setHints(specificHint.getHints());
return null; SourceHint sourceHint = new SourceHint(); if (matcher.group(1) != null) { sourceHint.setUseAliases(true); sourceHint.setGeneralHint(normalizeStringLiteral(generalHint)); while (matcher.find(end)) { end = matcher.end(); sourceHint.setSourceHint(matcher.group(1), normalizeStringLiteral(matcher.group(3)), matcher.group(2) != null);
private void addSourceHint(SourceHint sh) { if (sh != null) { append(SPACE); append(BEGIN_HINT); append("sh"); //$NON-NLS-1$ if (sh.isUseAliases()) { append(SPACE); append("KEEP ALIASES"); //$NON-NLS-1$ } if (sh.getGeneralHint() != null) { appendSourceHintValue(sh.getGeneralHint()); } else { append(SPACE); } if (sh.getSpecificHints() != null) { for (Map.Entry<String, SpecificHint> entry : sh.getSpecificHints().entrySet()) { append(entry.getKey()); if (entry.getValue().isUseAliases()) { append(SPACE); append("KEEP ALIASES"); //$NON-NLS-1$ } appendSourceHintValue(entry.getValue().getHint()); } } append(END_HINT); } }
private static void addHints(SourceHint sourceHint, SourceHint newHint) { if (sourceHint.sourceHints != null) { for (Map.Entry<String, SpecificHint> entry : sourceHint.sourceHints.entrySet()) { for (String hint : entry.getValue().hints) { newHint.setSourceHint(entry.getKey(), hint, entry.getValue().useAliases); } } } newHint.setUseAliases(sourceHint.isUseAliases()); if (sourceHint.generalHint != null) { if (newHint.generalHint == null) { newHint.generalHint = new LinkedHashSet<String>(); } newHint.generalHint.addAll(sourceHint.generalHint); } }
public static SourceHint combine(SourceHint sourceHint, SourceHint sourceHint2) { if (sourceHint == null) { if (sourceHint2 == null) { return null; } return sourceHint2; } else if (sourceHint2 == null) { return sourceHint; } SourceHint newHint = new SourceHint(); addHints(sourceHint, newHint); addHints(sourceHint2, newHint); return newHint; }
private static void combineSourceHints(PlanNode accessNode, PlanNode parentNode) { accessNode.setProperty(Info.SOURCE_HINT, SourceHint.combine((SourceHint)parentNode.getProperty(Info.SOURCE_HINT), (SourceHint)accessNode.getProperty(Info.SOURCE_HINT))); }