/** * Starts managing the given (unmanaged) app, setting the given brooklyn properties on the new * management context. * * @see #startManagement(Entity) * * @deprecated since 0.9.0; entities are automatically managed when created via {@link Entity#addChild(EntitySpec)}, * or with {@link EntityManager#createEntity(EntitySpec)}. For top-level apps, use code like * {@code managementContext.getEntityManager().createEntity(EntitySpec.create(...))}. */ @Deprecated public static ManagementContext startManagement(Application app, BrooklynProperties props) { log.warn("Deprecated use of Entities.startManagement(Application, BrooklynProperties), for app "+app); if (isManaged(app)) { throw new IllegalStateException("Application "+app+" is already managed, so can't set brooklyn properties"); } ManagementContext mgmt = new LocalManagementContext(props); mgmt.getEntityManager().manage(app); return mgmt; }
/** * Starts managing the given (unmanaged) app, using the given management context. * * @see #startManagement(Entity) * * @deprecated since 0.9.0; entities are automatically managed when created with * {@link EntityManager#createEntity(EntitySpec)}. For top-level apps, use code like * {@code managementContext.getEntityManager().createEntity(EntitySpec.create(...))}. */ @Deprecated public static ManagementContext startManagement(Application app, ManagementContext mgmt) { log.warn("Deprecated use of Entities.startManagement(Application, ManagementContext), for app "+app); if (isManaged(app)) { if (app.getManagementContext() == mgmt) { // no-op; app was presumably auto-managed return mgmt; } else { throw new IllegalStateException("Application "+app+" is already managed by "+app.getManagementContext()+", so cannot be managed by "+mgmt); } } mgmt.getEntityManager().manage(app); return mgmt; }
public void attemptLegacyAutodeployment(String effectorName) { synchronized (this) { if (managementContext != null) { log.warn("Autodeployment suggested but not required for " + entity + "." + effectorName); return; } if (entity instanceof Application) { log.warn("Autodeployment with new management context triggered for " + entity + "." + effectorName + " -- will not be supported in future. Explicit manage call required."); if (initialManagementContext != null) { initialManagementContext.getEntityManager().manage(entity); } else { Entities.startManagement(entity); } return; } } if ("start".equals(effectorName)) { Entity e=entity; if (e.getParent()!=null && ((EntityInternal)e.getParent()).getManagementSupport().isDeployed()) { log.warn("Autodeployment in parent's management context triggered for "+entity+"."+effectorName+" -- will not be supported in future. Explicit manage call required."); ((EntityInternal)e.getParent()).getManagementContext().getEntityManager().manage(entity); return; } } log.warn("Autodeployment not available for "+entity+"."+effectorName); }
((EntityInternal)o).getManagementContext().getEntityManager().manage(eum); return true;
EntitySpec<TestApplication> appSpec = EntitySpec.create(TestApplication.class); final TestApplication app = emgr.createEntity(appSpec); emgr.manage(app); EntitySpec<?> latchEntitySpec = EntitySpec.create(EmptySoftwareProcess.class); final Entity entity = app.createAndManageChild(latchEntitySpec);
EntitySpec<TestApplication> appSpec = EntitySpec.create(TestApplication.class); TestApplication app = emgr.createEntity(appSpec); emgr.manage(app); EntitySpec<?> latchEntitySpec = EntitySpec.create(EmptySoftwareProcess.class); Entity entity = app.createAndManageChild(latchEntitySpec);