package org.gcube.smartgears.handlers.container.lifecycle; import java.util.List; import java.util.Set; import org.gcube.common.resources.gcore.HostingNode; import org.gcube.smartgears.configuration.Mode; import org.gcube.smartgears.context.container.ContainerContext; import org.gcube.smartgears.handlers.AbstractProfilePublisher; import org.gcube.smartgears.handlers.ProfileEvents; /** * Publishes the resource profile of the container. *

* Distinguishes publication in new scopes ({@link #addTo(List)} from publication updates in existing scopes ({@link #update(List)}. * * @author Fabio Simeoni * */ public class ContainerPublisher extends AbstractProfilePublisher { private final ContainerContext context; public ContainerPublisher(ContainerContext context) { super(); this.context = context; } protected void sharePublished(HostingNode profile) { context.events().fire(profile,ProfileEvents.published); } @Override protected HostingNode getProfile() { return context.profile(); } @Override protected boolean isRoot() { return context.configuration().mode()!=Mode.root; } @Override protected Set getAllowedContexts() { return context.configuration().allowedContexts(); } }