本文整理汇总了Java中org.teiid.adminapi.impl.VDBMetaData.getAttachment方法的典型用法代码示例。如果您正苦于以下问题:Java VDBMetaData.getAttachment方法的具体用法?Java VDBMetaData.getAttachment怎么用?Java VDBMetaData.getAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.teiid.adminapi.impl.VDBMetaData
的用法示例。
在下文中一共展示了VDBMetaData.getAttachment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: alterView
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
public static void alterView(VDBMetaData vdb, Table t, String sql) {
TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
try {
Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation());
QueryResolver.resolveCommand(command, metadata);
MetadataValidator.determineDependencies(t, command);
} catch (TeiidException e) {
//should have been caught in validation, but this logic
//is also not mature so since there is no lock on the vdb
//it is possible that the plan is no longer valid at this point due
//to a concurrent execution
}
t.setSelectTransformation(sql);
t.setLastModified(System.currentTimeMillis());
metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$
}
示例2: alterProcedureDefinition
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
public static void alterProcedureDefinition(VDBMetaData vdb, Procedure p, String sql) {
TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
try {
Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false);
QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false);
MetadataValidator.determineDependencies(p, command);
} catch (TeiidException e) {
//should have been caught in validation, but this logic
//is also not mature so since there is no lock on the vdb
//it is possible that the plan is no longer valid at this point due
//to a concurrent execution
}
p.setQueryPlan(sql);
p.setLastModified(System.currentTimeMillis());
metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$
}
示例3: getAllowedDataPolicies
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
public HashMap<String, DataPolicy> getAllowedDataPolicies() {
if (this.policies == null) {
this.policies = new HashMap<String, DataPolicy>();
Set<String> userRoles = getUserRoles();
// get data roles from the VDB
VDBMetaData vdb = getVDB();
TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
Collection<? extends DataPolicy> allPolicies = null;
if (metadata == null) {
allPolicies = vdb.getDataPolicies();
} else {
allPolicies = metadata.getPolicies().values();
}
for (DataPolicy policy : allPolicies) {
if (matchesPrincipal(userRoles, policy)) {
this.policies.put(policy.getName(), policy);
}
}
}
return this.policies;
}
示例4: initMetadata
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* if the metadata has not been supplied via setMetadata, this method will create the appropriate state
*
* @throws TeiidComponentException
*/
protected void initMetadata() throws TeiidComponentException {
if (this.metadata != null) {
return;
}
// Prepare dependencies for running the optimizer
this.capabilitiesFinder = new CachedFinder(this.connectorManagerRepo, workContext.getVDB());
this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder);
VDBMetaData vdbMetadata = workContext.getVDB();
metadata = vdbMetadata.getAttachment(QueryMetadataInterface.class);
globalTables = vdbMetadata.getAttachment(GlobalTableStore.class);
if (metadata == null) {
throw new TeiidComponentException(QueryPlugin.Event.TEIID30489, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30489, this.vdbName, this.vdbVersion));
}
TempMetadataAdapter tma = new TempMetadataAdapter(metadata, this.tempTableStore.getMetadataStore());
tma.setSession(true);
this.metadata = tma;
}
示例5: getSchemaDdl
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Get the effective ddl text for the given schema
* @param vdbName
* @param schemaName
* @return the ddl or null if the vdb/schema does not exist
*/
public String getSchemaDdl(String vdbName, String schemaName) {
VDBMetaData vdb = repo.getVDB(vdbName, 1);
if (vdb == null) {
return null;
}
TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
if (metadata == null) {
return null;
}
Schema schema = metadata.getMetadataStore().getSchema(schemaName);
if (schema == null) {
return null;
}
return DDLStringVisitor.getDDLString(schema, null, null);
}
示例6: doMaterializationActions
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
private void doMaterializationActions(VDBMetaData vdb, MaterializationAction action) {
TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class);
if (metadata == null) {
return;
}
Set<String> imports = vdb.getImportedModels();
MetadataStore store = metadata.getMetadataStore();
// schedule materialization loads and do the start actions
for (Schema schema : store.getSchemaList()) {
if (imports.contains(schema.getName())) {
continue;
}
for (Table table:schema.getTables().values()) {
// find external matview table
if (!table.isVirtual() || !table.isMaterialized()
|| table.getMaterializedTable() == null
|| !Boolean.valueOf(table.getProperty(MaterializationMetadataRepository.ALLOW_MATVIEW_MANAGEMENT, false))) {
continue;
}
action.process(table);
}
}
}
示例7: resourceAdded
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
private void resourceAdded(String resourceName, List<Runnable> runnables,
VDBMetaData vdb) {
synchronized (vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
boolean usesResourse = false;
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
if (!model.hasRuntimeMessages()) {
return;
}
String sourceName = getSourceName(resourceName, model);
if (sourceName == null) {
return;
}
usesResourse = true;
ConnectorManager cm = cmr.getConnectorManager(sourceName);
checkStatus(runnables, vdb, model, cm);
}
if (usesResourse) {
updateVDB(runnables, vdb);
}
}
}
示例8: setProperty
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
@Override
public void setProperty(String vdbName, int vdbVersion, String uuid,
String name, String value) {
VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
if (vdb == null) {
return;
}
TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
if (tm == null) {
return;
}
AbstractMetadataRecord record = DataTierManagerImpl.getByUuid(tm.getMetadataStore(), uuid);
if (record != null) {
record.setProperty(name, value);
if (record instanceof Table) {
((Table)record).setLastModified(System.currentTimeMillis());
} else if (record instanceof Procedure) {
((Procedure)record).setLastModified(System.currentTimeMillis());
}
}
}
示例9: validateDataSources
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
void validateDataSources(VDBMetaData vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
if (model.isSource()) {
Collection<SourceMappingMetadata> mappings = model.getSourceMappings();
for (SourceMappingMetadata mapping:mappings) {
ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
if (cm != null) {
String msg = cm.getStausMessage();
if (msg != null && msg.length() > 0) {
model.addRuntimeError(msg);
model.setMetadataStatus(Model.MetadataStatus.FAILED);
LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
}
}
}
}
}
}
示例10: updateSource
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* @return true if the datasource is new to the vdb
* @throws AdminProcessingException
*/
public boolean updateSource(String vdbName, int vdbVersion, SourceMappingMetadata mapping, boolean replace) throws AdminProcessingException {
String dsName = stripContext(mapping.getConnectionJndiName());
VDBMetaData vdb = getVDBRepository().getLiveVDB(vdbName, vdbVersion);
if (vdb == null || vdb.getStatus() == Status.FAILED) {
return false;
}
synchronized (vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
ConnectorManager existing = cmr.getConnectorManager(mapping.getName());
try {
cmr.createConnectorManager(vdb, cmr.getProvider(), mapping, replace);
} catch (TeiidException e) {
throw new AdminProcessingException(RuntimePlugin.Event.TEIID40033, e);
}
if (mapping.getConnectionJndiName() != null && (existing == null || !dsName.equals(existing.getConnectionName()))) {
List<Runnable> runnables = new ArrayList<Runnable>();
resourceAdded(dsName, runnables, vdb);
return true;
}
return false;
}
}
示例11: TransformationMetadata
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* TransformationMetadata constructor
* @param context Object containing the info needed to lookup metadta.
*/
public TransformationMetadata(VDBMetaData vdbMetadata, final CompositeMetadataStore store, Map<String, VDBResources.Resource> vdbEntries, FunctionTree systemFunctions, Collection<FunctionTree> functionTrees) {
ArgCheck.isNotNull(store);
this.vdbMetaData = vdbMetadata;
if (this.vdbMetaData !=null) {
this.scriptEngineManager = vdbMetadata.getAttachment(ScriptEngineManager.class);
this.importedModels = this.vdbMetaData.getImportedModels();
this.allowedLanguages = StringUtil.valueOf(vdbMetadata.getPropertyValue(ALLOWED_LANGUAGES), Set.class);
if (this.allowedLanguages == null) {
this.allowedLanguages = Collections.emptySet();
}
for (DataPolicyMetadata policy : vdbMetadata.getDataPolicyMap().values()) {
policy = policy.clone();
policies.put(policy.getName(), policy);
}
store.processGrants(policies);
} else {
this.importedModels = Collections.emptySet();
}
this.store = store;
if (vdbEntries == null) {
this.vdbEntries = Collections.emptyMap();
} else {
this.vdbEntries = vdbEntries;
}
if (functionTrees == null) {
this.functionLibrary = new FunctionLibrary(systemFunctions);
} else {
this.functionLibrary = new FunctionLibrary(systemFunctions, functionTrees.toArray(new FunctionTree[functionTrees.size()]));
}
}
示例12: setNewVDBState
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
public void setNewVDBState(DQPWorkContext newWorkContext) {
this.vdbState = new VDBState();
VDBMetaData vdb = newWorkContext.getVDB();
GlobalTableStore actualGlobalStore = vdb.getAttachment(GlobalTableStore.class);
this.vdbState.globalTables = actualGlobalStore;
this.vdbState.session = newWorkContext.getSession();
this.vdbState.classLoader = vdb.getAttachment(ClassLoader.class);
this.vdbState.vdbName = vdb.getName();
this.vdbState.vdbVersion = vdb.getVersion();
this.vdbState.dqpWorkContext = newWorkContext;
TempMetadataAdapter metadata = new TempMetadataAdapter(vdb.getAttachment(QueryMetadataInterface.class), globalState.sessionTempTableStore.getMetadataStore());
metadata.setSession(true);
this.vdbState.metadata = metadata;
}
示例13: restore
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Restore reconnects to the live metadata objects
* @throws TeiidComponentException
* @throws TeiidProcessingException
*/
void restore() throws TeiidComponentException, TeiidProcessingException {
if (this.objectsAccessed != null) {
return;
}
VDBMetaData vdb = DQPWorkContext.getWorkContext().getVDB();
TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
GlobalTableStore globalStore = vdb.getAttachment(GlobalTableStore.class);
if (!externalNames.isEmpty()) {
this.objectsAccessed = new HashSet<Object>(externalNames.size());
for (List<String> key : this.externalNames) {
if (key.size() == 1) {
String matTableName = key.get(0);
TempMetadataID id = globalStore.getGlobalTempTableMetadataId(matTableName);
if (id == null) {
//if the id is null, then create a local instance
String viewFullName = matTableName.substring(RelationalPlanner.MAT_PREFIX.length());
id = globalStore.getGlobalTempTableMetadataId(tm.getGroupID(viewFullName));
}
this.objectsAccessed.add(id);
} else {
Schema s = tm.getMetadataStore().getSchema(key.get(0));
Modifiable m = s.getTables().get(key.get(1));
if (m == null) {
m = s.getProcedures().get(key.get(1));
}
if (m != null) {
this.objectsAccessed.add(m);
}
}
}
} else {
this.objectsAccessed = Collections.emptySet();
}
this.externalNames = null;
}
示例14: updateMatViewRow
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
@Override
public void updateMatViewRow(String vdbName, int vdbVersion, String schema,
String viewName, List<?> tuple, boolean delete) {
VDBMetaData metadata = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
if (metadata != null) {
GlobalTableStore gts = metadata.getAttachment(GlobalTableStore.class);
if (gts != null) {
try {
gts.updateMatViewRow((RelationalPlanner.MAT_PREFIX + schema + '.' + viewName).toUpperCase(), tuple, delete);
} catch (TeiidComponentException e) {
LogManager.logError(LogConstants.CTX_RUNTIME, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40013, "updateMatViewRow")); //$NON-NLS-1$
}
}
}
}
示例15: getSchema
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
private Schema getSchema(String vdbName, int vdbVersion, String schemaName) {
VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
if (vdb == null) {
return null;
}
TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
if (tm == null) {
return null;
}
return tm.getMetadataStore().getSchemas().get(schemaName);
}