Permalink
Browse files

KARAF-1782 - Solve serialization issues in blueprint plugin

Signed-off-by: Lukasz Dywicki <luke@code-house.org>

git-svn-id: https://svn.apache.org/repos/asf/karaf/webconsole/trunk@1379101 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 5a48032 commit 83b4919f4a421ab6fca6ffa9dc8cd5114dee1c77 @splatch splatch committed Aug 30, 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.karaf.webconsole.osgi.blueprint.bundle;
+
+import static org.apache.wicket.model.Model.of;
+
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.osgi.framework.Bundle;
+
+/**
+ * Column representing items blueprint state.
+ */
+class BlueprintColumn extends AbstractColumn<Bundle> {
+
+ private static final long serialVersionUID = 1L;
+
+ public BlueprintColumn() {
+ super(of("Blueprint"));
+ }
+
+ public void populateItem(Item<ICellPopulator<Bundle>> cellItem, String componentId, IModel<Bundle> rowModel) {
+ cellItem.add(new BlueprintPanel(componentId, rowModel));
+ }
+}
@@ -16,42 +16,17 @@
*/
package org.apache.karaf.webconsole.osgi.blueprint.bundle;
-import org.apache.karaf.webconsole.osgi.blueprint.BlueprintState;
-import org.apache.karaf.webconsole.osgi.blueprint.IBlueprintBundleStateTracker;
import org.apache.karaf.webconsole.osgi.core.spi.IColumnProvider;
-import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
import org.osgi.framework.Bundle;
/**
* Provides blueprint column in bundles view.
*/
public class BlueprintColumnProvider implements IColumnProvider {
- private IBlueprintBundleStateTracker tracker;
-
- public BlueprintColumnProvider(IBlueprintBundleStateTracker tracker) {
- this.tracker = tracker;
- }
-
- @SuppressWarnings("serial")
public IColumn<Bundle> getColumn() {
- return new AbstractColumn<Bundle>(Model.of("Blueprint")) {
- public void populateItem(Item<ICellPopulator<Bundle>> cellItem, String componentId, IModel<Bundle> rowModel) {
- Bundle bundle = rowModel.getObject();
- BlueprintState state = tracker.getState(bundle);
- if (state != null) {
- cellItem.add(new Label(componentId, state.name()));
- } else {
- cellItem.add(new Label(componentId));
- }
- }
- };
+ return new BlueprintColumn();
}
}
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.karaf.webconsole.osgi.blueprint.bundle;
+
+import org.apache.karaf.webconsole.osgi.blueprint.BlueprintState;
+import org.apache.karaf.webconsole.osgi.blueprint.IBlueprintBundleStateTracker;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.ops4j.pax.wicket.api.PaxWicketBean;
+import org.osgi.framework.Bundle;
+
+public class BlueprintPanel extends Panel {
+
+ private static final long serialVersionUID = 1L;
+
+ @PaxWicketBean(name = "tracker")
+ private IBlueprintBundleStateTracker tracker;
+
+ public BlueprintPanel(String componentId, IModel<Bundle> model) {
+ super(componentId, model);
+
+ Bundle bundle = model.getObject();
+ BlueprintState state = tracker.getState(bundle);
+ if (state != null) {
+ add(new Label("state", state.name()));
+ } else {
+ add(new Label("state"));
+ }
+ }
+
+}
@@ -66,5 +66,6 @@ public void detach() {
if (reference != null) {
context.ungetService(reference);
}
+ reference = null;
}
-}
+}
@@ -31,29 +31,25 @@
<bean id="provider" class="org.apache.karaf.webconsole.osgi.blueprint.navigation.BlueprintNavigationProvider" />
- <bean id="tracker" class="org.apache.karaf.webconsole.osgi.blueprint.BlueprintBundleStateTracker" />
+ <bean id="trackerBean" class="org.apache.karaf.webconsole.osgi.blueprint.BlueprintBundleStateTracker" />
<service auto-export="interfaces">
- <bean class="org.apache.karaf.webconsole.osgi.blueprint.bundle.BlueprintActionProvider">
- <argument ref="trackerService" />
- </bean>
+ <bean class="org.apache.karaf.webconsole.osgi.blueprint.bundle.BlueprintActionProvider" />
</service>
<service auto-export="interfaces">
- <bean class="org.apache.karaf.webconsole.osgi.blueprint.bundle.BlueprintColumnProvider">
- <argument ref="trackerService" />
- </bean>
+ <bean class="org.apache.karaf.webconsole.osgi.blueprint.bundle.BlueprintColumnProvider" />
</service>
<service auto-export="interfaces">
<bean class="org.apache.karaf.webconsole.osgi.blueprint.bundle.BlueprintDecorationProvider">
- <argument ref="trackerService" />
+ <argument ref="tracker" />
</bean>
</service>
- <service ref="tracker" auto-export="interfaces" />
+ <reference id="tracker" interface="org.apache.karaf.webconsole.osgi.blueprint.IBlueprintBundleStateTracker" availability="optional" />
+
+ <service ref="trackerBean" auto-export="interfaces" />
- <reference id="trackerService" interface="org.apache.karaf.webconsole.osgi.blueprint.IBlueprintBundleStateTracker"
- availability="optional" />
</blueprint>
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<wicket:panel xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
+ <span wicket:id="state" />
+</wicket:panel>

0 comments on commit 83b4919

Please sign in to comment.