Search in sources :

Example 1 with Extension

use of hudson.Extension in project hudson-2.x by hudson.

the class ZFSInstaller method init.

@Extension
public static AdministrativeMonitor init() {
    String migrationTarget = System.getProperty(ZFSInstaller.class.getName() + ".migrate");
    if (migrationTarget != null) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        StreamTaskListener listener = new StreamTaskListener(new ForkOutputStream(System.out, out));
        try {
            if (migrate(listener, migrationTarget)) {
                // completed successfully
                return new MigrationCompleteNotice();
            }
        } catch (Exception e) {
            // if we let any exception from here, it will prevent Hudson from starting.
            e.printStackTrace(listener.error("Migration failed"));
        }
        // migration failed
        return new MigrationFailedNotice(out);
    }
    // install the monitor if applicable
    ZFSInstaller zi = new ZFSInstaller();
    if (zi.isActivated())
        return zi;
    return null;
}
Also used : ForkOutputStream(hudson.util.ForkOutputStream) StreamTaskListener(hudson.util.StreamTaskListener) ByteArrayOutputStream(org.apache.commons.io.output.ByteArrayOutputStream) ServletException(javax.servlet.ServletException) ZFSException(org.jvnet.solaris.libzfs.ZFSException) IOException(java.io.IOException) Extension(hudson.Extension)

Example 2 with Extension

use of hudson.Extension in project hudson-2.x by hudson.

the class SmoothieComponent method priorityOf.

public static Double priorityOf(final Class<?> type) {
    if (type != null) {
        Extension extension = type.getAnnotation(Extension.class);
        if (extension != null) {
            return Double.valueOf(extension.ordinal());
        }
        ExtensionQualifier qualifier = type.getAnnotation(ExtensionQualifier.class);
        if (qualifier != null) {
            return Double.valueOf(qualifier.extension().ordinal());
        }
        Priority priority = type.getAnnotation(Priority.class);
        if (priority != null) {
            return Double.valueOf(priority.value());
        }
    }
    return null;
}
Also used : Extension(hudson.Extension) Priority(org.hudsonci.inject.Priority)

Example 3 with Extension

use of hudson.Extension in project hudson-2.x by hudson.

the class SmoothieComponent method isOptional.

public static Boolean isOptional(final Class<?> type) {
    if (type != null) {
        Extension extension = type.getAnnotation(Extension.class);
        if (extension != null) {
            return Boolean.valueOf(extension.optional());
        }
        ExtensionQualifier qualifier = type.getAnnotation(ExtensionQualifier.class);
        if (qualifier != null) {
            return Boolean.valueOf(qualifier.extension().optional());
        }
    }
    return null;
}
Also used : Extension(hudson.Extension)

Aggregations

Extension (hudson.Extension)3 ForkOutputStream (hudson.util.ForkOutputStream)1 StreamTaskListener (hudson.util.StreamTaskListener)1 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)1 Priority (org.hudsonci.inject.Priority)1 ZFSException (org.jvnet.solaris.libzfs.ZFSException)1