DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
| Code Block | ||
|---|---|---|
| ||
// JDBC connection to Ignite server.
try (Connection conn = DriverManager.getConnection(URL)) {
conn.setClientInfo("SESSION_ID", "1234");
...
}
|
...
SessionContext is an entrypoint for accessing attributes on all levels and other session-level data (e.g. SecurutySubject).QuerySqlFunction to get access to the attributes in SQL queries if needed (see example below).Ignite provides SessionContextProviderResource to access to SessionContext. Provider instead of direct instance of the context is used for optimization. Injecting instance requires to have new instance of CacheInterceptor or QuerySqlFunction target class. It's not optimal to create new instances for every processing key or row.
Note, it proposes to make possible use non-static QuerySqlFunction to inject the resource.
| Code Block | ||
|---|---|---|
| ||
/** SessionContext interface. It's an entrypoint for all attributes. */
public class SessionContext {
/** @return Call,Attribute application and user attributesby name. */
public Map<String,@Nullable String>String getAttributesgetAttribute(String attrName);
/** @return Current SecuritySubject. */
public @Nullable SecuritySubject getSecuritySubject();
}
/** Example, use it in QuerySqlFunction. */
public static class UserDefinedFunctions {
/** */
@SessionContextProviderResource
public SessionContextProvider sesCtxProv;
/** @return Session ID set with application attributes. */
@QuerySqlFunction
public @Nullable String sessionId() {
Map<String, String> appAttrs
SessionContext sesCtx = ApplicationContextsesCtxProv.getAttributesgetSessionContext();
return appAttrssesCtx == null ? null : appAttrsesCtx.getgetAttribute("SESSION_ID");
}
}
|
// Links to discussions on the devlist, if applicable.
...