You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ld...@apache.org on 2012/02/20 08:41:10 UTC
svn commit: r1291139 [1/2] - in /karaf/webconsole/trunk/osgi:
blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/details/
blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/
blueprint/src/main/resources/org/apache/k...
Author: ldywicki
Date: Mon Feb 20 07:41:08 2012
New Revision: 1291139
URL: http://svn.apache.org/viewvc?rev=1291139&view=rev
Log:
Packages page, services page. Other small improvements in submodules.
Added:
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/BundlePanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/SinglePackagePage.java
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/PackagePage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/ExportPackageModel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackageDataProvider.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackagePage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceDataProvider.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceTable.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ImportServiceDataProvider.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ImportServiceTable.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ObjectClassColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ObjectClassPanel.java
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ServiceConsumerColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ServiceConsumerPanel.java
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ServicePropertyColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ServiceProviderColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/column/ServiceProviderPanel.java
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/BundlePanel.html
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/pkg/list/
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/pkg/list/PackagePage.html
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/event/src/main/resources/org/apache/karaf/webconsole/osgi/event/EventsPage.html
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/service/column/
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/service/column/ObjectClassPanel.html
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/event/src/main/resources/org/apache/karaf/webconsole/osgi/event/EventsPage.html
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/service/column/ServiceConsumerPanel.html
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/event/src/main/resources/org/apache/karaf/webconsole/osgi/event/EventsPage.html
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/service/column/ServiceProviderPanel.html
- copied, changed from r1291138, karaf/webconsole/trunk/osgi/event/src/main/resources/org/apache/karaf/webconsole/osgi/event/EventsPage.html
Removed:
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ExportPackage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ImportPackage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/Package.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/PackagePage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/WicketClause.java
Modified:
karaf/webconsole/trunk/osgi/blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/details/MetadataModel.java
karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/bundle/decorator.css
karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/details/details.js
karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/navigation.css
karaf/webconsole/trunk/osgi/config/src/main/resources/org/apache/karaf/webconsole/osgi/config/configurations.css
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/SingleBundlePage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ManifestUtil.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/navigation/OsgiConsoleTabProvider.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ClauseModel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ExportPackageTable.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderDataProvider.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderTable.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ImportPackageTable.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesPanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesPanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackageColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackagePanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionPanel.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionRangeColumn.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ServiceDetailPage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/list/ServicePage.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/shared/ServiceDataProvider.java
karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/shared/State.java
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/SingleBundlePage.html
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/bundle/list/decoration.css
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/package.properties
karaf/webconsole/trunk/osgi/core/src/main/resources/org/apache/karaf/webconsole/osgi/core/pkg/PackagePage.html
karaf/webconsole/trunk/osgi/event/src/main/resources/org/apache/karaf/webconsole/osgi/event/EventsPage.html
karaf/webconsole/trunk/osgi/scr/src/main/resources/org/apache/karaf/webconsole/osgi/scr/decorator.css
Modified: karaf/webconsole/trunk/osgi/blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/details/MetadataModel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/details/MetadataModel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/details/MetadataModel.java (original)
+++ karaf/webconsole/trunk/osgi/blueprint/src/main/java/org/apache/karaf/webconsole/osgi/blueprint/details/MetadataModel.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.details;
import java.util.ArrayList;
@@ -12,6 +28,8 @@ import org.osgi.service.blueprint.reflec
class MetadataModel extends LoadableDetachableModel<List<ComponentMetadata>> {
+ private static final long serialVersionUID = 1L;
+
private int bundleId;
private BundleContext context;
private ServiceReference reference;
Modified: karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/bundle/decorator.css
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/bundle/decorator.css?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/bundle/decorator.css (original)
+++ karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/bundle/decorator.css Mon Feb 20 07:41:08 2012
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
.blueprint {
background: url("blueprint.gif");
width: 16px;
Modified: karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/details/details.js
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/details/details.js?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/details/details.js (original)
+++ karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/details/details.js Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
$(function() {
var graph = new Graph();
$("tr.component").each(function(key, value) {
Modified: karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/navigation.css
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/navigation.css?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/navigation.css (original)
+++ karaf/webconsole/trunk/osgi/blueprint/src/main/resources/org/apache/karaf/webconsole/osgi/blueprint/navigation.css Mon Feb 20 07:41:08 2012
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
.navbar span.blueprint {
padding-left: 16px;
background: url("bundle/blueprint.gif") no-repeat;
Modified: karaf/webconsole/trunk/osgi/config/src/main/resources/org/apache/karaf/webconsole/osgi/config/configurations.css
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/config/src/main/resources/org/apache/karaf/webconsole/osgi/config/configurations.css?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/config/src/main/resources/org/apache/karaf/webconsole/osgi/config/configurations.css (original)
+++ karaf/webconsole/trunk/osgi/config/src/main/resources/org/apache/karaf/webconsole/osgi/config/configurations.css Mon Feb 20 07:41:08 2012
@@ -1,6 +1,19 @@
-a.remove {
- color: red;
-}
+/*
+ * 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.
+ */
.factory {
font-weight: bolder;
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/BundlePanel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/BundlePanel.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/BundlePanel.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/BundlePanel.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,51 @@
+/*
+ * 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.core.bundle;
+
+import org.apache.karaf.webconsole.osgi.core.shared.State;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.osgi.framework.Bundle;
+
+public class BundlePanel extends Panel {
+
+ private static final long serialVersionUID = 1L;
+
+ public BundlePanel(String id, IModel<Bundle> model) {
+ this(id, model, false);
+ }
+
+ public BundlePanel(String id, IModel<Bundle> model, boolean renderLink) {
+ super(id, new CompoundPropertyModel<Bundle>(model));
+
+ Bundle bundle = model.getObject();
+ add(new Label("bundleId"));
+ add(new Label("state", State.of(bundle.getState()).toString()));
+ add(new Label("symbolicName"));
+ add(new Label("version", new PropertyModel<Bundle>(model, "version.toString")));
+ add(new Label("location"));
+
+ Link<SingleBundlePage> link = SingleBundlePage.createLink("link", bundle);
+ link.setVisible(renderLink);
+ add(link);
+ }
+
+}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/SingleBundlePage.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/SingleBundlePage.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/SingleBundlePage.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/SingleBundlePage.java Mon Feb 20 07:41:08 2012
@@ -21,10 +21,14 @@ import java.io.IOException;
import org.apache.karaf.webconsole.core.security.SecuredPageLink;
import org.apache.karaf.webconsole.osgi.core.pkg.ExportPackageTable;
import org.apache.karaf.webconsole.osgi.core.pkg.ImportPackageTable;
+import org.apache.karaf.webconsole.osgi.core.service.ExportServiceTable;
+import org.apache.karaf.webconsole.osgi.core.service.ImportServiceTable;
+import org.apache.karaf.webconsole.osgi.core.shared.BundleModel;
import org.apache.karaf.webconsole.osgi.core.shared.OsgiPage;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.CompoundPropertyModel;
import org.ops4j.pax.wicket.api.PaxWicketMountPoint;
import org.osgi.framework.Bundle;
@@ -39,68 +43,19 @@ public class SingleBundlePage extends Os
bundleId = params.getLong("bundleId");
Bundle bundle = context.getBundle(bundleId);
- //ExportedPackage[] exported = admin.getExportedPackages(bundle);
+ BundleModel model = new BundleModel(bundle);
+ setDefaultModel(new CompoundPropertyModel<Bundle>(model));
+ add(new BundlePanel("bundle", model));
- add(new Label("name", bundle.getSymbolicName()).setRenderBodyOnly(true));
+ add(new Label("symbolicName").setRenderBodyOnly(true));
+ add(new Label("version").setRenderBodyOnly(true));
-// String object = (String) bundle.getHeaders().get(Constants.IMPORT_PACKAGE);
-// if (object == null) object = "";
add(new ImportPackageTable("imports", bundle));
-
-// add(new ListView<Package>("imports", parser.getImportPackages()) {
-// @Override
-// protected void populateItem(ListItem<Package> item) {
-// Package model = item.getModelObject();
-// String value = model.getName();
-// item.add(new Label("importPackage", value));
-// }
-// });
-
add(new ExportPackageTable("exports", bundle));
-
-// IModel<List<ServiceReference>> model = new LoadableDetachableModel<List<ServiceReference>>() {
-// @Override
-// protected List<ServiceReference> load() {
-// return Arrays.asList(context.getBundle(bundleId).getServicesInUse());
-// }
-// };
-//
-// add(new ListView<ServiceReference>("servicesIn", model) {
-// @Override
-// protected void populateItem(ListItem<ServiceReference> item) {
-// ServiceReference reference = item.getModelObject();
-// item.add(new Label("serviceInUse", Arrays.toString((String[]) reference.getProperty("objectClass"))));
-// }
-// });
-//
-// model = new LoadableDetachableModel<List<ServiceReference>>() {
-// @Override
-// protected List<ServiceReference> load() {
-// return Arrays.asList(context.getBundle(bundleId).getRegisteredServices());
-// }
-// };
-//
-// add(new ListView<ServiceReference>("servicesOut", model) {
-// @Override
-// protected void populateItem(ListItem<ServiceReference> item) {
-// ServiceReference reference = item.getModelObject();
-// item.add(new Label("serviceExported", Arrays.toString((String[]) reference.getProperty("objectClass"))));
-// }
-// });
+ add(new ImportServiceTable("serviceImports", bundle));
+ add(new ExportServiceTable("serviceExports", bundle));
}
-// public static void main(String[] args) throws IOException {
-// Manifest manifest = new Manifest(new FileInputStream("target/classes/META-INF/MANIFEST.MF"));
-// Attributes mainAttributes = manifest.getMainAttributes();
-//
-// Map<String, Map<String, String>> keySet = OSGiHeader.parseHeader(manifest.getMainAttributes().getValue(Constants.IMPORT_PACKAGE));
-// System.out.println(keySet);
-//
-//// for (Entry<Object, Object> string : mainAttributes.entrySet()) {
-//// System.out.println(OSGiHeader.parseHeader("" + string.getValue()));
-//// }
-// }
-
/**
* Create link to page with given bundle.
*
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/bundle/list/DecorationPanel.java Mon Feb 20 07:41:08 2012
@@ -46,6 +46,8 @@ public class DecorationPanel extends Pan
}
add(new ListView<Component>("extensions", components) {
+ private static final long serialVersionUID = 1L;
+
@Override
protected void populateItem(ListItem<Component> item) {
item.add(item.getModelObject());
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ManifestUtil.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ManifestUtil.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ManifestUtil.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/manifest/ManifestUtil.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.manifest;
import java.io.IOException;
@@ -9,6 +25,9 @@ import org.apache.felix.utils.manifest.C
import org.apache.felix.utils.manifest.Parser;
import org.osgi.framework.Bundle;
+/**
+ * Utility class to work with bundle manifests.
+ */
public abstract class ManifestUtil {
public static Clause[] getHeader(Bundle bundle, String header) throws IOException {
@@ -17,8 +36,8 @@ public abstract class ManifestUtil {
public static Clause[] getHeader(InputStream stream, String header) throws IOException {
Manifest manifest = new Manifest(stream);
- Attributes mainAttributes = manifest.getMainAttributes();
- String value = mainAttributes.getValue(header);
+ Attributes mainAttributes = manifest.getMainAttributes();
+ String value = mainAttributes.getValue(header);
return Parser.parseHeader(value);
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/navigation/OsgiConsoleTabProvider.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/navigation/OsgiConsoleTabProvider.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/navigation/OsgiConsoleTabProvider.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/navigation/OsgiConsoleTabProvider.java Mon Feb 20 07:41:08 2012
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.karaf.webconsole.core.navigation.ConsoleTabProvider;
import org.apache.karaf.webconsole.osgi.core.FrameworkPage;
import org.apache.karaf.webconsole.osgi.core.bundle.list.BundlePage;
+import org.apache.karaf.webconsole.osgi.core.pkg.list.PackagePage;
import org.apache.karaf.webconsole.osgi.core.service.list.ServicePage;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
@@ -42,6 +43,7 @@ public class OsgiConsoleTabProvider impl
List<Link<Page>> links = new ArrayList<Link<Page>>();
links.add(createPageLink(componentId, labelId, "Bundles", BundlePage.class));
links.add(createPageLink(componentId, labelId, "Services", ServicePage.class));
+ links.add(createPageLink(componentId, labelId, "Packages", PackagePage.class));
return links;
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ClauseModel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ClauseModel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ClauseModel.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ClauseModel.java Mon Feb 20 07:41:08 2012
@@ -1,18 +1,59 @@
+/*
+ * 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.core.pkg;
+import java.io.IOException;
+
import org.apache.felix.utils.manifest.Clause;
+import org.apache.karaf.webconsole.osgi.core.manifest.ManifestUtil;
import org.apache.wicket.model.LoadableDetachableModel;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ClauseModel extends LoadableDetachableModel<Clause> {
private static final long serialVersionUID = 1L;
+ private Bundle bundle;
+ private String header;
+ private String name;
+
+ private transient Logger logger = LoggerFactory.getLogger(ClauseModel.class);
- public ClauseModel(Clause object) {
+ public ClauseModel(Bundle bundle, String header, Clause object) {
super(object);
+ this.name = object.getName();
+ this.bundle = bundle;
+ this.header = header;
}
@Override
protected Clause load() {
+ Clause[] clauses;
+ try {
+ clauses = ManifestUtil.getHeader(bundle, header);
+ for (Clause clause : clauses) {
+ if (name.equals(clause.getName())) {
+ return clause;
+ }
+ }
+ } catch (IOException e) {
+ logger.error("Unable to load manifest", e);
+ }
return null;
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ExportPackageTable.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ExportPackageTable.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ExportPackageTable.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ExportPackageTable.java Mon Feb 20 07:41:08 2012
@@ -1,8 +1,23 @@
+/*
+ * 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.core.pkg;
import org.apache.felix.utils.manifest.Clause;
import org.apache.karaf.webconsole.core.table.OrdinalColumn;
-import org.apache.karaf.webconsole.core.table.PropertyColumnExt;
import org.apache.karaf.webconsole.osgi.core.pkg.column.AttributesColumn;
import org.apache.karaf.webconsole.osgi.core.pkg.column.DirectivesColumn;
import org.apache.karaf.webconsole.osgi.core.pkg.column.PackageColumn;
@@ -12,10 +27,11 @@ import org.osgi.framework.Constants;
public class ExportPackageTable extends HeaderTable {
+ private static final long serialVersionUID = 1L;
+
@SuppressWarnings("unchecked")
static IColumn<Clause>[] columns = new IColumn[] {
new OrdinalColumn<Clause>(),
- new PropertyColumnExt<Clause>("Package", "name"),
new PackageColumn("Export"),
// new ResolutionColumn("Resolution"),
// new VersionRangeColumn("Version"),
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderDataProvider.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderDataProvider.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderDataProvider.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderDataProvider.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg;
import java.io.IOException;
@@ -19,8 +35,13 @@ public class HeaderDataProvider extends
private static final long serialVersionUID = 1L;
private transient Logger logger = LoggerFactory.getLogger(getClass());
private transient Clause[] clauses;
+ private final Bundle bundle;
+ private final String header;
public HeaderDataProvider(Bundle bundle, String header) {
+ this.bundle = bundle;
+ this.header = header;
+
try {
clauses = ManifestUtil.getHeader(bundle, header);
} catch (IOException e) {
@@ -40,7 +61,7 @@ public class HeaderDataProvider extends
}
public IModel<Clause> model(Clause object) {
- return new ClauseModel(object);
+ return new ClauseModel(bundle, header, object);
}
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderTable.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderTable.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderTable.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/HeaderTable.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg;
import org.apache.felix.utils.manifest.Clause;
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ImportPackageTable.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ImportPackageTable.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ImportPackageTable.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/ImportPackageTable.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg;
import org.apache.felix.utils.manifest.Clause;
@@ -13,18 +29,20 @@ import org.osgi.framework.Constants;
public class ImportPackageTable extends HeaderTable {
- @SuppressWarnings("unchecked")
- static IColumn<Clause>[] columns = new IColumn[] {
- new OrdinalColumn<Clause>(),
- new PackageColumn("Import"),
- new ResolutionColumn("Resolution"),
- new VersionRangeColumn("Version"),
- new AttributesColumn("Attributes"),
- new DirectivesColumn("Directives"),
- };
-
- public ImportPackageTable(String id, Bundle bundle) {
- super(id, columns, bundle, Constants.IMPORT_PACKAGE);
- }
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings("unchecked")
+ static IColumn<Clause>[] columns = new IColumn[] {
+ new OrdinalColumn<Clause>(),
+ new PackageColumn("Import"),
+ new ResolutionColumn("Resolution"),
+ new VersionRangeColumn("Version"),
+ new AttributesColumn("Attributes"),
+ new DirectivesColumn("Directives"),
+ };
+
+ public ImportPackageTable(String id, Bundle bundle) {
+ super(id, columns, bundle, Constants.IMPORT_PACKAGE);
+ }
}
Copied: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/SinglePackagePage.java (from r1291138, karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/PackagePage.java)
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/SinglePackagePage.java?p2=karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/SinglePackagePage.java&p1=karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/PackagePage.java&r1=1291138&r2=1291139&rev=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/PackagePage.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/SinglePackagePage.java Mon Feb 20 07:41:08 2012
@@ -1,19 +1,30 @@
+/*
+ * 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.core.pkg;
-import static org.apache.karaf.webconsole.osgi.core.bundle.SingleBundlePage.createLink;
-
import java.util.Arrays;
-import org.apache.karaf.webconsole.osgi.core.bundle.SingleBundlePage;
+import org.apache.karaf.webconsole.osgi.core.bundle.BundlePanel;
import org.apache.karaf.webconsole.osgi.core.shared.BundleModel;
import org.apache.karaf.webconsole.osgi.core.shared.OsgiPage;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.repeater.RepeatingView;
-import org.apache.wicket.model.PropertyModel;
import org.ops4j.pax.wicket.api.PaxWicketBean;
import org.ops4j.pax.wicket.api.PaxWicketMountPoint;
import org.osgi.framework.Bundle;
@@ -22,12 +33,12 @@ import org.osgi.service.packageadmin.Exp
import org.osgi.service.packageadmin.PackageAdmin;
@PaxWicketMountPoint(mountPoint = "/osgi/package/detail")
-public class PackagePage extends OsgiPage {
+public class SinglePackagePage extends OsgiPage {
@PaxWicketBean(name = "packageAdmin")
private PackageAdmin admin;
- public PackagePage(PageParameters params) {
+ public SinglePackagePage(PageParameters params) {
String pkg = params.getString("package");
String version = params.getString("version");
@@ -47,20 +58,7 @@ public class PackagePage extends OsgiPag
}
if (!found) {
- Link link = new Link("exporterLink") {
- @Override
- public void onClick() {
- // TODO Auto-generated method stub
-
- }
- };
-
- error("Unable to find package " + pkg);
-
- link.add(new Label("exporterLabel", "NOT FOUND"));
- add(link);
- add(new Label("packageDet"));
- add(new RepeatingView("importers"));
+ throw new IllegalArgumentException("Package " + pkg + " " + version + " not found");
}
}
@@ -68,23 +66,17 @@ public class PackagePage extends OsgiPag
Bundle exporter = exportPkg.getExportingBundle();
Bundle[] importers = exportPkg.getImportingBundles();
- PageParameters params = new PageParameters();
- params.put("bundleId", exporter.getBundleId());
-
- Link<SingleBundlePage> link = createLink("exporterLink", exporter);
- link.add(new Label("exporterLabel", new PropertyModel(new BundleModel(exporter), "symbolicName")));
- add(link);
+ add(new BundlePanel("exporter", new BundleModel(exporter)));
add(new Label("packageDet", exportPkg.getName()));
add(new ListView<Bundle>("importers", Arrays.asList(importers)) {
+ private static final long serialVersionUID = 1L;
+
@Override
protected void populateItem(ListItem<Bundle> item) {
- Bundle model = item.getModel().getObject();
-
- Link<SingleBundlePage> link = createLink("importerLink", model);
- link.add(new Label("importerLabel", model.getSymbolicName()));
- item.add(link);
+ BundlePanel panel = new BundlePanel("importer", item.getModel(), true);
+ item.add(panel);
}
});
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesColumn.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesColumn.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesColumn.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesColumn.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
@@ -6,15 +22,16 @@ import org.apache.wicket.extensions.mark
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
-
public class AttributesColumn extends PropertyColumnExt<Clause> {
- public AttributesColumn(String property) {
- super(property);
- }
-
- public void populateItem(Item<ICellPopulator<Clause>> cellItem, String componentId, IModel<Clause> rowModel) {
- cellItem.add(new AttributesPanel(componentId, rowModel));
- }
+ private static final long serialVersionUID = 1L;
+
+ public AttributesColumn(String property) {
+ super(property);
+ }
+
+ public void populateItem(Item<ICellPopulator<Clause>> cellItem, String componentId, IModel<Clause> rowModel) {
+ cellItem.add(new AttributesPanel(componentId, rowModel));
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesPanel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesPanel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesPanel.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/AttributesPanel.java Mon Feb 20 07:41:08 2012
@@ -1,30 +1,51 @@
+/*
+ * 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.core.pkg.column;
-import java.util.Arrays;
-
import org.apache.felix.utils.manifest.Attribute;
import org.apache.felix.utils.manifest.Clause;
-import org.apache.felix.utils.manifest.Directive;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
+import org.osgi.framework.Constants;
public class AttributesPanel extends Panel {
- public AttributesPanel(String componentId, IModel<Clause> model) {
- super(componentId, new CompoundPropertyModel<Clause>(model));
+ private static final long serialVersionUID = 1L;
- add(new ListView<Attribute>("attributes", Arrays.asList(model.getObject().getAttributes())) {
- @Override
- protected void populateItem(ListItem<Attribute> item) {
- item.setModel(new CompoundPropertyModel<Attribute>(item.getModel()));
- item.add(new Label("name"));
- item.add(new Label("value"));
- }
- });
- }
+ public AttributesPanel(String componentId, IModel<Clause> model) {
+ super(componentId);
+ RepeatingView repeatingView = new RepeatingView("attributes");
+
+ Attribute[] attributes = model.getObject().getAttributes();
+ for (Attribute attribute : attributes) {
+ // skip version attribute
+ if (Constants.VERSION_ATTRIBUTE.equals(attribute.getName())) {
+ continue;
+ }
+ WebMarkupContainer container = new WebMarkupContainer(repeatingView.newChildId());
+
+ container.add(new Label("name", attribute.getName()));
+ container.add(new Label("value", attribute.getValue()));
+ repeatingView.add(container);
+ }
+ add(repeatingView);
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesColumn.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesColumn.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesColumn.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesColumn.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
@@ -6,15 +22,16 @@ import org.apache.wicket.extensions.mark
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
-
public class DirectivesColumn extends PropertyColumnExt<Clause> {
- public DirectivesColumn(String property) {
- super(property);
- }
-
- public void populateItem(Item<ICellPopulator<Clause>> cellItem, String componentId, IModel<Clause> rowModel) {
- cellItem.add(new DirectivesPanel(componentId, rowModel));
- }
+ private static final long serialVersionUID = 1L;
+
+ public DirectivesColumn(String property) {
+ super(property);
+ }
+
+ public void populateItem(Item<ICellPopulator<Clause>> cellItem, String componentId, IModel<Clause> rowModel) {
+ cellItem.add(new DirectivesPanel(componentId, rowModel));
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesPanel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesPanel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesPanel.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/DirectivesPanel.java Mon Feb 20 07:41:08 2012
@@ -1,29 +1,51 @@
+/*
+ * 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.core.pkg.column;
-import java.util.Arrays;
-
import org.apache.felix.utils.manifest.Clause;
import org.apache.felix.utils.manifest.Directive;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
+import org.osgi.framework.Constants;
public class DirectivesPanel extends Panel {
- public DirectivesPanel(String componentId, IModel<Clause> model) {
- super(componentId);
+ private static final long serialVersionUID = 1L;
- add(new ListView<Directive>("directives", Arrays.asList(model.getObject().getDirectives())) {
- @Override
- protected void populateItem(ListItem<Directive> item) {
- item.setModel(new CompoundPropertyModel<Directive>(item.getModel()));
- item.add(new Label("name"));
- item.add(new Label("value"));
- }
- });
- }
+ public DirectivesPanel(String componentId, IModel<Clause> model) {
+ super(componentId);
+ RepeatingView repeatingView = new RepeatingView("directives");
+
+ Directive[] directives = model.getObject().getDirectives();
+ for (Directive directive : directives) {
+ // skip resolution directive
+ if (Constants.RESOLUTION_DIRECTIVE.equals(directive.getName())) {
+ continue;
+ }
+ WebMarkupContainer container = new WebMarkupContainer(repeatingView.newChildId());
+
+ container.add(new Label("name", directive.getName()));
+ container.add(new Label("value", directive.getValue()));
+ repeatingView.add(container);
+ }
+ add(repeatingView);
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackageColumn.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackageColumn.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackageColumn.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackageColumn.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
@@ -8,12 +24,15 @@ import org.apache.wicket.model.IModel;
public class PackageColumn extends PropertyColumnExt<Clause> {
- public PackageColumn(String property) {
- super(property, "name");
- }
-
- @Override
- public void populateItem(Item<ICellPopulator<Clause>> item, String componentId, IModel<Clause> rowModel) {
- item.add(new PackagePanel(componentId, rowModel));
- }
+ private static final long serialVersionUID = 1L;
+
+ public PackageColumn(String property) {
+ super(property, "name");
+ }
+
+ @Override
+ public void populateItem(Item<ICellPopulator<Clause>> item, String componentId, IModel<Clause> rowModel) {
+ item.add(new PackagePanel(componentId, rowModel));
+ }
+
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackagePanel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackagePanel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackagePanel.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/PackagePanel.java Mon Feb 20 07:41:08 2012
@@ -1,7 +1,23 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
-import org.apache.karaf.webconsole.osgi.core.pkg.PackagePage;
+import org.apache.karaf.webconsole.osgi.core.pkg.SinglePackagePage;
import org.apache.wicket.PageParameters;
import org.apache.wicket.behavior.SimpleAttributeModifier;
import org.apache.wicket.markup.html.basic.Label;
@@ -16,35 +32,37 @@ import org.osgi.service.packageadmin.Pac
public class PackagePanel extends Panel {
- @PaxWicketBean(name = "packageAdmin")
- private PackageAdmin admin;
+ private static final long serialVersionUID = 1L;
- public PackagePanel(String componentId, IModel<Clause> model) {
- super(componentId);
+ @PaxWicketBean(name = "packageAdmin")
+ private PackageAdmin admin;
- Clause clause = model.getObject();
+ public PackagePanel(String componentId, IModel<Clause> model) {
+ super(componentId);
- PageParameters params = new PageParameters();
- String pkg = clause.getName();
- params.add("package", pkg);
+ Clause clause = model.getObject();
- String version = clause.getAttribute(Constants.VERSION_ATTRIBUTE);
- if (version != null) {
- params.add("version", version);
- } else {
- params.add("version", Version.emptyVersion.toString());
- }
+ PageParameters params = new PageParameters();
+ String pkg = clause.getName();
+ params.add("package", pkg);
- BookmarkablePageLink<PackagePage> link = new BookmarkablePageLink<PackagePage>("link", PackagePage.class, params);
- link.add(new Label("label", pkg));
+ String version = clause.getAttribute(Constants.VERSION_ATTRIBUTE);
+ if (version != null) {
+ params.add("version", version);
+ } else {
+ params.add("version", Version.emptyVersion.toString());
+ }
+ BookmarkablePageLink<SinglePackagePage> link = new BookmarkablePageLink<SinglePackagePage>("link", SinglePackagePage.class, params);
+ link.add(new Label("label", pkg));
- ExportedPackage exportedPackage = admin.getExportedPackage(pkg);
- if (exportedPackage == null) {
- link.add(new SimpleAttributeModifier("class", "error"));
- }
- add(link);
- }
+ ExportedPackage exportedPackage = admin.getExportedPackage(pkg);
+ if (exportedPackage == null) {
+ link.add(new SimpleAttributeModifier("class", "error"));
+ }
+
+ add(link);
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionColumn.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionColumn.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionColumn.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionColumn.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
@@ -5,16 +21,17 @@ import org.apache.karaf.webconsole.core.
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
-import org.osgi.framework.Constants;
public class ResolutionColumn extends PropertyColumnExt<Clause> {
- public ResolutionColumn(String property) {
- super(property, property);
- }
+ private static final long serialVersionUID = 1L;
- @Override
- public void populateItem(Item<ICellPopulator<Clause>> item, String componentId, IModel<Clause> rowModel) {
- item.add(new ResolutionPanel(componentId, rowModel));
- }
+ public ResolutionColumn(String property) {
+ super(property, property);
+ }
+
+ @Override
+ public void populateItem(Item<ICellPopulator<Clause>> item, String componentId, IModel<Clause> rowModel) {
+ item.add(new ResolutionPanel(componentId, rowModel));
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionPanel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionPanel.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionPanel.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/ResolutionPanel.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
@@ -9,29 +25,31 @@ import org.osgi.framework.Constants;
public class ResolutionPanel extends Panel {
- public ResolutionPanel(String id, IModel<Clause> model) {
- super(id);
+ private static final long serialVersionUID = 1L;
- Clause clause = model.getObject();
+ public ResolutionPanel(String id, IModel<Clause> model) {
+ super(id);
- String resolution = clause.getDirective(Constants.RESOLUTION_DIRECTIVE);
- if (resolution == null) {
- resolution = Constants.RESOLUTION_MANDATORY;
- }
-
- String css = "icon-question-sign"; // unknown resolution
- if (Constants.RESOLUTION_MANDATORY.equals(resolution)) {
- css = "icon-lock";
- } else if (Constants.RESOLUTION_OPTIONAL.equals(resolution)) {
- css = "icon-adjust";
- }
-
- add(new Label("resolution", resolution).setRenderBodyOnly(true));
- Label icon = new Label("icon");
- icon.add(new SimpleAttributeModifier("class", css));
- add(icon);
+ Clause clause = model.getObject();
- add(new SimpleAttributeModifier("title", "Resolution is " + resolution));
- }
+ String resolution = clause.getDirective(Constants.RESOLUTION_DIRECTIVE);
+ if (resolution == null) {
+ resolution = Constants.RESOLUTION_MANDATORY;
+ }
+
+ String css = "icon-question-sign"; // unknown resolution
+ if (Constants.RESOLUTION_MANDATORY.equals(resolution)) {
+ css = "icon-lock";
+ } else if (Constants.RESOLUTION_OPTIONAL.equals(resolution)) {
+ css = "icon-adjust";
+ }
+
+ add(new Label("resolution", resolution).setRenderBodyOnly(true));
+ Label icon = new Label("icon", "");
+ icon.add(new SimpleAttributeModifier("class", css));
+ add(icon);
+
+ add(new SimpleAttributeModifier("title", "Resolution is " + resolution));
+ }
}
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionColumn.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionColumn.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionColumn.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionColumn.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
public class VersionColumn {
Modified: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionRangeColumn.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionRangeColumn.java?rev=1291139&r1=1291138&r2=1291139&view=diff
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionRangeColumn.java (original)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/column/VersionRangeColumn.java Mon Feb 20 07:41:08 2012
@@ -1,3 +1,19 @@
+/*
+ * 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.core.pkg.column;
import org.apache.felix.utils.manifest.Clause;
@@ -10,13 +26,15 @@ import org.osgi.framework.Constants;
public class VersionRangeColumn extends PropertyColumnExt<Clause> {
- public VersionRangeColumn(String property) {
- super(property);
- }
+ private static final long serialVersionUID = 1L;
- @Override
- public void populateItem(Item<ICellPopulator<Clause>> item, String componentId, IModel<Clause> rowModel) {
- String version = rowModel.getObject().getAttribute(Constants.VERSION_ATTRIBUTE);
- item.add(new Label(componentId, version));
- }
+ public VersionRangeColumn(String property) {
+ super(property);
+ }
+
+ @Override
+ public void populateItem(Item<ICellPopulator<Clause>> item, String componentId, IModel<Clause> rowModel) {
+ String version = rowModel.getObject().getAttribute(Constants.VERSION_ATTRIBUTE);
+ item.add(new Label(componentId, version));
+ }
}
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/ExportPackageModel.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/ExportPackageModel.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/ExportPackageModel.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/ExportPackageModel.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,37 @@
+package org.apache.karaf.webconsole.osgi.core.pkg.list;
+
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class ExportPackageModel extends LoadableDetachableModel<ExportedPackage> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final PackageAdmin admin;
+ private String name;
+ private String version;
+
+ public ExportPackageModel(PackageAdmin admin, ExportedPackage object) {
+ super(object);
+ this.admin = admin;
+ name = object.getName();
+ version = object.getVersion().toString();
+ }
+
+ @Override
+ protected ExportedPackage load() {
+ ExportedPackage[] packages = admin.getExportedPackages(name);
+ if (packages != null) {
+ Version vers = new Version(version);
+ for (ExportedPackage pkg : packages) {
+ if (vers.equals(pkg.getVersion())) {
+ return pkg;
+ }
+ }
+ }
+ return null;
+ }
+
+}
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackageDataProvider.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackageDataProvider.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackageDataProvider.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackageDataProvider.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,41 @@
+package org.apache.karaf.webconsole.osgi.core.pkg.list;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.model.IModel;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class PackageDataProvider extends SortableDataProvider<ExportedPackage> {
+
+ private static final long serialVersionUID = 1L;
+
+ private transient ExportedPackage[] packages;
+
+ private final PackageAdmin admin;
+
+ public PackageDataProvider(PackageAdmin admin) {
+ this.admin = admin;
+ packages = admin.getExportedPackages((Bundle) null);
+ }
+
+ public Iterator<? extends ExportedPackage> iterator(int first, int count) {
+ List<ExportedPackage> list = new ArrayList<ExportedPackage>();
+ Collections.addAll(list, packages);
+ return list.subList(first, count).iterator();
+ }
+
+ public int size() {
+ return packages.length;
+ }
+
+ public IModel<ExportedPackage> model(ExportedPackage object) {
+ return new ExportPackageModel(admin, object);
+ }
+
+}
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackagePage.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackagePage.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackagePage.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/pkg/list/PackagePage.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,48 @@
+/*
+ * 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.core.pkg.list;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.karaf.webconsole.core.table.OrdinalColumn;
+import org.apache.karaf.webconsole.core.table.PropertyColumnExt;
+import org.apache.karaf.webconsole.osgi.core.shared.OsgiPage;
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.ops4j.pax.wicket.api.PaxWicketBean;
+import org.ops4j.pax.wicket.api.PaxWicketMountPoint;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+@PaxWicketMountPoint(mountPoint = "/osgi/package")
+public class PackagePage extends OsgiPage {
+
+ @PaxWicketBean(name = "packageAdmin")
+ private PackageAdmin admin;
+
+ public PackagePage(PageParameters params) {
+ List<IColumn<ExportedPackage>> columns = new ArrayList<IColumn<ExportedPackage>>();
+ columns.add(new OrdinalColumn<ExportedPackage>());
+ columns.add(new PropertyColumnExt<ExportedPackage>("Package name", "name"));
+ columns.add(new PropertyColumnExt<ExportedPackage>("Version", "version.toString"));
+ columns.add(new PropertyColumnExt<ExportedPackage>("Provider", "exportingBundle.symbolicName"));
+ add(new DefaultDataTable<ExportedPackage>("packages", columns, new PackageDataProvider(admin), Integer.MAX_VALUE));
+ }
+
+}
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceDataProvider.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceDataProvider.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceDataProvider.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceDataProvider.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,30 @@
+/*
+ * 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.core.service;
+
+import org.apache.karaf.webconsole.osgi.core.shared.ServiceDataProvider;
+import org.osgi.framework.Bundle;
+
+public class ExportServiceDataProvider extends ServiceDataProvider {
+
+ private static final long serialVersionUID = 1L;
+
+ public ExportServiceDataProvider(Bundle bundle) {
+ super(bundle.getRegisteredServices());
+ }
+
+}
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceTable.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceTable.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceTable.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ExportServiceTable.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,43 @@
+/*
+ * 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.core.service;
+
+import org.apache.karaf.webconsole.osgi.core.service.column.ObjectClassColumn;
+import org.apache.karaf.webconsole.osgi.core.service.column.ServiceConsumerColumn;
+import org.apache.karaf.webconsole.osgi.core.service.column.ServicePropertyColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.model.Model;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+public class ExportServiceTable extends DefaultDataTable<ServiceReference> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static IColumn<ServiceReference>[] columns = new IColumn[] {
+ new ServicePropertyColumn("Service Id", Constants.SERVICE_ID),
+ new ObjectClassColumn(Model.of("Object classes")),
+ new ServiceConsumerColumn("Consumers"),
+ };
+
+ public ExportServiceTable(String id, Bundle bundle) {
+ super(id, columns, new ExportServiceDataProvider(bundle), Integer.MAX_VALUE);
+ }
+
+}
Added: karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ImportServiceDataProvider.java
URL: http://svn.apache.org/viewvc/karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ImportServiceDataProvider.java?rev=1291139&view=auto
==============================================================================
--- karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ImportServiceDataProvider.java (added)
+++ karaf/webconsole/trunk/osgi/core/src/main/java/org/apache/karaf/webconsole/osgi/core/service/ImportServiceDataProvider.java Mon Feb 20 07:41:08 2012
@@ -0,0 +1,30 @@
+/*
+ * 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.core.service;
+
+import org.apache.karaf.webconsole.osgi.core.shared.ServiceDataProvider;
+import org.osgi.framework.Bundle;
+
+public class ImportServiceDataProvider extends ServiceDataProvider {
+
+ private static final long serialVersionUID = 1L;
+
+ public ImportServiceDataProvider(Bundle bundle) {
+ super(bundle.getServicesInUse());
+ }
+
+}