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


Java Component类代码示例

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


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

示例1: startServer

import org.restlet.Component; //导入依赖的package包/类
@BeforeClass
public static void startServer() throws Exception {
	// Creating restlet component
	component = new Component();

	// The status service is disabled by default.
	component.getStatusService().setEnabled(false);

	component.getClients().add(Protocol.HTTP);
	component.getClients().add(Protocol.FILE);
	component.getClients().add(Protocol.WAR);
	component.getClients().add(Protocol.RIAP);

	component.getServers().add(Protocol.HTTP, portNumber);

	component.start();
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:18,代码来源:AbstractResourceTest.java

示例2: main

import org.restlet.Component; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    // Create a new Component.
    Component component = new Component();

    // Add a new HTTP server listening on port 8182.
    Server server = component.getServers().add(Protocol.HTTP, 8182);
    server.getContext().getParameters().add("useForwardedForHeader", "true");

    ShindigApplication application = new ShindigApplication(server.getContext());
    // Attach the sample application.
    component.getDefaultHost().attach("/shindig", application);

    server.getContext().getAttributes().put(Constants.CONTEXT_PATH_KEY, "/shindig");
    server.getContext().getAttributes().put(Constants.BASE_URL_KEY, "http://localhost:8182");

    // Start the component.
    component.start();

}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:20,代码来源:ShindigServer.java

示例3: main

import org.restlet.Component; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    // Create a new Component.
    Component component = new Component();

    // Add a new HTTP server listening on port 8182.
    org.restlet.Server server =  component.getServers().add(Protocol.HTTP, 8182);
    server.getContext().getParameters().add("useForwardedForHeader", "true");


    RestletSpringApplication application = new RestletSpringApplication();
    // Attach the sample application.
    component.getDefaultHost().attach( application);

    // Start the component.
    component.start();
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:17,代码来源:Server.java

示例4: testListPaging

import org.restlet.Component; //导入依赖的package包/类
@Test
public void testListPaging() throws Exception {
	Component component = new Component();
	component.getServers().add(Protocol.HTTP, port);
	component.getDefaultHost().attach(setupAppPaging());
	component.start();

	try {
		Client client = new Client(Protocol.HTTP);

		long count = getCount(client, "READY");
		assertEquals(pagingTotal, count);

		Collection<FileTrackingStatus> statusObjColl = getStatusObject(
				client, "READY", 0, 30);

		assertEquals(30, statusObjColl.size());
	} finally {
		component.stop();
	}

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:23,代码来源:TestFileTrackerStatusResource.java

示例5: testGetsStatus

import org.restlet.Component; //导入依赖的package包/类
@Test
public void testGetsStatus() throws Exception {
	Component component = new Component();
	component.getServers().add(Protocol.HTTP, port);
	component.getDefaultHost().attach(setupApp());
	component.start();

	try {
		Client client = new Client(Protocol.HTTP);
		
		for(File file: Arrays.asList(new File("test1.txt"), new File("test2.txt"), new File("test3.txt"))){
		
			FileTrackingStatus status = getStatusObject(client, file.getAbsolutePath());
			
			assertNotNull(status);
			assertEquals(file.getAbsolutePath(), status.getPath());
			
		}
		
	} finally {
		component.stop();
	}

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:25,代码来源:TestFileTrackerStatusPathResource.java

示例6: appLifeCycleManager

import org.restlet.Component; //导入依赖的package包/类
@Bean
public AppLifeCycleManagerImpl appLifeCycleManager() throws Exception {

	List<? extends StartupCheck> preStartupCheckList = Arrays.asList(
			beanFactory.getBean(ConfigCheck.class),
			beanFactory.getBean(CodecCheck.class));

	List<? extends ApplicationService> serviceList = Arrays.asList(
			new RestletService((Component) beanFactory
					.getBean("restletPingComponent")), new RestletService(
					(Component) beanFactory.getBean("restletComponent")),
			beanFactory.getBean(CollectorServerService.class), beanFactory
					.getBean(FileCloseService.class), beanFactory
					.getBean(GroupHeartbeatService.class), beanFactory
					.getBean(MetricsAppService.class), beanFactory
					.getBean(OrphanedFilesCheckService.class), beanFactory
					.getBean(StatusUpdaterThread.class), beanFactory
					.getBean(DiskSpaceCheckService.class), beanFactory
					.getBean(ZStoreExpireCheckService.class));

	List<? extends StartupCheck> postStartupList = Arrays
			.asList(beanFactory.getBean(PingCheck.class));

	return new AppLifeCycleManagerImpl(preStartupCheckList, serviceList,
			postStartupList);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:27,代码来源:CollectorDI.java

示例7: restletPingComponent

import org.restlet.Component; //导入依赖的package包/类
/**
 * Configures a restlet ping component
 * 
 * @return
 */
@Bean
public Component restletPingComponent() {
	org.apache.commons.configuration.Configuration configuration = beanFactory
			.getBean(org.apache.commons.configuration.Configuration.class);
	Component component = new Component();

	component.getServers().add(
			org.restlet.data.Protocol.HTTP,
			configuration.getInt(CollectorProperties.WRITER.PING_PORT
					.toString(),
					(Integer) CollectorProperties.WRITER.PING_PORT
							.getDefaultValue()));
	component.getDefaultHost().attach(restletPingApplication());

	return component;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:22,代码来源:CollectorDI.java

示例8: testPingCheckOK

import org.restlet.Component; //导入依赖的package包/类
/**
 * Tests that the PingCheck does not through errors when the ping service is
 * running
 * 
 * @throws Exception
 */
@Test
public void testPingCheckOK() throws Exception {

	Component pingComp = (Component) bootstrap
			.getBean("restletPingComponent");

	pingComp.start();
	try {

		PingCheck pingCheck = bootstrap.getBean(PingCheck.class);

		pingCheck.runCheck();
		assertTrue(true);

	} catch (Throwable t) {
		t.printStackTrace();
		assertTrue(false);
	} finally {
		pingComp.stop();
	}

}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:29,代码来源:TestPingCheck.java

示例9: restletComponent

import org.restlet.Component; //导入依赖的package包/类
/**
 * Configures a restlet component
 * 
 * @return
 */
@Bean
public Component restletComponent() {
	org.apache.commons.configuration.Configuration configuration = beanFactory
			.getBean(org.apache.commons.configuration.Configuration.class);
	Component component = new Component();
	component.getServers().add(
			org.restlet.data.Protocol.HTTP,
			configuration.getInt(
					CoordinationProperties.PROP.COORDINATION_PORT
							.toString(),
					(Integer) CoordinationProperties.PROP.COORDINATION_PORT
							.getDefaultValue()));
	component.getDefaultHost().attach(restletApplication());

	return component;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:22,代码来源:CoordinationDI.java

示例10: main

import org.restlet.Component; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	
	final int port = 8182;

    createDevelopmentDatabase();

    // Set up a Restlet service
    final Router router = new Router();
    router.attachDefault(HttpListener.class);

    org.restlet.Application myApp = new org.restlet.Application() {
        @Override
        public org.restlet.Restlet createInboundRoot() {
        	Context ctx = getContext();
ctx.getParameters().add("databaseDir", databaseDir);
ctx.getParameters().add("port", Integer.toString(port));
router.setContext(ctx);
            return router;
        };
    };
    Component component = new Component();
    component.getDefaultHost().attach("/", myApp);

    new Server(Protocol.HTTP, port, component).start();
}
 
开发者ID:ibm-watson-data-lab,项目名称:sync-android-p2p,代码行数:26,代码来源:Application.java

示例11: ControllerStarter

import org.restlet.Component; //导入依赖的package包/类
public ControllerStarter(ControllerConf conf) {
  LOGGER.info("Trying to init ControllerStarter with config: {}", conf);
  _config = conf;
  HelixKafkaMirrorMakerMetricsReporter.init(conf);
  _component = new Component();
  _controllerRestApp = new ControllerRestApplication(null);
  _helixMirrorMakerManager = new HelixMirrorMakerManager(_config);
  _validationManager = new ValidationManager(_helixMirrorMakerManager);
  _srcKafkaValidationManager = getSourceKafkaClusterValidationManager();
  _autoTopicWhitelistingManager = getAutoTopicWhitelistingManager();
  if (_config.getBackUpToGit()) {
    _clusterInfoBackupManager = new ClusterInfoBackupManager(_helixMirrorMakerManager,
        new GitBackUpHandler(conf.getRemoteBackupRepo(), conf.getLocalGitRepoPath()), _config);
  } else {
    _clusterInfoBackupManager = new ClusterInfoBackupManager(_helixMirrorMakerManager,
        new FileBackUpHandler(conf.getLocalBackupFilePath()), _config);
  }
}
 
开发者ID:uber,项目名称:uReplicator,代码行数:19,代码来源:ControllerStarter.java

示例12: ControllerStarter

import org.restlet.Component; //导入依赖的package包/类
public ControllerStarter(ControllerConf conf) {
  LOGGER.info("Trying to init ControllerStarter with config: {}", conf);
  _config = conf;
  HelixKafkaMirrorMakerMetricsReporter.init(conf);
  _component = new Component();
  _controllerRestApp = new ControllerRestApplication(null);
  _helixMirrorMakerManager = new HelixMirrorMakerManager(_config);
  _validationManager = new ValidationManager(_helixMirrorMakerManager);
  _srcKafkaValidationManager = getSourceKafkaClusterValidationManager();
  _autoTopicWhitelistingManager = getAutoTopicWhitelistingManager();
  if (_config.getBackUpToGit()) {
    _clusterInfoBackupManager =
        new ClusterInfoBackupManager(_helixMirrorMakerManager, new GitBackUpHandler(conf.getRemoteBackupRepo(),
            conf.getLocalGitRepoPath()), _config);
  } else {
    _clusterInfoBackupManager =
        new ClusterInfoBackupManager(_helixMirrorMakerManager, new FileBackUpHandler(conf.getLocalBackupFilePath()),
            _config);
  }
}
 
开发者ID:uber,项目名称:chaperone,代码行数:21,代码来源:ControllerStarter.java

示例13: main

import org.restlet.Component; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    logger.info("main() Start");

    if (args.length == 0) {
        loadProperties("");
    } else {
        loadProperties(args[0]);
    }

    Component component = new Component();
    component.getServers().add(Protocol.HTTP, SERVER_PORT);
    component.getDefaultHost().attach(SERVER_PATH, new RMrouterApplication());
    component.start();

    logger.info("main() End");
}
 
开发者ID:o3project,项目名称:ocnrm,代码行数:17,代码来源:OcnRMServ.java

示例14: setUp

import org.restlet.Component; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    component = PowerMockito.mock(Component.class, RETURNS_DEEP_STUBS);

    ServerList list = PowerMockito.mock(ServerList.class);
    PowerMockito.doReturn(list).when(component).getServers();
    PowerMockito.doReturn(mock(Server.class)).when(list).add(any(Protocol.class), anyInt());

    VirtualHost host = PowerMockito.mock(VirtualHost.class);
    PowerMockito.doReturn(host).when(component).getDefaultHost();
    PowerMockito.doReturn(mock(TemplateRoute.class))
            .when(host).attach(anyString(), any(RMrouterApplication.class));

    PowerMockito.doNothing().when(component).start();

    PowerMockito.whenNew(Component.class).withNoArguments().thenReturn(component);

    OdenOsPropertyLoader loader = PowerMockito.spy(OdenOsPropertyLoader.getInstance());
    Whitebox.setInternalState(OcnRMServ.class, "loader", loader);

    dummyLogger = mock(Logger.class);
    Whitebox.setInternalState(OcnRMServ.class, "logger", dummyLogger);
}
 
开发者ID:o3project,项目名称:ocnrm,代码行数:24,代码来源:OcnRMServTest.java

示例15: getCollection

import org.restlet.Component; //导入依赖的package包/类
/**
 * The MongoDB collection used for the store.
 * 
 * @return The MongoDB collection
 */
public MongoCollection<Document> getCollection()
{
	if( collection == null )
	{
		Component component = InstanceUtil.getComponent();
		if( component != null )
		{
			MongoClient client = (MongoClient) component.getContext().getAttributes().get( MONGODB_CLIENT_ATTRIBUTE );
			if( client != null )
			{
				MongoDatabase database = client.getDatabase( "prudence" );
				if( database != null )
					collection = database.getCollection( collectionName );
			}
		}
	}

	if( collection == null )
		throw new RuntimeException( "MongoDB client must be configured in order to use HazelcastMongoDbMapStore" );

	return collection;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:28,代码来源:HazelcastMongoDbMapStore.java


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