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


Java ProxyFactory类代码示例

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


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

示例1: getClient

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public static SlackApi getClient() {
	PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
	HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(cm).build();
	//
	ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);
	// new ApacheHttpClient4Engine(httpClient);
	//
	SlackApi slackApi = ProxyFactory.create(SlackApi.class, "https://hooks.slack.com", executor);
	// ResteasyClient client = new ResteasyClientBuilder().httpEngine(new
	// ApacheHttpClient4Engine(httpClient)).build();
	// Client client = ResteasyClientBuilder.newClient();
	// ResteasyWebTarget target =
	// (ResteasyWebTarget)client.target("https://hooks.slack.com");
	// ResteasyWebTarget rtarget = (ResteasyWebTarget) target;

	// SlackApi slackApi = target.proxy(SlackApi.class);
	return slackApi;
}
 
开发者ID:moacyrricardo,项目名称:maven-slack,代码行数:19,代码来源:SlackApiFactory.java

示例2: NubankImportador

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public NubankImportador(){
		ClientConnectionManager cm = new ThreadSafeClientConnManager();
		DefaultHttpClient httpClient = new DefaultHttpClient(cm);

		ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);

		authApi = ProxyFactory.create(NubankAPI.class, "https://prod-auth.nubank.com.br", executor);
		costumersApi = ProxyFactory.create(NubankAPI.class, "https://prod-customers.nubank.com.br", executor);
		accountsApi = ProxyFactory.create(NubankAPI.class, "https://prod-accounts.nubank.com.br", executor);

		ClientResponse<RegistrationResp> resp = authApi.register(RegistrationReq.asNubank());
		if(resp.getStatus() != RegistrationResp.SUCCESS_CODE){
			throw new RuntimeException("Erro registrando api. Status code = "+resp.getStatus());
//			System.out.println(resp.getEntity().getClient_id());
//			System.out.println(resp.getEntity().getClient_secret());
		}
		this.regResp = resp.getEntity();
//		api.token(TokenReq.create(resp.getEntity()));
	}
 
开发者ID:moacyrricardo,项目名称:bank-importer,代码行数:20,代码来源:NubankImportador.java

示例3: proxyTest

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
/**
 * Test that REST clients are correctly working
 * @return
 */
@GET
@Path("/test")
public String proxyTest() {
    StringBuilder retVal = new StringBuilder();
    DemoInterface proxy = ProxyFactory.create(DemoInterface.class, "http://localhost:8080/rest"); //Interface-based proxy

    String fancyOut = objectToJsonString(proxy.getStaticObject());
    if (fancyOut.equals(objectToJsonString(fancy))) {
        retVal.append("Interface-based client matches on LZF decompress. \n");
    } else {
        retVal.append("ERROR!  Interface-based DOES NOT match on LZF decompress. \n");
    }


    fancyOut = objectToJsonString(proxy.getStaticObjectGzip());
    if (fancyOut.equals(objectToJsonString(fancy))) {
        retVal.append("Interface-based client matches on GZIP decompress. \n");
    } else {
        retVal.append("ERROR!  Interface-based DOES NOT match on GZIP decompress. \n");
    }

    return retVal.toString();
}
 
开发者ID:svanoort,项目名称:rest-compress,代码行数:28,代码来源:RestDemoApp.java

示例4: getUptime

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public synchronized MonitorTarget getUptime( String macAddress )
{
    MonitorTarget monitorTarget = null;
    logger.trace( "getUptime macAddress " + macAddress );
    logger.debug( "restPath " + restPath );
    if ( restPath != null && macAddress != null && !macAddress.isEmpty() )
    {
        try
        {
            RebootDetection rebootDetectionService = ProxyFactory.create( RebootDetection.class,
                    restPath.replace( MAC_ARG, macAddress ) );
            if ( rebootDetectionService != null )
            {
                monitorTarget = rebootDetectionService.current();
            }
        }
        catch ( Exception e )
        { // catch any exceptions due to any reason like snmp service not
          // found etc
            logger.error( "getUptime Error occurred restPath " + restPath + " " + e.getMessage() );
        }
    }

    logger.info( "getUptime macAddress " + macAddress + " uptime " + monitorTarget );
    return monitorTarget;
}
 
开发者ID:Comcast,项目名称:cats,代码行数:27,代码来源:RebootMonitorService.java

示例5: listAllReboots

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public synchronized List< RebootInfo > listAllReboots( String macAddress )
{
    List< RebootInfo > rebootInfoList = null;
    logger.trace( "listAllReboots macAddress " + macAddress );
    logger.debug( "restPath " + restPath );

    if ( restPath != null && macAddress != null && !macAddress.isEmpty() )
    {

        try
        {
            RebootDetection rebootDetectionService = ProxyFactory.create( RebootDetection.class,
                    restPath.replace( MAC_ARG, macAddress ) );
            if ( rebootDetectionService != null )
            {
                rebootInfoList = rebootDetectionService.listAll();
            }
        }
        catch ( Exception e )
        { // catch any exceptions due to any reason like snmp service not
          // found etc
            logger.error( "listReboots Error occurred restPath " + restPath + " " + e.getMessage() );
        }
    }
    return rebootInfoList;
}
 
开发者ID:Comcast,项目名称:cats,代码行数:27,代码来源:RebootMonitorService.java

示例6: startWatching

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public void startWatching( String macAddress, String ecmMacAddress, String ipAddress )
{
    if ( restPath != null && macAddress != null && !macAddress.isEmpty() && ipAddress != null
            && !ipAddress.isEmpty() && ecmMacAddress != null && !ecmMacAddress.isEmpty())
    {
        try
        {

            RebootDetection rebootDetectionService = ProxyFactory.create( RebootDetection.class,
                    restPath.replace( MAC_ARG, macAddress ) );
            if ( rebootDetectionService != null )
            {
                rebootDetectionService.add( ipAddress, ecmMacAddress, RebootHostStatus.ENABLED );
            }
        }
        catch ( Exception e )
        { // catch any exceptions due to any reason like snmp service not
          // found etc
            logger.error( "getRebootCount Error occurred restPath " + restPath + " " + e.getMessage() );
        }
    }
}
 
开发者ID:Comcast,项目名称:cats,代码行数:23,代码来源:RebootMonitorService.java

示例7: stopWatching

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public void stopWatching( String macAddress, String ecmMacAddress, String ipAddress )
{
    if ( restPath != null && macAddress != null && !macAddress.isEmpty() && ipAddress != null
            && !ipAddress.isEmpty() && ecmMacAddress != null && !ecmMacAddress.isEmpty())
    {
        try
        {
            RebootDetection rebootDetectionService = ProxyFactory.create( RebootDetection.class,
                    restPath.replace( MAC_ARG, macAddress ) );
            if ( rebootDetectionService != null )
            {
                rebootDetectionService.update( ipAddress, ecmMacAddress, RebootHostStatus.DISABLED );
            }
        }
        catch ( Exception e )
        { // catch any exceptions due to any reason like snmp service not
          // found etc
            logger.error( "getRebootCount Error occurred restPath " + restPath + " " + e.getMessage() );
        }
    }
}
 
开发者ID:Comcast,项目名称:cats,代码行数:22,代码来源:RebootMonitorService.java

示例8: updateSettopInMonitor

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public void updateSettopInMonitor(String macAddress, String ecmMacAddress, String ipAddress)
{
    if ( restPath != null && macAddress != null && !macAddress.isEmpty() && ipAddress != null
            && !ipAddress.isEmpty() && ecmMacAddress != null && !ecmMacAddress.isEmpty())
    {
        try
        {
            RebootDetection rebootDetectionService = ProxyFactory.create( RebootDetection.class,
                    restPath.replace( MAC_ARG, macAddress ) );
            if ( rebootDetectionService != null )
            {
                rebootDetectionService.update( ipAddress, ecmMacAddress, RebootHostStatus.ENABLED );
            }
        }
        catch ( Exception e )
        { // catch any exceptions due to any reason like snmp service not
          // found etc
            logger.error( "getRebootCount Error occurred restPath " + restPath + " " + e.getMessage() );
        }
    }
    
}
 
开发者ID:Comcast,项目名称:cats,代码行数:23,代码来源:RebootMonitorService.java

示例9: isSNMPRebootServiceIsReachable

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
public boolean isSNMPRebootServiceIsReachable()
{
    boolean isReachable = false;
    try
    {
        RebootDetection rebootDetectionService = ProxyFactory.create( RebootDetection.class,
                restPath.replace( MAC_ARG, "mac" ) ); // remove < & > as
                                                      // they are illegal
        if ( rebootDetectionService != null )
        {
            rebootDetectionService.count();
            isReachable = true;
        }
    }
    catch ( Exception e )
    { // catch any exceptions due to any reason like snmp service not found
      // etc
        logger.error( "checkIfSNMPRebootServiceIsReachable Error occurred restPath " + restPath + " "
                + e.getMessage() );
    }

    return isReachable;
}
 
开发者ID:Comcast,项目名称:cats,代码行数:24,代码来源:RebootMonitorService.java

示例10: get

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
@Override
public KeyManagerProxy get() {
    KeyManagerProxy keyManagerProxy = null;
    try{
        if(hostname == null || hostname.isEmpty()){
            hostname = System.getProperty( KeyManagerConstants.KEY_MANAGER_PROXY_IP_NAME );
        }
        logger.trace( "KeyManagerProxyProviderRest get() "+hostname );
        if(hostname != null){
		    String restUrl="http://"+hostname+"/keymanager-service"+KeyManagerConstants.APPLICATION_PATH+KeyManagerConstants.KEYMANAGER_PATH;
			logger.info("Rest interface to keymanager service constructed "+restUrl);
            keyManagerProxy = ProxyFactory.create(KeyManagerProxy.class,restUrl);
        }else{
            logger.warn( "System property "+KeyManagerConstants.KEY_MANAGER_PROXY_IP_NAME+" may not be set properly" );
        }
        logger.trace( "KeyManagerProxyProviderRest keyManagerProxy "+keyManagerProxy );
    }catch(Exception e){
        logger.warn( e.getMessage() );
    }
    return keyManagerProxy;
}
 
开发者ID:Comcast,项目名称:cats,代码行数:22,代码来源:KeyManagerProxyProviderRest.java

示例11: testScreenshot

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
@Test
public void testScreenshot() throws Exception {
    final AuthenticationEndpoint authenticationEndpoint = ProxyFactory.create(AuthenticationEndpoint.class, BASE);
    final String token = authenticationEndpoint.getToken(getApkAuthentication());
    final UploadFileEndpoint uploadFileEndpoint = ProxyFactory.create(UploadFileEndpoint.class, BASE);
    final ScreenshotMessageRequest request = new ScreenshotMessageRequest();
    request.setRevisionHash(testRevisionHash);
    request.setVariantHash(testVariantHash);
    request.setToken(token);
    request.setScreenshotFileStream(getClass().getResourceAsStream("/clap_8972227388431348519.png"));
    final ScreenshotMessage message = new ScreenshotMessage();
    fillMessage(message);
    request.setMessage(message);
    final ClapResponse clapResponse = uploadFileEndpoint.saveScreenshot(request);
    assertEquals(0, clapResponse.getCode());
}
 
开发者ID:noveogroup,项目名称:clap,代码行数:17,代码来源:IntegrationTest.java

示例12: setUpBeforeClass

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20100";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();

	ContentProviderCRUD proxy = ProxyFactory.create(ContentProviderCRUD.class, uri);
	proxy.deleteContentProvider(ConstantsTest.CP);
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:24,代码来源:ContentProviderCRUDImplTest.java

示例13: tearDownAfterClass

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@AfterClass
public static void tearDownAfterClass() throws Exception
{
	ContentProviderCRUD proxy = ProxyFactory.create(ContentProviderCRUD.class, uri);
	proxy.deleteContentProvider(ConstantsTest.CP);

	server.stop();

	// cleanup:
	HBaseManager manager = HBaseManager.getInstance(Config.getInstance().getZooKeeperHost());

	// drop all related table:
	new HBaseCollectionTable(manager).drop(ConstantsTest.CP);
	new HBaseRecommendationTable(manager).drop(ConstantsTest.CP);
	new HBaseEventLogTable(manager).drop(ConstantsTest.CP);
	new HBaseUserTable(manager).drop(ConstantsTest.CP);

	// wait a while, so all the cluster is back to normal
	Thread.sleep(10000);
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:24,代码来源:ContentProviderCRUDImplTest.java

示例14: setUpBeforeClass

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
	// start the server:
	server = new Server(port);
	WebAppContext context = new WebAppContext();

	uri = "http://localhost:20100";

	// see if this can be set more dynamically:
	context.setContextPath("/");
	context.setResourceBase(new File("src/main/webapp/").getCanonicalPath());
	context.setDescriptor(new File("src/main/webapp/").getCanonicalPath() + "/WEB-INF/web.xml");

	server.setHandler(context);
	server.start();

	ContentProviderCRUD proxy1 = ProxyFactory.create(ContentProviderCRUD.class, uri);
	proxy1.createContentProvider(new ContentProvider(ConstantsTest.CP, System.currentTimeMillis() / 1000, true));

	CollectionImport proxy2 = ProxyFactory.create(CollectionImport.class, uri);
	proxy2.deleteCollection(ConstantsTest.CP, ConstantsTest.COLLECTION);
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:27,代码来源:CollectionImportImplTest.java

示例15: testReadCollectionMeta

import org.jboss.resteasy.client.ProxyFactory; //导入依赖的package包/类
/**
 * Test method for
 * {@link nl.gridline.zieook.workflow.rest.CollectionImportImpl#readCollectionMeta(java.lang.String, java.lang.String)}
 * .
 */
@Test
@Ignore
public final void testReadCollectionMeta()
{
	CollectionImport proxy = ProxyFactory.create(CollectionImport.class, uri, new ApacheHttpClient4Executor());

	// should throw a 404 - the cp does not exist:
	try
	{
		proxy.readCollectionMeta(ConstantsTest.CP, ConstantsTest.COLLECTION);
	}
	catch (org.jboss.resteasy.client.ClientResponseFailure e)
	{
		assertEquals(e.getResponse().getStatus(), 404);
		return;
	}
	fail("a 404 exception should have been thrown");
}
 
开发者ID:beeldengeluid,项目名称:zieook,代码行数:24,代码来源:CollectionImportImplTest.java


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