本文整理汇总了Java中org.teiid.adminapi.impl.VDBMetaData.getVersion方法的典型用法代码示例。如果您正苦于以下问题:Java VDBMetaData.getVersion方法的具体用法?Java VDBMetaData.getVersion怎么用?Java VDBMetaData.getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.teiid.adminapi.impl.VDBMetaData
的用法示例。
在下文中一共展示了VDBMetaData.getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: getLiveVDB
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* A live vdb may be loading or active
* @param vdbName
* @return
*/
public VDBMetaData getLiveVDB(String vdbName) {
int latestVersion = 0;
VDBMetaData result = null;
for (Map.Entry<VDBKey, CompositeVDB> entry:this.vdbRepo.tailMap(new VDBKey(vdbName, 0)).entrySet()) {
if(!entry.getKey().getName().equalsIgnoreCase(vdbName)) {
break;
}
VDBMetaData vdb = entry.getValue().getVDB();
switch (vdb.getConnectionType()) {
case ANY:
if (vdb.getVersion() > latestVersion) {
latestVersion = vdb.getVersion();
result = vdb;
}
break;
case BY_VERSION:
if (latestVersion == 0) {
latestVersion = vdb.getVersion();
result = vdb;
}
break;
}
}
return result;
}
示例3: dataSourceDependencies
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
private void dataSourceDependencies(VDBMetaData deployment, ServiceTarget serviceTarget) {
final VDBKey vdbKey = new VDBKey(deployment.getName(), deployment.getVersion());
Set<String> dataSources = new HashSet<String>();
for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
for (String sourceName:model.getSourceNames()) {
// Need to make the data source service as dependency; otherwise dynamic vdbs will not work correctly.
String dsName = model.getSourceConnectionJndiName(sourceName);
if (dsName == null) {
continue;
}
if (!dataSources.add(VDBStatusChecker.stripContext(dsName))) {
continue; //already listening
}
addDataSourceListener(serviceTarget, vdbKey, dsName);
}
}
}
示例4: getVDB
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
public VDBMetaData getVDB(String vdbName, int vdbVersion) throws AdminApiClientException {
// Get list of VDBS - get the named VDB
Collection<? extends VDB> vdbs = getVdbs();
VDBMetaData vdb = null;
for(VDB aVdb : vdbs) {
VDBMetaData vdbMeta = (VDBMetaData)aVdb;
if(vdbMeta.getName()!=null && vdbMeta.getName().equalsIgnoreCase(vdbName) && vdbMeta.getVersion()==vdbVersion) {
vdb = vdbMeta;
break;
}
}
return vdb;
}
示例5: addImports
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Adds the Import to supplied VDB deployment. The new VDB is returned.
* @param vdb the VDB
* @param importVdbName the name of the VDB to import
* @param importVdbVersion the version of the VDB to import
* @return the new VDB
*/
public VDBMetaData addImports(VDBMetaData vdb, List<String> importVdbNames, List<Integer> importVdbVersions) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<String> currentVdbImportNames = new ArrayList<String>();
for(VDBImportMetadata importMeta : currentVdbImports) {
currentVdbImportNames.add(importMeta.getName());
}
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Add the existing ViewModels
newVdb.setModels(currentViewModels);
// Add new import to current imports (if not already present)
for(int i=0; i<importVdbNames.size(); i++) {
String importToAdd = importVdbNames.get(i);
if(!currentVdbImportNames.contains(importToAdd)) {
currentVdbImports.add(createVdbImport(importVdbNames.get(i), importVdbVersions.get(i)));
}
}
newVdb.getVDBImports().addAll(currentVdbImports);
return newVdb;
}
示例6: replaceImport
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Replaces and import in the supplied vdb with a different import. (Used for source renames)
* @param vdb the VDB
* @param originalImportName the name of the existing import
* @param originalImportName the version of the existing import
* @param newImportName the name of the new import which replaces existing
* @param newImportName the version of the new import which replaces existing
* @return the new VDB
*/
public VDBMetaData replaceImport(VDBMetaData vdb, String originalImportName, Integer originalImportVersion, String newImportName, Integer newImportVersion) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<String> currentVdbImportNames = new ArrayList<String>();
for(VDBImportMetadata importMeta : currentVdbImports) {
currentVdbImportNames.add(importMeta.getName());
}
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Add the existing ViewModels
newVdb.setModels(currentViewModels);
// Go thru the current Vdb Imports. Add them into the new import list. If the originalImportName import is found, replace it.
List<VDBImportMetadata> newVdbImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata currentImport : currentVdbImports) {
if(currentImport.getName().equalsIgnoreCase(originalImportName)) {
newVdbImports.add(createVdbImport(newImportName, newImportVersion));
} else {
newVdbImports.add(currentImport);
}
}
newVdb.getVDBImports().addAll(newVdbImports);
return newVdb;
}
示例7: addViewModel
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Adds the ViewModel to supplied VDB deployment. The new VDB is returned.
* @param vdb the VDB
* @param viewModelRequest details of the requested viewModel to create
* @return the new VDB
*/
public VDBMetaData addViewModel(VDBMetaData vdb, ViewModelRequestBean viewModelRequest) {
//public VDBMetaData addViewModel(VDBMetaData vdb, String viewModelName, String description, String ddlString, boolean isVisible) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
String viewModelName = viewModelRequest.getName();
String description = viewModelRequest.getDescription();
String ddlString = viewModelRequest.getDdl();
boolean isVisible = viewModelRequest.isVisible();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// If original VDB has view model with supplied name, remove it
removeViewModel(currentViewModels, viewModelName);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Create View Model and add to current view models
ModelMetaData modelMetaData = createViewModel(viewModelName,description,ddlString,isVisible);
currentViewModels.add(modelMetaData);
// Set ViewModels on new VDB
newVdb.setModels(currentViewModels);
// Add new import to current imports
newVdb.getVDBImports().addAll(currentVdbImports);
return newVdb;
}
示例8: removeImports
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Removes the imports from the supplied VDB - if they exist. The new VDB is returned.
* @param vdb the VDB
* @param removeImportNameList the list of import names to remove
* @return the List of ImportInfo data
*/
public VDBMetaData removeImports(VDBMetaData vdb, List<String> removeImportNameList) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Add the existing ViewModels
newVdb.setModels(currentViewModels);
// Create import list for new model
List<VDBImportMetadata> newImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata vdbImport: currentVdbImports) {
String currentName = vdbImport.getName();
// Keep the import - unless its in the remove list
if(!removeImportNameList.contains(currentName)) {
newImports.add((VDBImportMetadata)vdbImport);
}
}
newVdb.getVDBImports().addAll(newImports);
return newVdb;
}
示例9: 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;
}
示例10: queueTask
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
private void queueTask(VDBMetaData vdb, TimerTask task, long delay) {
VDBKey key = new VDBKey(vdb.getName(), vdb.getVersion());
List<TimerTask> tasks = scheduledTasks.get(key);
if (tasks == null) {
tasks = new ArrayList<TimerTask>();
scheduledTasks.put(key, tasks);
}
synchronized(tasks) {
tasks.add(task);
}
getTimer().schedule(task, (delay < 0)?0:delay);
}
示例11: createMetadataFactory
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
protected MetadataFactory createMetadataFactory(VDBMetaData vdb,
ModelMetaData model, Map<String, ? extends VDBResource> vdbResources) {
Map<String, Datatype> datatypes = this.getVDBRepository().getRuntimeTypeMap();
MetadataFactory factory = new MetadataFactory(vdb.getName(), vdb.getVersion(), datatypes, model);
factory.setBuiltinDataTypes(this.getVDBRepository().getSystemStore().getDatatypes());
factory.getSchema().setPhysical(model.isSource());
factory.setParser(new QueryParser()); //for thread safety each factory gets it's own instance.
factory.setVdbResources(vdbResources);
return factory;
}
示例12: cloneVdbRenamingViewModels
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Clone the supplied VDB, renaming all its views by appending the supplied suffix to the name
* @param vdb the VDB
* @param viewModelSuffix suffix to be applied when changing the view names
* @return the new VDB
*/
public VDBMetaData cloneVdbRenamingViewModels(VDBMetaData vdb, String viewModelSuffix) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// The new View Model list is all current models, plus clones
List<ModelMetaData> newViewModels = new ArrayList<ModelMetaData>();
// Iterate the list of names to clone
for(Model model: currentViewModels) {
ModelMetaData modelMeta = (ModelMetaData)model;
// Clone the view model, renaming it
String theModelName = model.getName();
String newViewModelName = theModelName+viewModelSuffix;
String description = model.getDescription();
boolean isVisible = model.isVisible();
String ddlString = modelMeta.getSchemaText();
ModelMetaData clonedModelMeta = createViewModel(newViewModelName,description,ddlString,isVisible);
// Add to list of new models
newViewModels.add(clonedModelMeta);
}
newVdb.setModels(newViewModels);
// The imports are unchanged
List<VDBImportMetadata> newImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata vdbImport: currentVdbImports) {
newImports.add((VDBImportMetadata)vdbImport);
}
newVdb.getVDBImports().addAll(newImports);
return newVdb;
}
示例13: cloneVdb
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Clone the supplied VDB, basically to force reload of the source models
* @param vdb the VDB
* @return the new VDB
*/
public VDBMetaData cloneVdb(VDBMetaData vdb) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// The new View Model list is all current models, plus clones
List<ModelMetaData> newViewModels = new ArrayList<ModelMetaData>();
// Iterate the list of names to clone
for(Model model: currentViewModels) {
ModelMetaData modelMeta = (ModelMetaData)model;
// Clone the view model
String theModelName = model.getName();
String newViewModelName = theModelName;
String description = model.getDescription();
boolean isVisible = model.isVisible();
String ddlString = modelMeta.getSchemaText();
ModelMetaData clonedModelMeta = createViewModel(newViewModelName,description,ddlString,isVisible);
// Add to list of new models
newViewModels.add(clonedModelMeta);
}
newVdb.setModels(newViewModels);
// The imports are unchanged
List<VDBImportMetadata> newImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata vdbImport: currentVdbImports) {
newImports.add((VDBImportMetadata)vdbImport);
}
newVdb.getVDBImports().addAll(newImports);
return newVdb;
}
示例14: helpTestMultiSourcePlan
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
public ProcessorPlan helpTestMultiSourcePlan(QueryMetadataInterface metadata, String userSql, String multiModel, int sourceCount, ProcessorDataManager dataMgr, List<?>[] expectedResults, VDBMetaData vdb, List<?> params, Options options, SourceCapabilities bsc) throws Exception {
Map<String, String> multiSourceModels = MultiSourceMetadataWrapper.getMultiSourceModels(vdb);
for (String model:multiSourceModels.keySet()) {
char sourceID = 'a';
// by default every model has one binding associated, but for multi-source there were none assigned.
ModelMetaData m = vdb.getModel(model);
int x = m.getSourceNames().size();
for(int i=x; i<sourceCount; i++, sourceID++) {
m.addSourceMapping("" + sourceID, "translator", null); //$NON-NLS-1$ //$NON-NLS-2$
}
}
QueryMetadataInterface wrapper = new MultiSourceMetadataWrapper(metadata, multiSourceModels);
wrapper = new TempMetadataAdapter(wrapper, new TempMetadataStore());
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(wrapper, vdb);
AnalysisRecord analysis = new AnalysisRecord(DEBUG, DEBUG);
Command command = TestResolver.helpResolve(userSql, wrapper);
ValidatorReport report = Validator.validate(command, metadata);
if (report.hasItems()) {
fail(report.toString());
}
// Plan
command = QueryRewriter.rewrite(command, wrapper, null);
FakeCapabilitiesFinder fakeFinder = new FakeCapabilitiesFinder();
fakeFinder.addCapabilities(multiModel, bsc);
CapabilitiesFinder finder = new TempCapabilitiesFinder(fakeFinder);
IDGenerator idGenerator = new IDGenerator();
CommandContext context = new CommandContext("test", "user", null, vdb.getName(), vdb.getVersion(), false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
context.setDQPWorkContext(workContext);
context.setOptions(options);
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, wrapper, idGenerator, finder, analysis, context);
if(DEBUG) {
System.out.println(analysis.getDebugLog());
System.out.println("\nMultiSource Plan:"); //$NON-NLS-1$
System.out.println(plan);
}
if (params != null) {
TestProcessor.setParameterValues(params, command, context);
}
TestProcessor.helpProcess(plan, context, dataMgr, expectedResults);
return plan;
}
示例15: vdbId
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
protected VDBKey vdbId(VDBMetaData vdb) {
return new VDBKey(vdb.getName(), vdb.getVersion());
}