• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Descriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: log

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Show the contents of the log")
public List<String> log(
		//
		@Descriptor("Reverse the printout order to oldest is last") @Parameter(names = { "-r",
				"--reverse" }, absentValue = "true", presentValue = "false") boolean reverse, //
		@Descriptor("Skip the first entries") @Parameter(names = { "-s", "--skip" }, absentValue = "0") int skip, //
		@Descriptor("Maximum number of entries to print") @Parameter(names = { "-m",
				"--max" }, absentValue = "100") int maxEntries, //
		@Descriptor("Minimum level (error,warning,info,debug). Default is warning.") @Parameter(names = { "-l",
				"--level" }, absentValue = "warning") String level, //
		@Descriptor("Print style (classic,abbr)") @Parameter(names = { "-y",
				"--style" }, absentValue = "classic") String style, //
		@Descriptor("Do not print exceptions.") @Parameter(names = { "-n",
				"--noexceptions" }, absentValue = "false", presentValue = "true") boolean noExceptions //
) {
	return logTracker.log(maxEntries, skip, LogTracker.Level.valueOf(level), reverse, noExceptions,
			LogTracker.Style.valueOf(style));
}
 
开发者ID:osgi,项目名称:osgi.iot.contest.sdk,代码行数:19,代码来源:ExtraImpl.java


示例2: remove

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor ( "Remove storage by id" )
public void remove ( final String[] args )
{
    final String usage = "Usage: remove [--force] id1 [id2 [id3]]";
    if ( args.length <= 0 )
    {
        System.out.println ( usage );
        return;
    }

    boolean force = false;
    for ( final String id : args )
    {
        if ( "--force".equals ( id ) )
        {
            force = true;
        }
        else
        {
            System.out.println ( String.format ( "Removing storage '%s' ...", id ) );
            System.out.flush ();
            removeById ( id, force );
            System.out.println ( String.format ( "Removing storage '%s' ... done!", id ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:27,代码来源:Console.java


示例3: showfactories

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor ( "Show full factories information" )
public void showfactories ()
{
    final Factory[] factories = this.admin.getKnownFactories ();

    Arrays.sort ( factories, FACTORY_ID_COMPARATOR );

    final List<List<String>> data = new LinkedList<List<String>> ();
    for ( final Factory factory : factories )
    {
        final List<String> row = new LinkedList<String> ();

        row.add ( factory.getId () );
        row.add ( factory.getState ().toString () );
        row.add ( factory.getDescription () );

        data.add ( row );
    }

    Tables.showTable ( System.out, Arrays.asList ( "ID", "State", "Description" ), data, 2 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:Console.java


示例4: show

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor ( "Show configuration" )
public void show ( @Descriptor ( "The factory id" )
final String factoryId, @Descriptor ( "The configuration id" )
final String configurationId)
{
    final Configuration cfg = this.admin.getConfiguration ( factoryId, configurationId );
    if ( cfg == null )
    {
        System.out.println ( String.format ( "Configuration %s/%s does not exists", factoryId, configurationId ) );
    }
    else
    {
        System.out.format ( "%s - %s - %s%n", cfg.getFactoryId (), cfg.getId (), cfg.getState () );
        for ( final Map.Entry<String, String> entry : cfg.getData ().entrySet () )
        {
            System.out.format ( "\t'%s' => '%s'%n", entry.getKey (), entry.getValue () );
        }
        if ( cfg.getErrorInformation () != null )
        {
            cfg.getErrorInformation ().printStackTrace ( System.out );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:Console.java


示例5: list

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor ( "List installed addons" )
public void list ()
{
    final List<Addon> result = this.addonManager.list ();

    final List<String> header = Arrays.asList ( "ID", "Name", "Version", "State", "Label", "Error" );
    final List<List<String>> data = new ArrayList<> ( result.size () );

    for ( final Addon addon : result )
    {
        final List<String> row = new ArrayList<> ( 6 );
        data.add ( row );

        row.add ( addon.getId () );
        row.add ( addon.getInformation ().getDescription ().getId () );
        row.add ( addon.getInformation ().getDescription ().getVersion ().toString () );
        row.add ( addon.getInformation ().getState ().toString () );
        row.add ( addon.getInformation ().getDescription ().getLabel () );
        if ( addon.getInformation ().getError () != null )
        {
            row.add ( ExceptionHelper.getMessage ( addon.getInformation ().getError () ).replace ( "\n", " " ).replace ( "\r", "" ) );
        }
    }

    Tables.showTable ( System.out, header, data, 2 );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:27,代码来源:Console.java


示例6: deploy

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Deploy a neural network on a runtime and load weights with specific tag.")
public void deploy(
		@Descriptor("name of the neural network")
		String name, 
		@Descriptor("uuid of the target runtime")
		String id, 
		@Descriptor("tag of the weights to load")
		String tag){
	NeuralNetworkInstanceDTO nn = deploy(name, UUID.fromString(id));
	
	// load parameters with tag
	loadParameters(nn, tag);
	
	// add updatelistener for tag
	addRepositoryListener(nn, tag);
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:17,代码来源:DiannePlatformCommands.java


示例7: bptt

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Train a recurrent neural network using the Back Propagation Through Time Learning strategy")
public void bptt(String nnName, String dataset, String... properties){
	final Map<String, String> defaults = new HashMap<>();
	defaults.put("strategy", "be.iminds.iot.dianne.rnn.learn.strategy.BPTTLearningStrategy");
	Map<String, String> config = createConfig(defaults, properties);
	
	coordinator.learn(dataset, config, nnName.split(",")).then(p -> {
		System.out.println("Learn Job done!");
		LearnResult result = p.getValue();
		System.out.println("Iterations: "+result.getIterations());
		System.out.println("Last minibatch loss: "+result.getLoss());
		return null;
	}, p -> {
		System.out.println("Learn Job failed: "+p.getFailure().getMessage());
		p.getFailure().printStackTrace();
	});
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:18,代码来源:DianneCoordinatorCommands.java


示例8: forward

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Forward a dataset sample through a neural network instance.")
public void forward(
		@Descriptor("dataset name to fetch a sample from")
		String dataset, 
		@Descriptor("index of the neural network instance (from the list command output)")
		int index, 
		@Descriptor("index of dataset sample")
		int sample, 
		@Descriptor("(optional) tags to attach to the forward call ")
		String... tags){
	List<NeuralNetworkInstanceDTO> nns = platform.getNeuralNetworkInstances();
	if(index >= nns.size()){
		System.out.println("No neural network deployed with index "+index);
		return;
	}
	String id = nns.get(index).id.toString();
	
	forward(dataset, id, sample, tags);
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:20,代码来源:DianneDatasetCommands.java


示例9: sample

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Print out samples of the dataset")
public void sample(
		@Descriptor("dataset name to fetch a sample from")
		String dataset,
		@Descriptor("start index")
		int start,
		@Descriptor("end index")
		int end){ 
	
	Dataset d = datasets.getDataset(dataset);
	if(d==null){
		System.out.println("Dataset "+dataset+" not available");
		return;
	}
	for(int index=start;index<end;index++)
		System.out.println("["+index+"] "+d.getSample(index).toString());
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:18,代码来源:DianneDatasetCommands.java


示例10: batch

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Print out a batch of the dataset")
public void batch(
		@Descriptor("dataset name to fetch a sample from")
		String dataset,
		@Descriptor("start index")
		int start,
		@Descriptor("end index")
		int end){ 
	
	Dataset d = datasets.getDataset(dataset);
	if(d==null){
		System.out.println("Dataset "+dataset+" not available");
		return;
	}
	
	int[] indices = new int[end-start];
	for(int i=0;i<indices.length;i++) {
		indices[i] = start + i;
	}
	
	System.out.println(d.getBatch(indices));
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:23,代码来源:DianneDatasetCommands.java


示例11: sequences

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Print out the number of sequences of the dataset")
public void sequences(
		@Descriptor("dataset get the number of sequences from")
		String dataset){ 
	
	Dataset d = datasets.getDataset(dataset);
	if(d==null){
		System.out.println("Dataset "+dataset+" not available");
		return;
	}
	if(!(d instanceof SequenceDataset)){
		System.out.println("Dataset "+dataset+" is not a sequence dataset");
		return;
	}
	
	System.out.println(((SequenceDataset<?, ?>)d).sequences());
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:18,代码来源:DianneDatasetCommands.java


示例12: classes

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Print out the classes and number of samples per class")
public void classes(
		@Descriptor("dataset get the classes from")
		String dataset){ 
	
	Dataset d = datasets.getDataset(dataset);
	if(d==null){
		System.out.println("Dataset "+dataset+" not available");
		return;
	}

	Tensor count = new Tensor(d.targetDims());
	count.fill(0.0f);
	int samples = d.size();
	for(int i=0;i<samples;i++){
		Sample s = d.getSample(i);
		count = TensorOps.add(count, count, s.target);
	}
	
	String[] labels = d.getLabels();
	if(labels!=null){
		System.out.println(Arrays.toString(labels));
	}
	
	System.out.println(Arrays.toString(count.get()));
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:27,代码来源:DianneDatasetCommands.java


示例13: dump

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Dump the content of an experience pool")
public void dump(
		@Descriptor("The experience pool to dump")
		String dataset){ 
	
	Dataset d = datasets.getDataset(dataset);
	if(d==null){
		System.out.println("Dataset "+dataset+" not available");
		return;
	}
	if(!datasets.isExperiencePool(dataset)){
		System.out.println("Dataset "+dataset+" is not an experience pool");
		return;
	}
	
	
	try {
		d.getClass().getMethod("dump").invoke(d);
	} catch(Throwable t){
		t.printStackTrace();
	}
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:23,代码来源:DianneDatasetCommands.java


示例14: clear

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Clear an experience pool")
public void clear(
		@Descriptor("The experience pool to dump")
		String dataset){ 
	
	Dataset d = datasets.getDataset(dataset);
	if(d==null){
		System.out.println("Dataset "+dataset+" not available");
		return;
	}
	if(!datasets.isExperiencePool(dataset)){
		System.out.println("Dataset "+dataset+" is not an experience pool");
		return;
	}
	
	
	try {
		d.getClass().getMethod("reset").invoke(d);
	} catch(Throwable t){
		t.printStackTrace();
	}
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:23,代码来源:DianneDatasetCommands.java


示例15: delete

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("delete a Resource")
public void delete(@Descriptor("delete") String... handleId) throws ResourceNotFoundException, IllegalActionOnResourceException {
    String bufferOut = new String();
    try {
        String path;
        if (handleId.length == 0) {
            bufferOut = bufferOut + "Error : Must have at least 1 argument \n";
        } else {

            for (String current : handleId) {
                path = current;
                m_everestClient.delete(path);
                bufferOut = bufferOut + "Success : The resource at " + path + " have been destroy\n";
            }
        }
    } catch (Exception e) {
        System.out.println(bufferOut);
        e.printStackTrace();
        bufferOut = null;
    }

    System.out.println(bufferOut);


}
 
开发者ID:ow2-chameleon,项目名称:everest,代码行数:26,代码来源:EverestGoGoCommand.java


示例16: filter

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Apply a filter on a set of Resource")
public void filter(@Descriptor("automatically supplied shell session") CommandSession session,
                   @Descriptor("request for the filter creation") String request
)   {
    System.out.println("Request " + request);
    ListResourceContainer listResourceContainer = (ListResourceContainer) session.get(LISTRESOURCE);
    if ( listResourceContainer == null){
        System.out.println(" NO ENTRY TO FILTER ");
        return;
    }
    try{
        QueryFilter parserQuery = new QueryFilter(request,m_everestClient.getM_everest());
        ResourceFilter resourceFilter = parserQuery.input();
        ListResourceContainer filterResourceList = listResourceContainer.filter(resourceFilter);
        printResource(filterResourceList);
        session.put(LISTRESOURCE,filterResourceList);
    }catch (Exception e){
        e.printStackTrace();
    }
}
 
开发者ID:ow2-chameleon,项目名称:everest,代码行数:21,代码来源:EverestGoGoCommand.java


示例17: discovery

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Gets the discovery available in the platform")
public void discovery(@Descriptor("discovery [discovery name]") String... parameters) {
    List<ServiceReference> discoveryRef = getAllServiceRefs(DiscoveryService.class);
    StringBuilder sbFinal = new StringBuilder();
    if (discoveryRef.isEmpty()) {
        sbFinal.append("No discovery available.\n");
    } else {
        for (ServiceReference reference : discoveryRef) {
            StringBuilder sb = new StringBuilder();
            sb.append(displayServiceInfo(reference));
            sb.append(createASCIIBox("Properties", displayServiceProperties(reference)));

            sbFinal.append(createASCIIBox("Discovery", sb));
        }
    }

    print(sbFinal.toString());
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:19,代码来源:FuchsiaGogoCommand.java


示例18: importer

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Gets the importer available in the platform")
public void importer(@Descriptor("importer [importer name]") String... parameters) {
    Map<ServiceReference, ImporterService> importerRefsAndServices = getAllServiceRefsAndServices(ImporterService.class);
    StringBuilder sbFinal = new StringBuilder();
    if (importerRefsAndServices.isEmpty()) {
        sbFinal.append("No importers available.\n");
    } else {
        for (Map.Entry<ServiceReference, ImporterService> e : importerRefsAndServices.entrySet()) {
            StringBuilder sb = new StringBuilder();
            sb.append(displayServiceInfo(e.getKey()));
            sb.append(String.format("importer name = %s%n", e.getValue().getName()));
            sb.append(createASCIIBox("Properties", displayServiceProperties(e.getKey())));
            sbFinal.append(createASCIIBox("Importer", sb));
        }
    }
    print(sbFinal.toString());
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:18,代码来源:FuchsiaGogoCommand.java


示例19: exporter

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Gets the exporter available in the platform")
public void exporter(@Descriptor("exporter [exporter name]") String... parameters) {
    Map<ServiceReference, ExporterService> exporterRefsAndServices = getAllServiceRefsAndServices(ExporterService.class);
    StringBuilder sbFinal = new StringBuilder();
    if (exporterRefsAndServices.isEmpty()) {
        print("No exporter available.");
    } else {
        for (Map.Entry<ServiceReference, ExporterService> e : exporterRefsAndServices.entrySet()) {
            StringBuilder sb = new StringBuilder();
            sb.append(displayServiceInfo(e.getKey()));
            sb.append(String.format("exporter name = %s%n", e.getValue().getName()));
            sb.append(createASCIIBox("Properties", displayServiceProperties(e.getKey())));
            sbFinal.append(createASCIIBox("Exporter", sb));
        }
    }
    print(sbFinal.toString());
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:18,代码来源:FuchsiaGogoCommand.java


示例20: sendmessage

import org.apache.felix.service.command.Descriptor; //导入依赖的package包/类
@Descriptor("Send event admin messages")
public void sendmessage(@Descriptor("sendmessage BUS [KEY=VALUE ]*") String... parameters) {
    assert parameters[0] != null;
    String bus = parameters[0];
    Dictionary eventAdminPayload = new Hashtable();
    for (String m : parameters) {
        if (m.contains("=")) {
            StringTokenizer st = new StringTokenizer(m, "=");
            assert st.countTokens() == 2;
            String key = st.nextToken();
            String value = st.nextToken();
            eventAdminPayload.put(key, value);
        }
    }
    Event eventAdminMessage = new Event(bus, eventAdminPayload);
    print(String.format("Sending message to the bus %s with the arguments %s", bus, eventAdminPayload));
    print("Event admin message sent");
    eventAdmin.sendEvent(eventAdminMessage);
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:20,代码来源:FuchsiaGogoCommand.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StopContainersResponse类代码示例发布时间:2022-05-22
下一篇:
Java IBaseResource类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap