-
Notifications
You must be signed in to change notification settings - Fork 3
Helpers
Warren Bloomer edited this page Nov 25, 2013
·
5 revisions
MeemDefinition createMeemDefinition(Class<?> meemSpecification);
MeemDefinition createMeemDefinition(Class<?>... wedgeClasses);
MeemDefinition createMeemDefinition(Collection<Class<?>> wedgeClasses);
MeemDefinition createMeemDefinition(String meemTypeIdentifier);
Example
MeemDefinition meemDefinition = MeemDefinitionFactory.spi.create().createMeemDefinition(EmbeddedJettyWedge.class);
This may be used to create Meems
LifeCycleManagerHelper.createTransientMeem(meemDefinition, LifeCycleState.LOADED, new AsyncCallback<Meem>() {
public void result(Meem webServerMeem) {
logger.info("created web server meem");
configureWebServer(webServerMeem); // configure the web server
}
public void exception(Exception e) {
logger.log(Level.INFO, "problem creating web server meem", e);
}
});
Resolves a Meem from a MeemPath
void resolveMeemPath(MeemPath meemPath, AsyncCallback<Meem> callback)
To retrieve Facet interfaces from Meems.
<T extends Facet> void getTarget(Meem meem, String facetName, Class<T> specification, AsyncCallback<T> callback)
Example
ReferenceHelper.getTarget(webServerMeem, "configurationHandler", ConfigurationHandler.class, new AsyncCallback<ConfigurationHandler>() {
public void result(ConfigurationHandler configurationHandler) {
logger.info("!!!! got configuration handler");
ConfigurationIdentifier id = new ConfigurationIdentifier("embeddedJettyWedge", "port");
configurationHandler.valueChanged(id, Integer.valueOf(8888));
makeReady(webServerMeem);
}
public void exception(Exception e) {
logger.log(Level.INFO, "problem getting configuration handler", e);
}
});