本文整理汇总了Java中org.sonatype.nexus.repository.Facet类的典型用法代码示例。如果您正苦于以下问题:Java Facet类的具体用法?Java Facet怎么用?Java Facet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Facet类属于org.sonatype.nexus.repository包,在下文中一共展示了Facet类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Transitions(from = NEW, to = INITIALISED)
public void init(final Configuration configuration) throws Exception {
this.configuration = checkNotNull(configuration);
this.name = configuration.getRepositoryName();
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets) {
try {
log.debug("Initializing facet: {}", facet);
facet.init();
}
catch (Throwable t) {
log.error("Failed to initialize facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to initialize facets");
}
示例2: update
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Guarded(by = STOPPED)
public void update(final Configuration configuration) throws Exception {
checkNotNull(configuration);
// Ensure configuration sanity
validate(configuration);
this.configuration = configuration;
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets) {
try {
log.debug("Updating facet: {}", facet);
facet.update();
}
catch (Throwable t) {
log.error("Failed to update facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to update facets");
}
示例3: start
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Transitions(from = {INITIALISED, STOPPED}, to = STARTED)
public void start() throws Exception {
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets) {
try {
log.debug("Starting facet: {}", facet);
facet.start();
}
catch (Throwable t) {
log.error("Failed to start facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to start facets");
eventManager.post(new RepositoryStartedEvent(this));
}
示例4: stop
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Transitions(from = STARTED, to = STOPPED)
public void stop() throws Exception {
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets.reverse()) {
try {
log.debug("Stopping facet: {}", facet);
facet.stop();
}
catch (Throwable t) {
log.error("Failed to stop facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to stop facets");
eventManager.post(new RepositoryStoppedEvent(this));
}
示例5: delete
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Transitions(from = STOPPED, to = DELETED)
public void delete() throws Exception {
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets.reverse()) {
try {
log.debug("Deleting facet: {}", facet);
facet.delete();
}
catch (Throwable t) {
log.error("Failed to delete facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to delete facets");
}
示例6: destroy
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Transitions(to = DESTROYED)
public void destroy() throws Exception {
if (states.is(STARTED)) {
stop();
}
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets.reverse()) {
try {
log.debug("Destroying facet: {}", facet);
facet.destroy();
}
catch (Throwable t) {
log.error("Failed to destroy facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to destroy facets");
facets.clear();
configuration = null;
eventManager.post(new RepositoryDestroyedEvent(this));
}
示例7: exposedTypes
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
/**
* Returns list of all types of given root type which implement {@link Facet}
* and are marked with {@link Facet.Exposed}.
*/
@SuppressWarnings("unchecked")
private List<Class<? extends Facet>> exposedTypes(final Class<? extends Facet> root) {
List<Class<? extends Facet>> exposed = Lists.newArrayList();
for (Class<?> type : TypeToken.of(root).getTypes().rawTypes()) {
if (Facet.class.isAssignableFrom(type)) {
for (Annotation annotation : type.getDeclaredAnnotations()) {
if (annotation.annotationType() == Facet.Exposed.class) {
exposed.add((Class<? extends Facet>) type);
}
}
}
}
return exposed;
}
示例8: validate
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
public void validate(final Configuration configuration) throws Exception {
checkNotNull(configuration);
Set<ConstraintViolation<?>> violations = new HashSet<>();
MultipleFailures failures = new MultipleFailures();
for (Facet facet : facets) {
log.debug("Validating facet: {}", facet);
try {
facet.validate(configuration);
}
catch (ConstraintViolationException e) {
log.debug("Facet validation produced violations: {}", facet, e);
violations.addAll(e.getConstraintViolations());
}
catch (Throwable t) {
log.error("Failed to validate facet: {}", facet, t);
failures.add(t);
}
}
failures.maybePropagate("Failed to validate facets");
if (!violations.isEmpty()) {
throw new ConstraintViolationException(violations);
}
}
示例9: attach
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Guarded(by = NEW)
public void attach(final Facet facet) throws Exception {
checkNotNull(facet);
log.debug("Attaching facet: {}", facet);
facet.attach(this);
facets.add(facet);
}
示例10: get
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
/**
* Get a facet instance by exposed type.
*/
@SuppressWarnings("unchecked")
@Nullable
public <T extends Facet> T get(final Class<T> type) {
checkNotNull(type);
return (T) exposed.get(type);
}
示例11: optionalFacet
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
@Override
@Nonnull
public <T extends Facet> Optional<T> optionalFacet(final Class<T> type) {
return Optional.ofNullable(facets.get(type));
}
示例12: iterator
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
/**
* List all facet instances.
*/
@Override
public Iterator<Facet> iterator() {
return Iterators.unmodifiableIterator(facets.iterator());
}
示例13: reverse
import org.sonatype.nexus.repository.Facet; //导入依赖的package包/类
/**
* Returns reversed list of all facet instances.
*/
public Iterable<Facet> reverse() {
return ImmutableList.copyOf(facets).reverse();
}