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


Java Service类代码示例

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


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

示例1: InterfaceBase

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
 * Constructor taking the items needed for the interface to start.
 * @param theName the name given to the interface
 * @param theService the service the interface will be bound to
 */
public InterfaceBase( String theName, Service theService ) {
	NameValidator nameValidator = NameManager.getValidator( InterfaceBase.INTERFACE_NAME_VALIDATOR );
	
	Preconditions.checkArgument( !Strings.isNullOrEmpty( theName ), "the interface must have a name" );
	Preconditions.checkArgument( nameValidator.isValid( theName ), String.format( "Interface name '%s' does not conform to validator '%s'.", theName, nameValidator.getClass().getSimpleName() ) );
	Preconditions.checkNotNull( theService, "need a service" );
	
	service = theService;
	name = theName;
	// make sure we have a contract manager
	contractManager = new ContractManager();
	
	// get the status blocks setup
	statusManager.register( "interface", status );
}
 
开发者ID:Talvish,项目名称:Tales,代码行数:21,代码来源:InterfaceBase.java

示例2: init

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
    * Override for initialization to ensure we have a service.
    */
   @Override
public void init() throws ServletException {
	super.init();
   	service=  ( Service )this.getServletContext().getAttribute( AttributeConstants.SERVICE_SERVLET_CONTEXT );
   	Preconditions.checkState( getService() != null, "Must have a service to use administrative servlets." );
 }
 
开发者ID:Talvish,项目名称:Tales,代码行数:10,代码来源:AdministrationServlet.java

示例3: doCall

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
	 * Private implementation of the request method which gets the contract information.
	 */ 
	private void doCall( HttpServletRequest theRequest, HttpServletResponse theResponse ) {
//		if( theRequest.getParameterMap().size() != 0 ) {
//			HttpService.writeFailure( 
//					theRequest,
//					theResponse, 
//					Failure.CALLER_BAD_DATA, 
//					"Parameters are not expected.",
//					null );
//		} else {
			logger.info( "Request made to list the status." );
			OperationContext operationContext = ( OperationContext )theRequest.getAttribute( AttributeConstants.OPERATION_REQUEST_CONTEXT );
			JsonObject serviceObject = new JsonObject( );
			JsonArray interfacesArray = new JsonArray( );
			JsonObject interfaceObject;
			Service service = getService( );
			
			
			serviceObject.addProperty( "name", service.getCanonicalName( ) );
			JsonArray blockArray = new JsonArray( );
			
			for( StatusBlock statusBlock : service.getStatusManager().getStatusBlocks() ) {
				blockArray.add( jsonifyStatusBlock( statusBlock, operationContext.getResponseTarget(), operationContext.getResponseDetails() ) );
			}
			serviceObject.add( "status", blockArray );
			for( Interface serviceInterface : service.getInterfaceManager().getInterfaces() ) {
				interfaceObject = jsonifyInterface( serviceInterface, operationContext.getResponseTarget(), operationContext.getResponseDetails() );
				interfacesArray.add( interfaceObject );
			}
			serviceObject.add( "interfaces", interfacesArray );
			
			ResponseHelper.writeSuccess(theRequest, theResponse, serviceObject ); 
//		}
	}
 
开发者ID:Talvish,项目名称:Tales,代码行数:37,代码来源:StatusServlet.java

示例4: doCall

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
	 * Private implementation of the request method which gets the contract information.
	 */ 
	private void doCall( HttpServletRequest theRequest, HttpServletResponse theResponse ) {
//		if( theRequest.getParameterMap().size() != 0 ) {
//			HttpService.writeFailure( 
//					theRequest,
//					theResponse, 
//					Failure.CALLER_BAD_DATA, 
//					"Parameters are not expected.",
//					null );
//		} else {
		logger.info( "Request made to list the alerts." );
		//OperationContext operationContext = ( OperationContext )theRequest.getAttribute( AttributeConstants.OPERATION_REQUEST_CONTEXT );
		JsonObject serviceObject = new JsonObject( );
		Service service = getService( );
		
		
		serviceObject.addProperty( "name", service.getCanonicalName( ) );
		JsonArray alertArray = new JsonArray( );
//		
//		for( Alert alert : service.getAlertManager().getAlerts() ) {
//			alertArray.add( jsonifyAlert( alert, operationContext.getResponseTarget(), operationContext.getResponseDetails() ) );
//		}
		serviceObject.add( "alerts", alertArray );
		
		ResponseHelper.writeSuccess(theRequest, theResponse, serviceObject );
//		}
	}
 
开发者ID:Talvish,项目名称:Tales,代码行数:30,代码来源:AlertsServlet.java

示例5: doCall

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
	 * Private implementation of the request method which gets the contract information.
	 */ 
	private void doCall( HttpServletRequest theRequest, HttpServletResponse theResponse ) {
//		if( theRequest.getParameterMap().size() != 0 ) {
//			HttpService.writeFailure( 
//					theRequest,
//					theResponse, 
//					Failure.CALLER_BAD_DATA, 
//					"Parameters are not expected.",
//					null );
//		} else {
			logger.info( "Request made to list the contracts." );
			OperationContext operationContext = ( OperationContext )theRequest.getAttribute( AttributeConstants.OPERATION_REQUEST_CONTEXT );

			Service service = getService( );
			JsonTranslationFacility jsonFacility = service.getFacility( JsonTranslationFacility.class );

			JsonObject serviceObject = new JsonObject( );
			JsonArray interfacesArray = new JsonArray( );
			JsonObject interfaceObject;
			
			serviceObject.addProperty( "name", service.getCanonicalName( ) );
//			if( operationContext.getResponseDetails() == Details.ALL ) {
//				serviceObject.addProperty( "friendly_name", service.getFriendlyName( ) );
//				serviceObject.addProperty( "description", service.getDescription( ) );
//			}

			for( Interface serviceInterface : getService( ).getInterfaceManager().getInterfaces() ) {
				interfaceObject = jsonifyInterface( serviceInterface, jsonFacility, operationContext );
				interfacesArray.add( interfaceObject );
			}
			serviceObject.add( "interfaces", interfacesArray );

//			TODO: consider another way to get this data
//			for( Interface httpInterface : service.getInterfaceManager().getInterfaces() ) {
//				QueuedThreadPool pool = ( QueuedThreadPool )( ( HttpInterface )httpInterface ).getHttpServletServer().getThreadPool();
//
//				pool.setDetailedDump( true );
//				logger.info( "LOOK AT ME I'M DUMPING FOR '{}': {}", httpInterface.getName(), pool.dump() );
//			}
			

			
			ResponseHelper.writeSuccess(theRequest, theResponse, serviceObject );
//		}
	}
 
开发者ID:Talvish,项目名称:Tales,代码行数:48,代码来源:ContractsServlet.java

示例6: doCall

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
	 * Private implementation of the request method which sends the list of configuration information.
	 */
	private void doCall( HttpServletRequest theRequest, HttpServletResponse theResponse ) {
//		if( theRequest.getParameterMap().size() != 0 ) {
//			ResponseHelper.writeFailure( 
//					theRequest,
//					theResponse, 
//					Failure.CALLER_BAD_DATA, 
//					"Parameters are not expected.",
//					null );
//		} else {
		
			logger.info( "Request made to list the configuration." );
			OperationContext operationContext = ( OperationContext )theRequest.getAttribute( AttributeConstants.OPERATION_REQUEST_CONTEXT );
			Map<String, LoadedSetting> settings = getService().getConfigurationManager( ).getAllLoadedSettings();

			Service service = getService( );
			JsonObject serviceObject = new JsonObject( );
			JsonArray settingsArray = new JsonArray( );
			JsonObject settingObject;

			serviceObject.addProperty( "name", service.getCanonicalName( ) );

			for( LoadedSetting setting : settings.values() ) {
				settingObject = new JsonObject( );
				settingObject.addProperty( "name", setting.getName( ) );
				if( !setting.isSensitive() ) {
					settingObject.addProperty( "value", setting.getStringValue( ) );
				}
				settingObject.addProperty( "source", setting.getSource( ) );
				if( operationContext.getResponseDetails() == Details.ALL ) {
					settingObject.addProperty( "description", setting.getDescription() );
					settingObject.addProperty( "sensitive", setting.isSensitive() );
					settingObject.addProperty( "first_request_datetime", setting.getFirstRequestTime().toString() );
					settingObject.addProperty( "last_request_datatime", setting.getLastRequestTime().toString( ) );
					settingObject.addProperty( "requests", setting.getRequests() );
				}

				settingsArray.add( settingObject );
			}
			serviceObject.add( "settings", settingsArray );

			ResponseHelper.writeSuccess(theRequest, theResponse, serviceObject );
//		}
	}
 
开发者ID:Talvish,项目名称:Tales,代码行数:47,代码来源:ConfigurationServlet.java

示例7: getService

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
 * Returns the HttpService this servlet helps administer.
 * @return the service
 */
protected Service getService() {
	return service;
}
 
开发者ID:Talvish,项目名称:Tales,代码行数:8,代码来源:AdministrationServlet.java

示例8: WebsiteInterface

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
 * Constructor taking parameters needed to start a website.
 * @param theName the name given to the interface
 * @param theService the service the interface will be bound to
 */
public WebsiteInterface( String theName, Service theService ) {
	super(theName, theService);
}
 
开发者ID:Talvish,项目名称:Tales,代码行数:9,代码来源:WebsiteInterface.java

示例9: HttpInterface

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
 * Constructor taking the items needed for the interface to start.
 * @param theName the name given to the interface
 * @param theEndpoints the endpoints exposed by this interface
 * @param theService the service the interface will be bound to
 */
public HttpInterface(String theName, Service theService) {
	super(theName, theService);
}
 
开发者ID:Talvish,项目名称:Tales,代码行数:10,代码来源:HttpInterface.java

示例10: getService

import com.talvish.tales.services.Service; //导入依赖的package包/类
/**
 * Returns the service this interface is part of.
 * @return the service this interface is part of.
 */
public final Service getService( ) {
	return this.service;
}
 
开发者ID:Talvish,项目名称:Tales,代码行数:8,代码来源:InterfaceBase.java


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