Hi, i'm going to create a CompositeHandler with the following interface: public interface CompositeHandler { /* FIXME: This can be added to a a Composite Definition */ void addComponent(MetaComponent componentDefinition, Composite composite); void removeComponent(MetaComponent componentDefinition, Composite composite); }
Where metacomponent is a Interface: I ask you if i can add a composite handler to a composite interface or violates some assembly specs. So the interface it will be.. public interface CompositeHandler { /* FIXME: This can be added to a a Composite Definition */ void addComponent(MetaComponent componentDefinition); void removeComponent(MetaComponent componentDefinition); } and in the composite definition i have CompositeHandler getCompositeHandler(): The use case is the following, suppose that you have a composite and you want add a component, which it has its class in the current composite contribution. Suppose that you have an workpool.MyWorker class and you want to replicate in a new component. In this way you can define: public class MetaWorkerComponent implements MetaComponent { private String CMP_DEFINITION = "<component name=\"$NAME\">\n" + "<implementation.java class=\"$CLASS\"/>"+ "<property name=\"workerName\">$WNAME</property>"+ "<service name=\"WorkerService\">"+ "<binding.sca uri=\"$HOSTNAME/$NAME\"/>"+ "</service></component>"; private String componentName; private String workerName; private String className; public void setComponentName(String name) { CMP_DEFINITION = CMP_DEFINITION.replaceAll("$NAME", name); } public void setWorkerName(String name) { CMP_DEFINITION = CMP_DEFINITION.replaceFirst("$WNAME", name); } public void setWorkerClass(String javaClass) { CMP_DEFINITION = CMP_DEFINITION.replaceFirst("$CLASS", javaClass); } public void setWorkerHost(URI uri) { CMP_DEFINITION = CMP_DEFINITION.replaceFirst("$HOSTNAME", uri.toString()); } public XMLStreamReader build() throws Exception { XMLInputFactory factory = XMLInputFactory.newInstance(); return factory.createXMLStreamReader(new StringReader(CMP_DEFINITION)); } public String getComponentName() { return this.getName(); } } Or something similar, get from the node your preferred composite, and add this component definition as in the following example: Composite composite = node.getComposite("Workpool"); CompositeHandler handler = composite.getHandler(); MetaWorkerComponent component = new MetaWorkerComponent(); component.setName(...)... snip..various things.. handler.addComponent(component); This addComponent, parse the definition, wire, and add it to the component. What do you think about? Cheers, Giorgio. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]