55 lines
1.2 KiB
Java
55 lines
1.2 KiB
Java
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.
|
|
* <p>
|
|
* 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<HostingNode> {
|
|
|
|
|
|
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<String> getAllowedContexts() {
|
|
return context.configuration().allowedContexts();
|
|
}
|
|
|
|
|
|
}
|