本文整理汇总了Java中org.apache.felix.ipojo.architecture.Architecture.getInstanceDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Architecture.getInstanceDescription方法的具体用法?Java Architecture.getInstanceDescription怎么用?Java Architecture.getInstanceDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.felix.ipojo.architecture.Architecture
的用法示例。
在下文中一共展示了Architecture.getInstanceDescription方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.felix.ipojo.architecture.Architecture; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Name");
table.column("Bundle Id");
table.column("State");
for (Architecture architecture : managerService.getArchitectures()) {
InstanceDescription instanceDescription = architecture.getInstanceDescription();
if (verbose || instanceDescription.getState() != ComponentInstance.DISPOSED) {
table.addRow().addContent(instanceDescription.getName(), instanceDescription.getBundleId(), IPojoManagerService.instanceDescriptionState(instanceDescription.getState()));
}
}
table.print(System.out);
return null;
}
示例2: getInvalidControllers
import org.apache.felix.ipojo.architecture.Architecture; //导入方法依赖的package包/类
private List<InstanceDescription> getInvalidControllers() {
List<InstanceDescription> invalid = new ArrayList<>();
for (Architecture architecture : architectures) {
final InstanceDescription description = architecture.getInstanceDescription();
// Is it invalid ?
if (description.getState() == ComponentInstance.INVALID) {
// Is it a controller
ProvidedServiceHandlerDescription hd = (ProvidedServiceHandlerDescription)
description.getHandlerDescription("org.apache.felix.ipojo:provides");
if (hd != null) {
for (ProvidedServiceDescription psd : hd.getProvidedServices()) {
if (Arrays.asList(psd.getServiceSpecifications()).contains(org.wisdom.api.Controller.class
.getName())) {
invalid.add(description);
}
}
}
}
}
return invalid;
}
示例3: dumpArchitecture
import org.apache.felix.ipojo.architecture.Architecture; //导入方法依赖的package包/类
public static void dumpArchitecture(BundleContext context) {
OSGiHelper helper = new OSGiHelper(context);
StringBuilder builder = new StringBuilder();
try {
for (Architecture arch : helper.getServiceObjects(Architecture.class)) {
InstanceDescription description = arch.getInstanceDescription();
builder.append("Instance : ").append(description.getName()).append(" - ").append(formatInstanceState
(description.getState())).append("\n");
builder.append(description.getDescription().toString());
builder.append("\n---------------------------------------\n");
}
} finally {
helper.dispose();
}
System.out.println(builder.toString());
}
示例4: getInstanceDescription
import org.apache.felix.ipojo.architecture.Architecture; //导入方法依赖的package包/类
@Override
public InstanceDescription getInstanceDescription(Object instance) {
for (Architecture architecture : architectures) {
if (architecture.getInstanceDescription().getState() == ComponentInstance.VALID) {
if (architecture.getInstanceDescription().getInstance() instanceof InstanceManager) {
InstanceManager instanceManager = (InstanceManager) architecture.getInstanceDescription().getInstance();
if (Arrays.asList(instanceManager.getPojoObjects()).contains(instance)) {
return architecture.getInstanceDescription();
}
}
}
}
return null;
}
示例5: execute
import org.apache.felix.ipojo.architecture.Architecture; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
AnsiPrintToolkit toolkit = new AnsiPrintToolkit();
boolean found = false;
for (Architecture arch : managerService.getArchitectures()) {
InstanceDescription instance = arch.getInstanceDescription();
if (name.equals(instance.getName())) {
printInstanceDetails(toolkit, instance);
found = true;
}
}
PrintStream stream = System.out;
if (!found) {
// Use error stream
stream = System.err;
Ansi buffer = toolkit.getBuffer();
// Creates an error message
buffer.a(" [");
toolkit.red("ERROR");
buffer.a("] ");
buffer.a("Instance '");
toolkit.italic(name);
buffer.a("' was not found.\n");
}
// Flush buffer's content
stream.println(toolkit.getBuffer().toString());
return null;
}