incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r608816 - in /incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal: Assembly.java BundleRepositoryAdminImpl.java InstallerServiceImpl.java
Date Fri, 04 Jan 2008 12:38:17 GMT
Author: cziegeler
Date: Fri Jan  4 04:38:17 2008
New Revision: 608816

URL: http://svn.apache.org/viewvc?rev=608816&view=rev
Log:
Use generics and clean up.

Modified:
    incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/Assembly.java
    incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/BundleRepositoryAdminImpl.java
    incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/InstallerServiceImpl.java

Modified: incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/Assembly.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/Assembly.java?rev=608816&r1=608815&r2=608816&view=diff
==============================================================================
--- incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/Assembly.java
(original)
+++ incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/Assembly.java
Fri Jan  4 04:38:17 2008
@@ -112,8 +112,8 @@
      * State of this assembly after the Assembly Bundle has been installed by
      * the OSGi framework and the <code>BundleEvent.INSTALLED</code> event has
      * been processed by the {@link #install()} method (value is 1). This is
-     * also the state of Assembly instances after the assembly bundle as been
-     * unresolved by the {@link #unresolve()} method.
+     * also the state of Assembly instances after the assembly bundle has been
+     * unresolved.
      */
     public static final int STATE_INSTALLED = 1;
 

Modified: incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/BundleRepositoryAdminImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/BundleRepositoryAdminImpl.java?rev=608816&r1=608815&r2=608816&view=diff
==============================================================================
--- incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/BundleRepositoryAdminImpl.java
(original)
+++ incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/BundleRepositoryAdminImpl.java
Fri Jan  4 04:38:17 2008
@@ -61,12 +61,13 @@
      *
      * @see org.apache.sling.core.assembly.installer.BundleRepositoryAdmin#getRepositories()
      */
+    @SuppressWarnings("unchecked")
     public Iterator<Repository> getRepositories() {
         Object lock = this.installerService.acquireLock(0);
         try {
             org.osgi.service.obr.Repository[] repos = this.getRepositoryAdmin().listRepositories();
             if (repos == null || repos.length == 0) {
-                return Collections.EMPTY_LIST.iterator();
+                return Collections.EMPTY_LIST.iterator(); // unchecked
             }
 
             SortedSet<Repository> urlSet = new TreeSet<Repository>();
@@ -84,12 +85,13 @@
      *
      * @see org.apache.sling.core.assembly.installer.BundleRepositoryAdmin#getResources()
      */
+    @SuppressWarnings("unchecked")
     public Iterator<org.apache.sling.osgi.assembly.installer.Resource> getResources()
{
         Object lock = this.installerService.acquireLock(0);
         try {
             org.osgi.service.obr.Repository[] repos = this.getRepositoryAdmin().listRepositories();
             if (repos == null || repos.length == 0) {
-                return Collections.EMPTY_LIST.iterator();
+                return Collections.EMPTY_LIST.iterator(); // unchecked
             }
 
             SortedSet<org.apache.sling.osgi.assembly.installer.Resource> resSet = new
TreeSet<org.apache.sling.osgi.assembly.installer.Resource>();

Modified: incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/InstallerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/InstallerServiceImpl.java?rev=608816&r1=608815&r2=608816&view=diff
==============================================================================
--- incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/InstallerServiceImpl.java
(original)
+++ incubator/sling/trunk/osgi/assembly/src/main/java/org/apache/sling/osgi/assembly/internal/InstallerServiceImpl.java
Fri Jan  4 04:38:17 2008
@@ -290,36 +290,37 @@
 
     protected RepositoryAdmin getRepositoryAdmin() {
         if (this.repositoryAdmin == null) {
-            this.repositoryAdmin = (RepositoryAdmin) this.getService(RepositoryAdmin.class);
+            this.repositoryAdmin = this.getService(RepositoryAdmin.class);
         }
         return this.repositoryAdmin;
     }
 
     protected StartLevel getStartLevel() {
         if (this.startLevel == null) {
-            this.startLevel = (StartLevel) this.getService(StartLevel.class);
+            this.startLevel = this.getService(StartLevel.class);
         }
         return this.startLevel;
     }
 
     protected PackageAdmin getPackageAdmin() {
         if (this.packageAdmin == null) {
-            this.packageAdmin = (PackageAdmin) this.getService(PackageAdmin.class);
+            this.packageAdmin = this.getService(PackageAdmin.class);
         }
         return this.packageAdmin;
     }
 
     protected LogService getLogService() {
         if (this.log == null) {
-            this.log = (LogService) this.getService(LogService.class);
+            this.log = this.getService(LogService.class);
         }
         return this.log;
     }
 
-    private Object getService(Class serviceClass) {
+    @SuppressWarnings("unchecked")
+    private <ServiceType> ServiceType getService(Class<ServiceType> serviceClass)
{
         ServiceReference ref = this.bundleContext.getServiceReference(serviceClass.getName());
         if (ref != null) {
-            return this.bundleContext.getService(ref);
+            return (ServiceType) this.bundleContext.getService(ref); // unchecked cast
         }
 
         return null;



Mime
View raw message