本文整理汇总了Java中org.teiid.adminapi.impl.VDBMetaData类的典型用法代码示例。如果您正苦于以下问题:Java VDBMetaData类的具体用法?Java VDBMetaData怎么用?Java VDBMetaData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VDBMetaData类属于org.teiid.adminapi.impl包,在下文中一共展示了VDBMetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteVDB
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
public void deleteVDB(String vdbName) throws AdminApiClientException {
VDBMetaData vdb = getVDB(vdbName,1);
if(vdb==null) return;
// Get the VDB deployment name
String deploymentName = VdbHelper.getInstance().getVdbDeploymentName(vdb);
// Undeploy
if(deploymentName!=null) {
try {
// Undeploy the VDB
this.admin.undeploy(deploymentName);
} catch (Exception e) {
throw new AdminApiClientException(e.getMessage());
}
}
}
示例2: metadataLoaded
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
protected void metadataLoaded(final VDBMetaData vdb,
final ModelMetaData model,
final MetadataStore vdbMetadataStore,
final AtomicInteger loadCount, MetadataFactory factory, boolean success, boolean reloading) {
if (success) {
// merge into VDB metadata
factory.mergeInto(vdbMetadataStore);
//TODO: this is not quite correct, the source may be missing
model.clearRuntimeMessages();
model.setMetadataStatus(Model.MetadataStatus.LOADED);
} else {
model.setMetadataStatus(Model.MetadataStatus.FAILED);
vdb.setStatus(Status.FAILED);
//TODO: abort the other loads
}
if (loadCount.decrementAndGet() == 0 || vdb.getStatus() == Status.FAILED) {
getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion(), reloading);
}
}
示例3: getVdbStatus
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
/**
* Get the VDB Status that will be displayed in the UI. This may be different from the VDBMetaData object status to simplify
* @param vdb the VDBMetaData
* @return the vdb status
*/
public String getVdbStatus(VDBMetaData vdb) {
VDB.Status status = vdb.getStatus();
String vdbStatus = Constants.STATUS_UNKNOWN;
// Change FAILED, REMOVED, LOADING status to INACTIVE
if(status!=null) {
vdbStatus = status.toString();
if( status==VDB.Status.FAILED || status==VDB.Status.REMOVED || status==VDB.Status.LOADING ) {
vdbStatus=Constants.STATUS_INACTIVE;
}
}
// If no models, change status to INACTIVE
List<Model> models = vdb.getModels();
if(models.isEmpty()) vdbStatus = Constants.STATUS_INACTIVE;
return vdbStatus;
}
示例4: getVdbViewModels
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
/**
* Get the ViewModels for the specified VDB
* @param vdb the vdb
* @return the List of View Models
*/
public List<ModelMetaData> getVdbViewModels(VDBMetaData vdb) {
if(vdb!=null) {
// Get current vdb ViewModels
List<ModelMetaData> viewModels = new ArrayList<ModelMetaData>();
List<Model> allModels = vdb.getModels();
for(Model theModel : allModels) {
if(theModel.getModelType()==Model.Type.VIRTUAL) {
viewModels.add((ModelMetaData)theModel);
}
}
return viewModels;
}
return Collections.emptyList();
}
示例5: createConnectorManagers
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
private void createConnectorManagers(ConnectorManagerRepository cmr, final TranslatorRepository repo, final VDBMetaData deployment) throws StartException {
final IdentityHashMap<Translator, ExecutionFactory<Object, Object>> map = new IdentityHashMap<Translator, ExecutionFactory<Object, Object>>();
try {
ConnectorManagerRepository.ExecutionFactoryProvider provider = new ConnectorManagerRepository.ExecutionFactoryProvider() {
@Override
public ExecutionFactory<Object, Object> getExecutionFactory(String name) throws ConnectorManagerException {
return VDBService.getExecutionFactory(name, repo, getTranslatorRepository(), deployment, map, new HashSet<String>());
}
};
cmr.setProvider(provider);
cmr.createConnectorManagers(deployment, provider);
} catch (ConnectorManagerException e) {
if (e.getCause() != null) {
throw new StartException(IntegrationPlugin.Event.TEIID50035.name()+" "+e.getMessage(), e.getCause()); //$NON-NLS-1$
}
throw new StartException(e.getMessage());
}
}
示例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: getVDBStatusMessage
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
public String getVDBStatusMessage(VDBMetaData vdb) throws DataVirtUiException {
if(vdb!=null) {
Status vdbStatus = vdb.getStatus();
if(vdbStatus!=Status.ACTIVE) {
List<String> allErrors = vdb.getValidityErrors();
if(allErrors!=null && !allErrors.isEmpty()) {
StringBuffer sb = new StringBuffer();
for(String errorMsg : allErrors) {
sb.append("ERROR: " +errorMsg+"<br>");
}
return sb.toString();
}
}
}
return Constants.SUCCESS;
}
示例9: getVdbsWithImport
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
private Collection<VDBMetaData> getVdbsWithImport(String importVdbName) {
Collection<VDBMetaData> vdbsWithImport = new ArrayList<VDBMetaData>();
// Get VDB name and version for the specified deploymentName
Collection<? extends VDB> allVdbs = null;
try {
allVdbs = clientAccessor.getClient().getVdbs();
for(VDB vdbMeta : allVdbs) {
if(vdbMeta instanceof VDBMetaData) {
VDBMetaData theVDB = (VDBMetaData)vdbMeta;
if(vdbHelper.hasImport(theVDB,importVdbName)) {
vdbsWithImport.add(theVDB);
}
}
}
} catch (AdminApiClientException e) {
}
return vdbsWithImport;
}
示例10: getVdbDetails
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
@Override
public VdbDetailsBean getVdbDetails(String vdbName) throws DataVirtUiException {
VDBMetaData vdb = null;
try {
vdb = clientAccessor.getClient().getVDB(vdbName,1);
} catch (Exception e) {
throw new DataVirtUiException(e.getMessage());
}
VdbDetailsBean vdbDetailsBean = vdbHelper.getVdbDetails(vdb);
String serverHost = getServerHost();
vdbDetailsBean.setServerHost(serverHost);
return vdbDetailsBean;
}
示例11: testGetXmlSchemas
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
public void testGetXmlSchemas() throws Exception {
CachedFinder finder = new CachedFinder(null, null);
finder.addCapabilities("sample", new BasicSourceCapabilities()); //$NON-NLS-1$
TransformationMetadata metadata = createMetadata(UnitTestUtil.getTestDataPath()+"/test.vdb"); //$NON-NLS-1$
String sql = "call getXMLSchemas('testdocument.testDocument')"; //$NON-NLS-1$
DQPCore core = Mockito.mock(DQPCore.class);
RequestWorkItem rwi = Mockito.mock(RequestWorkItem.class);
DQPWorkContext workContext = new DQPWorkContext();
VDBMetaData vdb = new VDBMetaData();
vdb.addAttchment(TransformationMetadata.class, metadata);
workContext.getSession().setVdb(vdb);
Mockito.stub(rwi.getDqpWorkContext()).toReturn(workContext);
DataTierManagerImpl dataMgr = new DataTierManagerImpl(core, new FakeBufferService().getBufferManager(), true);
CommandContext cc = createCommandContext();
cc.setWorkItem(rwi);
doProcess(metadata,
sql,
finder, dataMgr , new List[] {Arrays.asList(new String(ObjectConverterUtil.convertToByteArray(new FileInputStream(UnitTestUtil.getTestDataFile("test-schema.xsd")))))}, DEBUG, cc); //$NON-NLS-1$
}
示例12: helpGetMetadata
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
public Map[] helpGetMetadata(String sql, QueryMetadataInterface metadata, VDBMetaData vdb) throws Exception {
// Prepare sql
Command command = QueryParser.getQueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
// Create components
SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0);
DQPCore requestMgr = new DQPCore();
requestMgr.setTransactionService(new FakeTransactionService());
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
if (asLegacyClient) {
workContext.setClientVersion(Version.SEVEN_3);
}
// Initialize components
RequestID requestID = workContext.getRequestID(1);
RequestMessage requestMsg = new RequestMessage(sql);
TestDQPCoreRequestHandling.addRequest(requestMgr, requestMsg, requestID, command, null);
MetaDataProcessor mdProc = new MetaDataProcessor(requestMgr, prepPlanCache, "MyVDB", 1);
return mdProc.processMessage(requestID, workContext, null, true).getColumnMetadata();
}
示例13: 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$
}
示例14: loadSchema
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
private MetadataFactory loadSchema(VDBMetaData vdb, Properties p, String name, QueryParser parser) {
ModelMetaData mmd = new ModelMetaData();
mmd.setName(name);
vdb.addModel(mmd);
InputStream is = SystemMetadata.class.getClassLoader().getResourceAsStream("org/teiid/metadata/"+name+".sql"); //$NON-NLS-1$ //$NON-NLS-2$
try {
MetadataFactory factory = new MetadataFactory(vdb.getName(), vdb.getVersion(), name, typeMap, p, null);
parser.parseDDL(factory, new InputStreamReader(is, Charset.forName("UTF-8"))); //$NON-NLS-1$
for (Table t : factory.getSchema().getTables().values()) {
t.setSystem(true);
}
return factory;
} finally {
try {
is.close();
} catch (IOException e) {
throw new TeiidRuntimeException(e);
}
}
}
示例15: testSecurityDomain
import org.teiid.adminapi.impl.VDBMetaData; //导入依赖的package包/类
@Test public void testSecurityDomain() throws Exception {
VDBRepository repo = Mockito.mock(VDBRepository.class);
VDBMetaData vdb = new VDBMetaData();
vdb.setName("name");
vdb.setVersion(1);
vdb.setStatus(Status.ACTIVE);
vdb.addProperty(SessionServiceImpl.SECURITY_DOMAIN_PROPERTY, "domain");
Mockito.stub(repo.getLiveVDB("name", 1)).toReturn(vdb);
ssi.setVDBRepository(repo);
Properties properties = new Properties();
properties.setProperty(TeiidURL.JDBC.VDB_NAME, "name.1");
SessionMetadata s = ssi.createSession("name", "1", AuthenticationType.USERPASSWORD, "x", new Credentials(new char[] {'y'}), "z", properties);
assertEquals("domain", s.getSecurityDomain());
}