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;
}
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;
}
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;
}
Aggregations