本文整理了Java中aQute.bnd.osgi.Analyzer.validResourcePath()
方法的一些代码示例,展示了Analyzer.validResourcePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Analyzer.validResourcePath()
方法的具体详情如下:
包路径:aQute.bnd.osgi.Analyzer
类名称:Analyzer
方法名:validResourcePath
暂无
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
private void createComponentResource(Map<String, Map<String, String>> components, String name,
Map<String, String> info) throws Exception {
// We can override the name in the parameters
if (info.containsKey(COMPONENT_NAME))
name = info.get(COMPONENT_NAME);
// Assume the impl==name, but allow override
String impl = name;
if (info.containsKey(COMPONENT_IMPLEMENTATION))
impl = info.get(COMPONENT_IMPLEMENTATION);
TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
// Check if such a class exists
analyzer.referTo(implRef);
boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
|| designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
// If we had a designate, we want a default configuration policy of
// require.
if (designate && info.get(COMPONENT_CONFIGURATION_POLICY) == null)
info.put(COMPONENT_CONFIGURATION_POLICY, "require");
// We have a definition, so make an XML resources
Resource resource = createComponentResource(name, impl, info);
String pathSegment = analyzer.validResourcePath(name, "Invalid component name");
analyzer.getJar()
.putResource("OSGI-INF/" + pathSegment + ".xml", resource);
components.put("OSGI-INF/" + pathSegment + ".xml", EMPTY);
}
代码示例来源:origin: biz.aQute.bnd/bndlib
private void createComponentResource(Map<String,Map<String,String>> components, String name,
Map<String,String> info) throws Exception {
// We can override the name in the parameters
if (info.containsKey(COMPONENT_NAME))
name = info.get(COMPONENT_NAME);
// Assume the impl==name, but allow override
String impl = name;
if (info.containsKey(COMPONENT_IMPLEMENTATION))
impl = info.get(COMPONENT_IMPLEMENTATION);
TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
// Check if such a class exists
analyzer.referTo(implRef);
boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
|| designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
// If we had a designate, we want a default configuration policy of
// require.
if (designate && info.get(COMPONENT_CONFIGURATION_POLICY) == null)
info.put(COMPONENT_CONFIGURATION_POLICY, "require");
// We have a definition, so make an XML resources
Resource resource = createComponentResource(name, impl, info);
String pathSegment = analyzer.validResourcePath(name, "Invalid component name");
analyzer.getJar().putResource("OSGI-INF/" + pathSegment + ".xml", resource);
components.put("OSGI-INF/" + pathSegment + ".xml", EMPTY);
}
代码示例来源:origin: biz.aQute.bnd/bnd
private void createComponentResource(Map<String,Map<String,String>> components, String name,
Map<String,String> info) throws Exception {
// We can override the name in the parameters
if (info.containsKey(COMPONENT_NAME))
name = info.get(COMPONENT_NAME);
// Assume the impl==name, but allow override
String impl = name;
if (info.containsKey(COMPONENT_IMPLEMENTATION))
impl = info.get(COMPONENT_IMPLEMENTATION);
TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
// Check if such a class exists
analyzer.referTo(implRef);
boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
|| designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
// If we had a designate, we want a default configuration policy of
// require.
if (designate && info.get(COMPONENT_CONFIGURATION_POLICY) == null)
info.put(COMPONENT_CONFIGURATION_POLICY, "require");
// We have a definition, so make an XML resources
Resource resource = createComponentResource(name, impl, info);
String pathSegment = analyzer.validResourcePath(name, "Invalid component name");
analyzer.getJar().putResource("OSGI-INF/" + pathSegment + ".xml", resource);
components.put("OSGI-INF/" + pathSegment + ".xml", EMPTY);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
private void createComponentResource(Map<String, Map<String, String>> components, String name,
Map<String, String> info) throws Exception {
// We can override the name in the parameters
if (info.containsKey(COMPONENT_NAME))
name = info.get(COMPONENT_NAME);
// Assume the impl==name, but allow override
String impl = name;
if (info.containsKey(COMPONENT_IMPLEMENTATION))
impl = info.get(COMPONENT_IMPLEMENTATION);
TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
// Check if such a class exists
analyzer.referTo(implRef);
boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
|| designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
// If we had a designate, we want a default configuration policy of
// require.
if (designate && info.get(COMPONENT_CONFIGURATION_POLICY) == null)
info.put(COMPONENT_CONFIGURATION_POLICY, "require");
// We have a definition, so make an XML resources
Resource resource = createComponentResource(name, impl, info);
String pathSegment = analyzer.validResourcePath(name, "Invalid component name");
analyzer.getJar()
.putResource("OSGI-INF/" + pathSegment + ".xml", resource);
components.put("OSGI-INF/" + pathSegment + ".xml", EMPTY);
}
代码示例来源:origin: biz.aQute.bnd/bndlib
public boolean analyzeJar(Analyzer analyzer) throws Exception {
Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.DSANNOTATIONS));
if (header.size() == 0)
return false;
Instructions instructions = new Instructions(header);
Collection<Clazz> list = analyzer.getClassspace().values();
String sc = analyzer.getProperty(Constants.SERVICE_COMPONENT);
List<String> names = new ArrayList<String>();
if (sc != null && sc.trim().length() > 0)
names.add(sc);
for (Clazz c: list) {
for (Instruction instruction : instructions.keySet()) {
if (instruction.matches(c.getFQN())) {
if (instruction.isNegated())
break;
ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
if (definition != null) {
definition.sortReferences();
definition.prepare(analyzer);
String name = "OSGI-INF/" + analyzer.validResourcePath(definition.name, "Invalid component name") + ".xml";
names.add(name);
analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
}
}
}
}
sc = Processor.append(names.toArray(new String[names.size()]));
analyzer.setProperty(Constants.SERVICE_COMPONENT, sc);
return false;
}
代码示例来源:origin: biz.aQute.bnd/bnd
public boolean analyzeJar(Analyzer analyzer) throws Exception {
Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.DSANNOTATIONS));
if (header.size() == 0)
return false;
Instructions instructions = new Instructions(header);
Collection<Clazz> list = analyzer.getClassspace().values();
String sc = analyzer.getProperty(Constants.SERVICE_COMPONENT);
List<String> names = new ArrayList<String>();
if (sc != null && sc.trim().length() > 0)
names.add(sc);
for (Clazz c: list) {
for (Instruction instruction : instructions.keySet()) {
if (instruction.matches(c.getFQN())) {
if (instruction.isNegated())
break;
ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
if (definition != null) {
definition.sortReferences();
definition.prepare(analyzer);
String name = "OSGI-INF/" + analyzer.validResourcePath(definition.name, "Invalid component name") + ".xml";
names.add(name);
analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
}
}
}
}
sc = Processor.append(names.toArray(new String[names.size()]));
analyzer.setProperty(Constants.SERVICE_COMPONENT, sc);
return false;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(definition.id, "Invalid resource name")
+ ".xml";
analyzer.getJar()
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(definition.id, "Invalid resource name")
+ ".xml";
analyzer.getJar()
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
definition.prepare(analyzer);
String name = "OSGI-INF/" + analyzer.validResourcePath(definition.name, "Invalid component name")
+ ".xml";
names.add(name);
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
definition.prepare(analyzer);
String name = "OSGI-INF/" + analyzer.validResourcePath(definition.name, "Invalid component name")
+ ".xml";
names.add(name);
代码示例来源:origin: biz.aQute.bnd/bndlib
definition.prepare(analyzer);
classToOCDMap.put(c.getClassName().getBinary(), definition);
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(definition.id, "Invalid resource name") + ".xml";
analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
if (designate != null) {
designate.prepare(analyzer);
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(c.getFQN(), "Invalid resource name") + ".xml";
analyzer.getJar().putResource(name, new TagResource(designate.getTag()));
代码示例来源:origin: biz.aQute.bnd/bnd
definition.prepare(analyzer);
classToOCDMap.put(c.getClassName().getBinary(), definition);
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(definition.id, "Invalid resource name") + ".xml";
analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
if (designate != null) {
designate.prepare(analyzer);
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(c.getFQN(), "Invalid resource name") + ".xml";
analyzer.getJar().putResource(name, new TagResource(designate.getTag()));
内容来源于网络,如有侵权,请联系作者删除!