@Override public String getExtensionPoint() { return targetComponentName.getName() + "--" + extensionPoint; }
public static String formatQualifiedName(ComponentName componentName) { return formatQualifiedName(componentName.getType(), componentName.getName()); }
/** * Read a component from his StreamRef and create a new component (suffixed with `-partial`, and the base component * name aliased) with only matching contributions of the extensionPoints parameter. * * @param ctx RuntimeContext in which the new component will be deployed * @param extensionPoints Set of white listed TargetExtensions * @param component Reference to the original component * @throws IOException Signals that an I/O exception has occurred. */ protected void deployPartialComponent(RuntimeContext ctx, Set<TargetExtensions> extensionPoints, StreamRef component) throws IOException { RegistrationInfo ri = ((DefaultRuntimeContext) ctx).createRegistrationInfo(component); String name = ri.getName().getName() + "-partial"; // Flatten Target Extension Points Set<String> targets = extensionPoints.stream() .map(TargetExtensions::getTargetExtensions) .flatMap(Set::stream) .collect(Collectors.toSet()); String ext = Arrays.stream(ri.getExtensions()) .filter(e -> targets.contains(TargetExtensions.newTargetExtension( e.getTargetComponent().getName(), e.getExtensionPoint()))) .map(Extension::toXML) .collect(joining()); ctx.deploy(new InlineRef(name, String.format("<component name=\"%s\">%s</component>", name, ext))); }
String cname = ri.getName().getName(); Bundle bundle = ri.getContext().getBundle(); BundleInfoImpl binfo = null;
public static ExtensionInfoDocAdapter create(ExtensionInfo xi, CoreSession session, String containerPath) { DocumentModel doc = session.createDocumentModel(TYPE_NAME); String name = computeDocumentName("contrib-" + xi.getId()); String targetPath = new Path(containerPath).append(name).toString(); boolean exist = false; if (session.exists(new PathRef(targetPath))) { exist = true; doc = session.getDocument(new PathRef(targetPath)); } doc.setPathInfo(containerPath, name); doc.setPropertyValue("dc:title", xi.getId()); doc.setPropertyValue(PROP_CONTRIB_ID, xi.getId()); doc.setPropertyValue(PROP_DOC, xi.getDocumentation()); doc.setPropertyValue(PROP_EXTENSION_POINT, xi.getExtensionPoint()); doc.setPropertyValue(PROP_TARGET_COMPONENT_NAME, xi.getTargetComponentName().getName()); Blob xmlBlob = Blobs.createBlob(xi.getXml(), "text/xml", null, "contrib.xml"); // !!!!! doc.setPropertyValue("file:content", (Serializable) xmlBlob); if (exist) { doc = session.saveDocument(doc); } else { doc = session.createDocument(doc); } return new ExtensionInfoDocAdapter(doc); }