当前位置: 首页>>代码示例>>Java>>正文


Java Admin类代码示例

本文整理汇总了Java中org.teiid.adminapi.Admin的典型用法代码示例。如果您正苦于以下问题:Java Admin类的具体用法?Java Admin怎么用?Java Admin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Admin类属于org.teiid.adminapi包,在下文中一共展示了Admin类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAdminApi

import org.teiid.adminapi.Admin; //导入依赖的package包/类
/**
 * Get an admin api connection with the supplied credentials
 * @param serverHost the server hostname
 * @param serverPort the server port number
 * @param userName the username
 * @param password the password
 * @return the admin api
 */
private Admin getAdminApi (String serverHost, int serverPort, String userName, String password) throws Exception {
        Admin admin = null;
        try {
                //admin = AdminFactory.getInstance().createAdmin(serverHost, serverPort, userName, password.toCharArray());
                admin = AdminFactory.getInstance().createAdmin(ModelControllerClient.Factory.create(serverHost, serverPort));
        } catch (Exception e) {
                throw new Exception(e.getMessage());
        }
        if(admin==null) {
                StringBuffer sb = new StringBuffer("Unable to establish Admin API connection. Please check the supplied credentials: \n");
                sb.append("\n [Host]: "+serverHost);
                sb.append("\n [Port]: "+serverPort);
                
                throw new Exception(sb.toString());
        }
     
        return admin;
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:27,代码来源:AdminApiClient.java

示例2: getTranslatorImportProperties

import org.teiid.adminapi.Admin; //导入依赖的package包/类
public Collection<? extends PropertyDefinition> getTranslatorImportProperties(String translatorName) throws AdminApiClientException {
	if(this.admin==null) return Collections.emptyList();

	// Get list of Translators
	Collection<? extends PropertyDefinition> importProps = null;
	try {
		importProps = this.admin.getTranslatorPropertyDefinitions(translatorName, Admin.TranlatorPropertyType.IMPORT);
	} catch (AdminException e) {
		throw new AdminApiClientException(e.getMessage());
	}

	if(importProps!=null) {
		return importProps;
	} else {
		return Collections.emptyList();
	}
}
 
开发者ID:Teiid-Designer,项目名称:teiid-webui,代码行数:18,代码来源:AdminApiClient.java

示例3: waitForVDBLoad

import org.teiid.adminapi.Admin; //导入依赖的package包/类
static boolean waitForVDBLoad(Admin admin, String vdbName, int vdbVersion,
		int timeoutInSecs) throws AdminException {
	long waitUntil = System.currentTimeMillis() + timeoutInSecs*1000;
	if (timeoutInSecs < 0) {
		waitUntil = Long.MAX_VALUE;
	}
	boolean first = true;
	do {
		if (!first) {
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				break;
			}
		} else {
			first = false;
		}
		VDB vdb = admin.getVDB(vdbName, vdbVersion);
		if (vdb != null && vdb.getStatus() != Status.LOADING) {
			return true;
		}
	} while (System.currentTimeMillis() < waitUntil);
	return false;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:AdminUtil.java

示例4: waitForDeployment

import org.teiid.adminapi.Admin; //导入依赖的package包/类
static boolean waitForDeployment(Admin admin, String deploymentName,
		int timeoutInSecs) {
	long waitUntil = System.currentTimeMillis() + timeoutInSecs*1000;
	if (timeoutInSecs < 0) {
		waitUntil = Long.MAX_VALUE;
	}
	boolean first = true;
	do {
		if (!first) {
			try {
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				break;
			}
		} else {
			first = false;
		}
		List<String> deployments = ((AdminImpl)admin).getDeployments();
		if (deployments.contains(deploymentName)) {
			return true;
		}
	} while (System.currentTimeMillis() < waitUntil);
	return false;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:AdminUtil.java

示例5: getService

import org.teiid.adminapi.Admin; //导入依赖的package包/类
@Override
protected SessionAwareCache getService(OperationContext context, PathAddress pathAddress, ModelNode operation) throws OperationFailedException {
	String cacheType = Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.name();

	if (operation.hasDefined(OperationsConstants.CACHE_TYPE.getName())) {
		cacheType = operation.get(OperationsConstants.CACHE_TYPE.getName()).asString();
	}

	ServiceController<?> sc;
	if (SessionAwareCache.isResultsetCache(cacheType)) {
		sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.CACHE_RESULTSET);
	}
	else {
		sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.CACHE_PREPAREDPLAN);
	}

	if (sc != null) {
		return SessionAwareCache.class.cast(sc.getValue());
	}
	return null;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:22,代码来源:TeiidOperationHandler.java

示例6: cleanUp

import org.teiid.adminapi.Admin; //导入依赖的package包/类
static void cleanUp(Admin admin) throws AdminException {
	//TODO: cleanup when as supports it
	/*for (String name : admin.getDataSourceNames()) {
		admin.deleteDataSource(name);
	}*/
	for (VDB vdb : admin.getVDBs()) {
		String deploymentName = vdb.getPropertyValue("deployment-name");
		if (deploymentName != null) {
			admin.undeploy(deploymentName);
		}
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:13,代码来源:AdminUtil.java

示例7: createDataSource

import org.teiid.adminapi.Admin; //导入依赖的package包/类
static boolean createDataSource(Admin admin, String deploymentName, String templateName, Properties properties) throws AdminException {
	if (admin.getDataSourceNames().contains(deploymentName)) {
		return false;
	}
	admin.createDataSource(deploymentName, templateName, properties);
	return true;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:8,代码来源:AdminUtil.java

示例8: getCacheTypes

import org.teiid.adminapi.Admin; //导入依赖的package包/类
public static Collection<String> getCacheTypes(){
	ArrayList<String> caches = new ArrayList<String>();
	caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
	caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
	return caches;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:7,代码来源:SessionAwareCache.java

示例9: isResultsetCache

import org.teiid.adminapi.Admin; //导入依赖的package包/类
public static boolean isResultsetCache(String cacheType) {
	return (Admin.Cache.valueOf(cacheType) == Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:4,代码来源:SessionAwareCache.java

示例10: executeOperation

import org.teiid.adminapi.Admin; //导入依赖的package包/类
@Override
protected void executeOperation(OperationContext context, VDBRepository repo, ModelNode operation) throws OperationFailedException {
	if (!operation.hasDefined(OperationsConstants.VDB_NAME.getName())) {
		throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME.getName()+MISSING)));
	}
	if (!operation.hasDefined(OperationsConstants.VDB_VERSION.getName())) {
		throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION.getName()+MISSING)));
	}
	if (!operation.hasDefined(OperationsConstants.MODEL_NAME.getName())) {
		throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.MODEL_NAME.getName()+MISSING)));
	}

	ModelNode result = context.getResult();
	String vdbName = operation.get(OperationsConstants.VDB_NAME.getName()).asString();
	int vdbVersion = operation.get(OperationsConstants.VDB_VERSION.getName()).asInt();
	String modelName = operation.get(OperationsConstants.MODEL_NAME.getName()).asString();

	VDBMetaData vdb = repo.getLiveVDB(vdbName, vdbVersion);
	if (vdb == null || (vdb.getStatus() != VDB.Status.ACTIVE)) {
		throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50096, vdbName, vdbVersion)));
	}

	EnumSet<SchemaObjectType> schemaTypes = null;
	if (vdb.getModel(modelName) == null){
		throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50097, vdbName, vdbVersion, modelName)));
	}

	if (operation.hasDefined(OperationsConstants.ENTITY_TYPE.getName())) {
		String[] types = operation.get(OperationsConstants.ENTITY_TYPE.getName()).asString().toUpperCase().split(","); //$NON-NLS-1$
		if (types.length > 0) {
			ArrayList<SchemaObjectType> sot = new ArrayList<Admin.SchemaObjectType>();
			for (int i = 1; i < types.length; i++) {
				sot.add(SchemaObjectType.valueOf(types[i]));
			}
			schemaTypes =  EnumSet.of(SchemaObjectType.valueOf(types[0]), sot.toArray(new SchemaObjectType[sot.size()]));
		}
		else {
			schemaTypes = EnumSet.of(SchemaObjectType.valueOf(types[0]));
		}
	}

	String regEx = null;
	if (operation.hasDefined(OperationsConstants.ENTITY_PATTERN.getName())) {
		regEx = operation.get(OperationsConstants.ENTITY_PATTERN.getName()).asString();
	}

	MetadataStore metadataStore = vdb.getAttachment(TransformationMetadata.class).getMetadataStore();
	Schema schema = metadataStore.getSchema(modelName);
	String ddl = DDLStringVisitor.getDDLString(schema, schemaTypes, regEx);
	result.set(ddl);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:52,代码来源:TeiidOperationHandler.java

示例11: oneTimeSetUp

import org.teiid.adminapi.Admin; //导入依赖的package包/类
@BeforeClass public static void oneTimeSetUp() {
	admin = Mockito.mock(Admin.class);
	AdminShell.internalAdmin = admin; 
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:5,代码来源:TestAdminShell.java


注:本文中的org.teiid.adminapi.Admin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。