Author: [email protected]
Date: Tue Oct 4 15:56:28 2011
New Revision: 1436
Log:
[AMDATUAUTH-96] Fixed whiteboard registration of gadgets
Added:
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetDefinition.java
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetDefinition.java
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetDefinition.java
Modified:
trunk/amdatu-auth/login-gadget/pom.xml
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/osgi/Activator.java
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetImpl.java
trunk/amdatu-auth/oauth-example/pom.xml
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/osgi/Activator.java
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetsRegistrationServiceImpl.java
trunk/amdatu-auth/useradmin-gadget/pom.xml
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/osgi/Activator.java
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetImpl.java
Modified: trunk/amdatu-auth/login-gadget/pom.xml
==============================================================================
--- trunk/amdatu-auth/login-gadget/pom.xml (original)
+++ trunk/amdatu-auth/login-gadget/pom.xml Tue Oct 4 15:56:28 2011
@@ -58,6 +58,11 @@
<type>bundle</type>
</dependency>
<dependency>
+ <groupId>org.amdatu.core</groupId>
+ <artifactId>org.amdatu.core.tenant</artifactId>
+ <type>bundle</type>
+ </dependency>
+ <dependency>
<groupId>org.amdatu.opensocial</groupId>
<artifactId>org.amdatu.opensocial.shindig</artifactId>
<version>${amdatu.opensocial.version}</version>
Modified:
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/osgi/Activator.java
==============================================================================
---
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/osgi/Activator.java
(original)
+++
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/osgi/Activator.java
Tue Oct 4 15:56:28 2011
@@ -15,21 +15,23 @@
*/
package org.amdatu.auth.login.gadget.osgi;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.amdatu.auth.login.gadget.service.LoginGadgetImpl;
-import org.amdatu.auth.login.service.LoginService;
-import org.amdatu.opensocial.gadgetmanagement.GadgetManagement;
-import org.amdatu.web.dispatcher.DispatcherService;
-import org.amdatu.web.httpcontext.ResourceProvider;
-import org.amdatu.web.jsp.JspSupport;
-import org.amdatu.web.resource.ResourceSupport;
-import org.apache.felix.dm.DependencyActivatorBase;
-import org.apache.felix.dm.DependencyManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
-import org.osgi.service.useradmin.UserAdmin;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.amdatu.auth.login.gadget.service.LoginGadgetDefinition;
+import org.amdatu.auth.login.gadget.service.LoginGadgetImpl;
+import org.amdatu.auth.login.service.LoginService;
+import org.amdatu.core.tenant.Tenant;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinitionProvider;
+import org.amdatu.web.dispatcher.DispatcherService;
+import org.amdatu.web.httpcontext.ResourceProvider;
+import org.amdatu.web.jsp.JspSupport;
+import org.amdatu.web.resource.ResourceSupport;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+import org.osgi.service.useradmin.UserAdmin;
/**
* This is the OSGi activator for this gadget bundle.
@@ -69,8 +71,12 @@
.setImplementation(LoginGadgetImpl.class)
.add(createServiceDependency().setService(LogService.class).setRequired(true))
.add(createServiceDependency().setService(UserAdmin.class).setRequired(true))
-
.add(createServiceDependency().setService(GadgetManagement.class).setRequired(true))
-
.add(createServiceDependency().setService(LoginService.class).setRequired(true)));
+
.add(createServiceDependency().setService(LoginService.class).setRequired(true)));
+
+ // Register a login gadget definition for each tenant
+ manager.add(createAdapterService(Tenant.class, null)
+ .setInterface(GadgetDefinitionProvider.class.getName(), null)
+ .setImplementation(LoginGadgetDefinition.class));
}
@Override
Added:
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetDefinition.java
==============================================================================
--- (empty file)
+++
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetDefinition.java
Tue Oct 4 15:56:28 2011
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.amdatu.auth.login.gadget.service;
+
+import org.amdatu.auth.login.gadget.osgi.Activator;
+import org.amdatu.opensocial.gadgetmanagement.GadgetCategory;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinitionProvider;
+
+public class LoginGadgetDefinition implements GadgetDefinitionProvider {
+ public GadgetDefinition[] getDefinitions() {
+ return new GadgetDefinition[] {new GadgetDefinition(
+ Activator.ALIAS + "/jsp/LoginGadget.jsp", // gadget URL
+ GadgetCategory.AMDATU_PLATFORM, // category
+ true)}; // default visible on the dashboard
+ }
+}
Modified:
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetImpl.java
==============================================================================
---
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetImpl.java
(original)
+++
trunk/amdatu-auth/login-gadget/src/main/java/org/amdatu/auth/login/gadget/service/LoginGadgetImpl.java
Tue Oct 4 15:56:28 2011
@@ -15,15 +15,12 @@
*/
package org.amdatu.auth.login.gadget.service;
-import java.net.URL;
-
-import org.amdatu.auth.login.gadget.osgi.Activator;
-import org.amdatu.opensocial.gadgetmanagement.GadgetCategory;
-import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
-import org.amdatu.opensocial.gadgetmanagement.GadgetManagement;
-import org.amdatu.web.httpcontext.ResourceProvider;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
+import java.net.URL;
+
+import org.amdatu.auth.login.gadget.osgi.Activator;
+import org.amdatu.web.httpcontext.ResourceProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
/**
* This service provides the login gadget.
@@ -35,21 +32,11 @@
// Service dependencies, injected by the Felix dependency manager
private volatile LogService m_logService;
private volatile BundleContext m_bundleContext;
- private volatile GadgetManagement m_gadgetManagement;
/**
* The init() method is invoked by the Felix dependency manager.
*/
public void start() {
-
- // Register the gadget with the Gadget management service. Note that
we can do this as
- // many times as we want, since the gadget URL is the unique identifier
- String gadgetSpecUrl = Activator.ALIAS + "/jsp/LoginGadget.jsp";
- GadgetDefinition gadgetDef = new GadgetDefinition(gadgetSpecUrl,
GadgetCategory.AMDATU_PLATFORM, true);
- gadgetDef.setRank(0);
- m_gadgetManagement.addGadget(gadgetDef);
- m_logService.log(LogService.LOG_INFO, "Login gadget registered on URL
'" + gadgetSpecUrl + "'");
-
m_logService.log(LogService.LOG_INFO, getClass().getName() + " service
started");
}
Modified: trunk/amdatu-auth/oauth-example/pom.xml
==============================================================================
--- trunk/amdatu-auth/oauth-example/pom.xml (original)
+++ trunk/amdatu-auth/oauth-example/pom.xml Tue Oct 4 15:56:28 2011
@@ -24,8 +24,8 @@
</parent>
<artifactId>org.amdatu.auth.oauth.example</artifactId>
<packaging>bundle</packaging>
- <name>Amdatu Auth - oAuth example</name>
- <description>Provides example services and gadgets using oAuth
authentication</description>
+ <name>Amdatu Auth - OAuth example</name>
+ <description>Provides example services and gadgets using OAuth
authentication</description>
<properties>
<amdatu.opensocial.version>0.2.0-SNAPSHOT</amdatu.opensocial.version>
@@ -33,6 +33,11 @@
<dependencies>
<dependency>
+ <groupId>org.amdatu.core</groupId>
+ <artifactId>org.amdatu.core.tenant</artifactId>
+ <type>bundle</type>
+ </dependency>
+ <dependency>
<groupId>org.amdatu.web</groupId>
<artifactId>org.amdatu.web.dispatcher</artifactId>
<type>bundle</type>
Modified:
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/osgi/Activator.java
==============================================================================
---
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/osgi/Activator.java
(original)
+++
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/osgi/Activator.java
Tue Oct 4 15:56:28 2011
@@ -19,12 +19,13 @@
import java.util.Hashtable;
import org.amdatu.auth.example.oauth.service.DummyInterface;
+import org.amdatu.auth.example.oauth.service.OAuthGadgetDefinition;
import
org.amdatu.auth.example.oauth.service.OAuthGadgetsRegistrationServiceImpl;
import org.amdatu.auth.example.oauth.service.OAuthProtectedResource;
import org.amdatu.auth.oauth.consumerregistry.OAuthServiceConsumerRegistry;
-import org.amdatu.auth.oauth.server.OAuthTokenProvider;
+import org.amdatu.core.tenant.Tenant;
import org.amdatu.libraries.utilities.osgi.ServiceDependentActivator;
-import org.amdatu.opensocial.gadgetmanagement.GadgetManagement;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinitionProvider;
import org.amdatu.web.dispatcher.DispatcherService;
import org.amdatu.web.httpcontext.ResourceProvider;
import org.amdatu.web.jsp.JspSupport;
@@ -64,15 +65,19 @@
manager.add(createComponent()
.setInterface(ResourceProvider.class.getName(), properties)
.setImplementation(OAuthGadgetsRegistrationServiceImpl.class)
-
.add(createServiceDependency().setService(GadgetManagement.class).setRequired(true))
.add(createServiceDependency().setService(OAuthServiceConsumerRegistry.class).setRequired(true))
.add(createServiceDependency().setService(HttpService.class).setRequired(true))
.add(createServiceDependency().setService(LogService.class).setRequired(false)));
- manager.add(createComponent()
+ manager.add(createAdapterService(Tenant.class, null)
.setInterface(DummyInterface.class.getName(), null)
- .setImplementation(OAuthProtectedResource.class)
-
.add(createServiceDependency().setService(OAuthTokenProvider.class).setRequired(true)));
+ .setImplementation(OAuthProtectedResource.class));
+
+ // Register a OAuth gadget definition for each tenant
+ manager.add(createAdapterService(Tenant.class, null)
+ .setInterface(GadgetDefinitionProvider.class.getName(), null)
+ .setImplementation(OAuthGadgetDefinition.class)
+
.add(createServiceDependency().setService(LogService.class).setRequired(false)));
}
@Override
Added:
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetDefinition.java
==============================================================================
--- (empty file)
+++
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetDefinition.java
Tue Oct 4 15:56:28 2011
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.amdatu.auth.example.oauth.service;
+
+import static
org.amdatu.auth.example.oauth.service.OAuthGadgetsRegistrationServiceImpl.CONSUMER_CALLBACK_URL;
+import static
org.amdatu.auth.example.oauth.service.OAuthGadgetsRegistrationServiceImpl.CONSUMER_KEY;
+import static
org.amdatu.auth.example.oauth.service.OAuthGadgetsRegistrationServiceImpl.CONSUMER_SECRET;
+
+import org.amdatu.auth.example.oauth.osgi.Activator;
+import org.amdatu.core.tenant.Tenant;
+import org.amdatu.opensocial.gadgetmanagement.GadgetCategory;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinitionProvider;
+import org.osgi.service.log.LogService;
+
+public class OAuthGadgetDefinition implements GadgetDefinitionProvider {
+ // Tenant unaware service dependencies
+ private volatile Tenant m_tenant;
+ private volatile LogService m_logService;
+
+ // Category to add this gadget to
+ private final static GadgetCategory AMDATU_EXAMPLE_CATEGORY = new
GadgetCategory("amdatu_examples", "Amdatu Examples");
+
+ // Service name of the gadget
+ private final static String SERVICE_NAME = "oauth-example";
+
+ public void start() {
+ m_logService.log(LogService.LOG_INFO,
+ "Service '" + getClass().getName() + "' started for tenant '" +
m_tenant.getId() + "'");
+ }
+
+ public GadgetDefinition[] getDefinitions() {
+ String gadgetUrl = Activator.ALIAS + "/jsp/3leggedOAuthGadget.jspf";
+ GadgetDefinition gadgetDef = new GadgetDefinition(gadgetUrl,
AMDATU_EXAMPLE_CATEGORY, false);
+
+ // Set OAuth parameters
+ gadgetDef.setServiceName(SERVICE_NAME);
+ gadgetDef.setConsumerPublicKey(CONSUMER_KEY);
+ gadgetDef.setConsumerPrivateKey(CONSUMER_SECRET);
+ gadgetDef.setCallbackUrl(CONSUMER_CALLBACK_URL);
+
+ return new GadgetDefinition[] {gadgetDef};
+ }
+}
Modified:
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetsRegistrationServiceImpl.java
==============================================================================
---
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetsRegistrationServiceImpl.java
(original)
+++
trunk/amdatu-auth/oauth-example/src/main/java/org/amdatu/auth/example/oauth/service/OAuthGadgetsRegistrationServiceImpl.java
Tue Oct 4 15:56:28 2011
@@ -24,9 +24,6 @@
import org.amdatu.auth.oauth.api.ConsumerRegistryStorageException;
import org.amdatu.auth.oauth.api.OAuthServiceConsumer;
import org.amdatu.auth.oauth.consumerregistry.OAuthServiceConsumerRegistry;
-import org.amdatu.opensocial.gadgetmanagement.GadgetCategory;
-import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
-import org.amdatu.opensocial.gadgetmanagement.GadgetManagement;
import org.amdatu.web.httpcontext.ResourceProvider;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -37,18 +34,14 @@
* @author ivol
*/
public class OAuthGadgetsRegistrationServiceImpl implements ResourceProvider {
- private final static GadgetCategory AMDATU_EXAMPLE_CATEGORY = new
GadgetCategory("amdatu_examples", "Amdatu Examples");
-
- // oAuth properties of this gadget as service consumer
- private final static String CONSUMER_CALLBACK_URL =
"/gadgets/oauthcallback";
- private final static String CONSUMER_KEY = "example.amdatu.org";
- private final static String CONSUMER_SECRET =
"HDHPBbhBHpoqwuyrvbxkvuBHOBEVxnlIOv";
- private final static String CONSUMER_NAME = "Amdatu example consumer";
- private final static String SERVICE_NAME = "oauth-example";
-
+ // OAuth properties of this gadget as service consumer
+ final static String CONSUMER_CALLBACK_URL = "/gadgets/oauthcallback";
+ final static String CONSUMER_KEY = "example.amdatu.org";
+ final static String CONSUMER_SECRET = "HDHPBbhBHpoqwuyrvbxkvuBHOBEVxnlIOv";
+ final static String CONSUMER_NAME = "Amdatu example consumer";
+
// Service and other dependencies, injected by the OSGi framework
private volatile LogService m_logService;
- private volatile GadgetManagement m_gadgetManagement;
private volatile OAuthServiceConsumerRegistry m_consumerRegistry;
// Instance variables, injected by the OSGi framework
@@ -58,20 +51,6 @@
* The init() method is invoked by the Felix dependency manager.
*/
public void init() {
-
- String gadgetUrl = Activator.ALIAS + "/jsp/3leggedOAuthGadget.jspf";
- GadgetDefinition gadgetDef = new GadgetDefinition(gadgetUrl,
AMDATU_EXAMPLE_CATEGORY, false);
-
- // Set oAuth parameters
- gadgetDef.setServiceName(SERVICE_NAME);
- gadgetDef.setConsumerPublicKey(CONSUMER_KEY);
- gadgetDef.setConsumerPrivateKey(CONSUMER_SECRET);
- gadgetDef.setCallbackUrl(CONSUMER_CALLBACK_URL);
-
- // Ensure that the category exists, before adding the gadget
- m_gadgetManagement.addCategory(AMDATU_EXAMPLE_CATEGORY);
- m_gadgetManagement.addGadget(gadgetDef);
-
// Register the service consumer in our own oAuth server such that our
own oAuth server
// can also handle oAuth of this gadget
registerConsumer();
Modified: trunk/amdatu-auth/useradmin-gadget/pom.xml
==============================================================================
--- trunk/amdatu-auth/useradmin-gadget/pom.xml (original)
+++ trunk/amdatu-auth/useradmin-gadget/pom.xml Tue Oct 4 15:56:28 2011
@@ -53,6 +53,11 @@
<type>bundle</type>
</dependency>
<dependency>
+ <groupId>org.amdatu.core</groupId>
+ <artifactId>org.amdatu.core.tenant</artifactId>
+ <type>bundle</type>
+ </dependency>
+ <dependency>
<groupId>org.amdatu.opensocial</groupId>
<artifactId>org.amdatu.opensocial.shindig</artifactId>
<version>${amdatu.opensocial.version}</version>
Modified:
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/osgi/Activator.java
==============================================================================
---
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/osgi/Activator.java
(original)
+++
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/osgi/Activator.java
Tue Oct 4 15:56:28 2011
@@ -15,19 +15,21 @@
*/
package org.amdatu.auth.useradmin.gadget.osgi;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.amdatu.auth.useradmin.gadget.service.UserAdminGadgetImpl;
-import org.amdatu.opensocial.gadgetmanagement.GadgetManagement;
-import org.amdatu.web.dispatcher.DispatcherService;
-import org.amdatu.web.httpcontext.ResourceProvider;
-import org.amdatu.web.jsp.JspSupport;
-import org.amdatu.web.resource.ResourceSupport;
-import org.apache.felix.dm.DependencyActivatorBase;
-import org.apache.felix.dm.DependencyManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.amdatu.auth.useradmin.gadget.service.UserAdminGadgetDefinition;
+import org.amdatu.auth.useradmin.gadget.service.UserAdminGadgetImpl;
+import org.amdatu.core.tenant.Tenant;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinitionProvider;
+import org.amdatu.web.dispatcher.DispatcherService;
+import org.amdatu.web.httpcontext.ResourceProvider;
+import org.amdatu.web.jsp.JspSupport;
+import org.amdatu.web.resource.ResourceSupport;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
/**
* This is the OSGi activator for this gadget bundle.
@@ -65,8 +67,12 @@
manager.add(createComponent().setInterface(ResourceProvider.class.getName(),
properties)
.setImplementation(UserAdminGadgetImpl.class)
-
.add(createServiceDependency().setService(LogService.class).setRequired(true))
-
.add(createServiceDependency().setService(GadgetManagement.class).setRequired(true)));
+
.add(createServiceDependency().setService(LogService.class).setRequired(true)));
+
+ // Register a user admin gadget definition for each tenant
+ manager.add(createAdapterService(Tenant.class, null)
+ .setInterface(GadgetDefinitionProvider.class.getName(), null)
+ .setImplementation(UserAdminGadgetDefinition.class));
}
@Override
Added:
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetDefinition.java
==============================================================================
--- (empty file)
+++
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetDefinition.java
Tue Oct 4 15:56:28 2011
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 2011 The Amdatu Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.amdatu.auth.useradmin.gadget.service;
+
+import org.amdatu.auth.useradmin.gadget.osgi.Activator;
+import org.amdatu.opensocial.gadgetmanagement.GadgetCategory;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
+import org.amdatu.opensocial.gadgetmanagement.GadgetDefinitionProvider;
+
+public class UserAdminGadgetDefinition implements GadgetDefinitionProvider {
+ public GadgetDefinition[] getDefinitions() {
+ return new GadgetDefinition[] {new GadgetDefinition(
+ Activator.ALIAS + "/jsp/UserAdminGadget.jsp", // gadget URL
+ GadgetCategory.AMDATU_PLATFORM, // category
+ false)}; // default not visible on the dashboard
+ }
+}
Modified:
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetImpl.java
==============================================================================
---
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetImpl.java
(original)
+++
trunk/amdatu-auth/useradmin-gadget/src/main/java/org/amdatu/auth/useradmin/gadget/service/UserAdminGadgetImpl.java
Tue Oct 4 15:56:28 2011
@@ -15,15 +15,12 @@
*/
package org.amdatu.auth.useradmin.gadget.service;
-import java.net.URL;
-
-import org.amdatu.auth.useradmin.gadget.osgi.Activator;
-import org.amdatu.opensocial.gadgetmanagement.GadgetCategory;
-import org.amdatu.opensocial.gadgetmanagement.GadgetDefinition;
-import org.amdatu.opensocial.gadgetmanagement.GadgetManagement;
-import org.amdatu.web.httpcontext.ResourceProvider;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
+import java.net.URL;
+
+import org.amdatu.auth.useradmin.gadget.osgi.Activator;
+import org.amdatu.web.httpcontext.ResourceProvider;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
/**
* This service provides the UserAdmin gadget.
@@ -31,25 +28,14 @@
* @author ivol
*/
public class UserAdminGadgetImpl implements ResourceProvider {
-
// Service dependencies, injected by the Felix dependency manager
private volatile LogService m_logService;
private volatile BundleContext m_bundleContext;
- private volatile GadgetManagement m_gadgetManagement;
/**
* The init() method is invoked by the Felix dependency manager.
*/
public void start() {
-
- // Register the gadget with the Gadget management service. Note that
we can do this as
- // many times as we want, since the gadget URL is the unique identifier
- String gadgetSpecUrl = Activator.ALIAS + "/jsp/UserAdminGadget.jsp";
- GadgetDefinition gadgetDef = new GadgetDefinition(gadgetSpecUrl,
GadgetCategory.AMDATU_PLATFORM, false);
- gadgetDef.setRank(0);
- m_gadgetManagement.addGadget(gadgetDef);
- m_logService.log(LogService.LOG_INFO, "Login gadget registered on URL
'" + gadgetSpecUrl + "'");
-
m_logService.log(LogService.LOG_INFO, getClass().getName() + " service
started");
}
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits