Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-01-22 22:48:21 +0000
committerThomas Watson2008-01-22 22:48:21 +0000
commit59c6d137060d64038f305f936a0d6da19484a8f7 (patch)
tree7921d35ebfe8cb2b7701b6955bfffd8f95a9d999 /bundles/org.eclipse.osgi/security/src/org
parent6c455603e5e8fde0eb58c42cb28ac8c2a9af4c70 (diff)
downloadrt.equinox.framework-59c6d137060d64038f305f936a0d6da19484a8f7.tar.gz
rt.equinox.framework-59c6d137060d64038f305f936a0d6da19484a8f7.tar.xz
rt.equinox.framework-59c6d137060d64038f305f936a0d6da19484a8f7.zip
Bug 216196 [sec] Add getStatus support to AuthorizationEngine
Diffstat (limited to 'bundles/org.eclipse.osgi/security/src/org')
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java12
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationEngine.java15
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationStatus.java35
3 files changed, 51 insertions, 11 deletions
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java
index 8785edc86..9370f0f03 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,7 @@ import java.security.cert.CertificateException;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.internal.baseadaptor.DevClassPathHelper;
import org.eclipse.osgi.service.resolver.*;
-import org.eclipse.osgi.service.security.AuthorizationEngine;
-import org.eclipse.osgi.service.security.AuthorizationEvent;
+import org.eclipse.osgi.service.security.*;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignerInfo;
import org.osgi.framework.Bundle;
@@ -99,7 +98,10 @@ public class DefaultAuthorizationEngine extends AuthorizationEngine {
return true;
}
- protected int doGetSeverity() {
- return 0;
+ public int getStatus() {
+ if (0 != systemState.getDisabledBundles().length) {
+ return AuthorizationStatus.ERROR;
+ }
+ return AuthorizationStatus.OK;
}
}
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationEngine.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationEngine.java
index 759f956dc..bb779ce7e 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationEngine.java
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -67,11 +67,14 @@ public abstract class AuthorizationEngine {
*/
protected abstract AuthorizationEvent doAuthorize(SignedContent content, Object context);
- public int getSeverity() {
- return doGetSeverity();
- }
-
- protected abstract int doGetSeverity();
+ /**
+ * Return the current status of the Authorization system.
+ *
+ * @return A value of {@link AuthorizationStatus#OK} or {@link AuthorizationStatus#ERROR}
+ * @see AuthorizationStatus#OK
+ * @see AuthorizationStatus#ERROR
+ */
+ abstract public int getStatus();
class AuthEventDispatcher implements EventDispatcher {
public void dispatchEvent(Object eventListener, Object listenerObject, int eventAction, Object eventObject) {
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationStatus.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationStatus.java
new file mode 100644
index 000000000..bb55e007d
--- /dev/null
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/service/security/AuthorizationStatus.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osgi.service.security;
+
+/**
+ * Constants for status codes in the Authorization engine.
+ * <p>
+ * This class is not intended to be extended by clients.
+ * </p>
+ *
+ * @since 3.4
+ */
+public class AuthorizationStatus {
+
+ /**
+ * This code means that the system is functioning normally - no bundles
+ * are currently experiencing authorization problems.
+ */
+ public static final int OK = 0x00;
+
+ /**
+ * This code means that there are bundles in the system that are being
+ * disabled due to authorization constraints.
+ */
+ public static final int ERROR = 0x01;
+
+}

Back to the top