incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1056306 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer: api/tasks/ core/impl/
Date Fri, 07 Jan 2011 13:17:10 GMT
Author: cziegeler
Date: Fri Jan  7 13:17:10 2011
New Revision: 1056306

URL: http://svn.apache.org/viewvc?rev=1056306&view=rev
Log:
SLING-1922 : Allow resource transformer for processing installable resources

Added:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
  (with props)
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
  (with props)
Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java?rev=1056306&r1=1056305&r2=1056306&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java
Fri Jan  7 13:17:10 2011
@@ -89,7 +89,9 @@ public interface RegisteredResource exte
      */
     int getPriority();
 
-	/** Attributes include the bundle symbolic name, bundle version, etc. */
+	/**
+	 * Attributes include the bundle symbolic name, bundle version, etc.
+	 */
 	Map<String, Object> getAttributes();
 
 	/** Return the identifier of the OSGi "entity" that this resource

Added: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java?rev=1056306&view=auto
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
(added)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
Fri Jan  7 13:17:10 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.sling.installer.api.tasks;
+
+/**
+ * A resource transformer might transform a registered resource
+ * before it is installed.
+ */
+public interface ResourceTransformer {
+
+    /**
+     * Try to transform the registered resource.
+     * If the transformer is not responsible for transforming the
+     * resource, it should return <code>null</code>
+     *
+     * @param resource The resource
+     * @return A transformation result or <code>null</code>
+     */
+    TransformationResult transform(RegisteredResource resource);
+}

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceTransformer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java?rev=1056306&view=auto
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
(added)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
Fri Jan  7 13:17:10 2011
@@ -0,0 +1,65 @@
+/*
+ * 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.sling.installer.api.tasks;
+
+import java.io.InputStream;
+
+/**
+ * A result of a {@link ResourceTransformer}.
+ */
+public class TransformationResult {
+
+    /** A new resource type. */
+    private String resourceType;
+
+    /** A new input stream. */
+    private InputStream inputStream;
+
+    /**
+     * Get the new resource type
+     * @return New resource type or <code>null</code>.
+     */
+    public String getResourceType() {
+        return resourceType;
+    }
+
+    /**
+     * Get the new input stream
+     * @return New input stream or <code>null</code>.
+     */
+    public InputStream getInputStream() {
+        return inputStream;
+    }
+
+    /**
+     * Set a new resource type.
+     * @param resourceType The resource type
+     */
+    public void setResourceType(final String resourceType) {
+        this.resourceType = resourceType;
+    }
+
+    /**
+     * Set a new input stream.
+     * @param inputStream The input stream
+     */
+    public void setInputStream(final InputStream inputStream) {
+        this.inputStream = inputStream;
+    }
+}

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java?rev=1056306&r1=1056305&r2=1056306&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
Fri Jan  7 13:17:10 2011
@@ -40,6 +40,8 @@ import org.apache.sling.installer.api.ta
 import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceTransformer;
+import org.apache.sling.installer.api.tasks.TransformationResult;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleListener;
@@ -62,7 +64,7 @@ import org.slf4j.LoggerFactory;
  */
 public class OsgiInstallerImpl
     extends Thread
-    implements BundleListener, FrameworkListener, OsgiInstaller {
+    implements BundleListener, FrameworkListener, OsgiInstaller, ServiceTrackerCustomizer
{
 
     /** The logger */
     private final Logger logger =  LoggerFactory.getLogger(this.getClass());
@@ -93,32 +95,16 @@ public class OsgiInstallerImpl
 
     private final FileUtil fileUtil;
 
-    private final ServiceTracker factoryTracker;
+    /** A tracker for the factories. */
+    private ServiceTracker factoryTracker;
+
+    /** A tracker for the transformers. */
+    private ServiceTracker transformerTracker;
 
     /** Constructor */
     public OsgiInstallerImpl(final BundleContext ctx) {
         this.ctx = ctx;
         this.fileUtil = new FileUtil(ctx);
-        this.factoryTracker = new ServiceTracker(ctx, InstallTaskFactory.class.getName(),
-                new ServiceTrackerCustomizer() {
-
-                    public void removedService(ServiceReference reference, Object service)
{
-                        ctx.ungetService(reference);
-                    }
-
-                    public void modifiedService(ServiceReference reference, Object service)
{
-                        // do nothing
-                    }
-
-                    public Object addingService(ServiceReference reference) {
-                        // new factory has been added, wake up main thread
-                        synchronized (newResources) {
-                            newResources.notify();
-                        }
-                        return ctx.getService(reference);
-                    }
-                });
-        this.factoryTracker.open();
     }
 
     /**
@@ -126,34 +112,46 @@ public class OsgiInstallerImpl
      */
     public void deactivate() {
         this.active = false;
+
+        // Stop service trackers.
         this.factoryTracker.close();
+        this.transformerTracker.close();
+
+        // remove as listener
         ctx.removeBundleListener(this);
         ctx.removeFrameworkListener(this);
+
         // wake up sleeping thread
         synchronized (newResources) {
             newResources.notify();
         }
-        logger.debug("Waiting for installer thread to stop");
+        this.logger.debug("Waiting for installer thread to stop");
         try {
             this.join();
         } catch (InterruptedException e) {
             // we simply ignore this
         }
 
-        logger.info("Apache Sling OSGi Installer Service stopped.");
+        this.logger.info("Apache Sling OSGi Installer Service stopped.");
     }
 
     /**
      * Initialize the installer
      */
     private void init() {
+        // start service trackers
+        this.factoryTracker = new ServiceTracker(ctx, InstallTaskFactory.class.getName(),
this);
+        this.factoryTracker.open();
+        this.transformerTracker = new ServiceTracker(ctx, ResourceTransformer.class.getName(),
this);
+        this.transformerTracker.open();
+
         // listen to framework and bundle events
         this.ctx.addFrameworkListener(this);
         this.ctx.addBundleListener(this);
         setName(getClass().getSimpleName());
         final File f = this.fileUtil.getDataFile("RegisteredResourceList.ser");
-        persistentList = new PersistentResourceList(f);
-        logger.info("Apache Sling OSGi Installer Service started.");
+        this.persistentList = new PersistentResourceList(f);
+        this.logger.info("Apache Sling OSGi Installer Service started.");
     }
 
     @Override
@@ -162,6 +160,9 @@ public class OsgiInstallerImpl
         while (active) {
             this.mergeNewResources();
 
+            // invoke transformers
+            this.transformResources();
+
             // execute tasks
             final SortedSet<InstallTask> tasks = this.computeTasks();
             final boolean tasksCreated = !tasks.isEmpty();
@@ -512,6 +513,48 @@ public class OsgiInstallerImpl
         printResources("Compacted");
     }
 
+    /**
+     * Invoke the transformers on the resources.
+     */
+    private void transformResources() {
+        // Walk the list of resources and invoke all transformers
+        final Object[] services = this.transformerTracker.getServices();
+        if ( services != null && services.length > 0 ) {
+            boolean changed = false;
+            for(final String entityId : this.persistentList.getEntityIds()) {
+                final EntityResourceList group = this.persistentList.getEntityResourceList(entityId);
+                // Check the first resource in each group
+                final RegisteredResource toActivate = group.getActiveResource();
+                if ( toActivate != null && toActivate.getState() == RegisteredResource.State.INSTALL
) {
+                    for(int i=0; i<services.length; i++) {
+                        if ( services[i] instanceof ResourceTransformer ) {
+                            final ResourceTransformer transformer = (ResourceTransformer)services[i];
+                            final TransformationResult tr = transformer.transform(toActivate);
+                            if ( tr != null ) {
+                                if ( tr.getResourceType() != null ) {
+                                    this.persistentList.remove(toActivate);
+                                }
+                                if ( ((RegisteredResourceImpl)toActivate).update(tr) ) {
+                                    if ( tr.getResourceType() != null ) {
+                                        this.persistentList.addOrUpdate(toActivate);
+                                    }
+                                } else {
+                                    // ignore this resource from now on
+                                    toActivate.setState(RegisteredResource.State.IGNORED);
+                                }
+                                changed = true;
+                            }
+                        }
+                    }
+                }
+            }
+            if ( changed ) {
+                this.persistentList.save();
+                printResources("Transformed");
+            }
+        }
+    }
+
     /** If we have any tasks waiting to be retried, schedule their execution
     private void scheduleRetries() {
         final int toRetry;
@@ -564,4 +607,29 @@ public class OsgiInstallerImpl
             eventsCount++;
         }
     }
+
+    /**
+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
java.lang.Object)
+     */
+    public void removedService(ServiceReference reference, Object service) {
+        ctx.ungetService(reference);
+    }
+
+    /**
+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,
java.lang.Object)
+     */
+    public void modifiedService(ServiceReference reference, Object service) {
+        // do nothing
+    }
+
+    /**
+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
+     */
+    public Object addingService(ServiceReference reference) {
+        // new factory has been added, wake up main thread
+        synchronized (newResources) {
+            newResources.notify();
+        }
+        return ctx.getService(reference);
+    }
 }
\ No newline at end of file

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java?rev=1056306&r1=1056305&r2=1056306&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java
Fri Jan  7 13:17:10 2011
@@ -45,6 +45,7 @@ import java.util.jar.Manifest;
 import org.apache.felix.cm.file.ConfigurationHandler;
 import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.TransformationResult;
 import org.apache.sling.installer.core.impl.config.ConfigTaskCreator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -73,7 +74,7 @@ public class RegisteredResourceImpl
 	private final String digest;
 
 	/** The entity id. */
-	private final String entity;
+	private String entity;
 
 	/** The dictionary for configurations. */
 	private final Dictionary<String, Object> dictionary;
@@ -85,7 +86,7 @@ public class RegisteredResourceImpl
 
 	private final int priority;
 
-    private final String resourceType;
+    private String resourceType;
 
     /** The current state of this resource. */
     private State state = State.INSTALL;
@@ -195,79 +196,32 @@ public class RegisteredResourceImpl
 	        final FileUtil fileUtil) throws IOException {
         this.url = scheme + ':' + id;
         this.urlScheme = scheme;
-		this.resourceType = type;
 		this.priority = priority;
         this.dictionary = copy(dict);
 
-		if (resourceType.equals(InstallableResource.TYPE_BUNDLE)) {
+		if (type.equals(InstallableResource.TYPE_BUNDLE)) {
             try {
-                this.dataFile = fileUtil.createNewDataFile(getType());
-                copyToLocalStorage(is);
-                setAttributesFromManifest();
-                final String name = (String)attributes.get(Constants.BUNDLE_SYMBOLICNAME);
-                if (name == null) {
-                    // not a bundle
-                    throw new IOException("Bundle resource does not contain a bundle " +
this.url);
-                }
+                this.dataFile = fileUtil.createNewDataFile(type);
+                this.copyToLocalStorage(is);
+                this.setAttributesFromManifest(false);
                 this.digest = (digest != null && digest.length() > 0 ? digest
: id + ":" + computeDigest(this.dataFile));
-                entity = resourceType + ':' + name;
             } finally {
                 is.close();
             }
-		} else if ( resourceType.equals(InstallableResource.TYPE_CONFIG)) {
+		} else if ( type.equals(InstallableResource.TYPE_CONFIG)) {
             this.dataFile = null;
             this.digest = (digest != null && digest.length() > 0 ? digest : id
+ ":" + computeDigest(dict));
-            // remove path
-            String pid = id;
-            final int slashPos = pid.lastIndexOf('/');
-            if ( slashPos != -1 ) {
-                pid = pid.substring(slashPos + 1);
-            }
-            // remove extension
-            if ( RegisteredResourceImpl.isConfigExtension(RegisteredResourceImpl.getExtension(pid)))
{
-                final int lastDot = pid.lastIndexOf('.');
-                pid = pid.substring(0, lastDot);
-            }
-            // split pid and factory pid alias
-            final String factoryPid;
-            final String configPid;
-            int n = pid.indexOf('-');
-            if (n > 0) {
-                configPid = pid.substring(n + 1);
-                factoryPid = pid.substring(0, n);
-            } else {
-                factoryPid = null;
-                configPid = pid;
-            }
-            entity = resourceType + ':' + (factoryPid == null ? "" : factoryPid + ".") +
configPid;
-
-            attributes.put(Constants.SERVICE_PID, configPid);
-            // Add pseudo-properties
-            this.dictionary.put(ConfigTaskCreator.CONFIG_PATH_KEY, this.getURL());
-
-            // Factory?
-            if (factoryPid != null) {
-                attributes.put(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
-                this.dictionary.put(ConfigTaskCreator.ALIAS_KEY, configPid);
-            }
-
 		} else {
 		    // we just copy the input stream
             try {
                 this.dataFile = fileUtil.createNewDataFile(getType());
                 copyToLocalStorage(is);
                 this.digest = (digest != null && digest.length() > 0 ? digest
: id + ":" + computeDigest(this.dataFile));
-                // remove path
-                String pid = id;
-                final int slashPos = pid.lastIndexOf('/');
-                if ( slashPos != -1 ) {
-                    pid = pid.substring(slashPos + 1);
-                }
-                entity = resourceType + ':' + pid;
             } finally {
                 is.close();
             }
 		}
+		this.updateResourceType(id, type, false);
 	}
 
 	@Override
@@ -402,24 +356,30 @@ public class RegisteredResourceImpl
         return result;
     }
 
-    private void setAttributesFromManifest() throws IOException {
+    /**
+     * Set the manifest attributes from the data file.
+     * @throws IOException If anything goes wrong
+     */
+    private void setAttributesFromManifest(final boolean ignoreError) throws IOException
{
+        attributes.remove(Constants.BUNDLE_SYMBOLICNAME);
+        attributes.remove(Constants.BUNDLE_VERSION);
     	final Manifest m = getManifest(getInputStream());
-    	if(m == null) {
+    	if (m == null) {
+    	    if ( ignoreError) {
+    	        return;
+    	    }
             throw new IOException("Cannot get manifest of bundle resource");
     	}
 
     	final String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
-        if(sn == null) {
-            throw new IOException("Manifest does not supply " + Constants.BUNDLE_SYMBOLICNAME);
-        }
-
-    	final String v = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
-        if(v == null) {
-            throw new IOException("Manifest does not supply " + Constants.BUNDLE_VERSION);
+        if (sn != null) {
+            final String v = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
+            if (v == null) {
+                throw new IOException("Manifest does not supply " + Constants.BUNDLE_VERSION);
+            }
+            attributes.put(Constants.BUNDLE_SYMBOLICNAME, sn);
+            attributes.put(Constants.BUNDLE_VERSION, v.toString());
         }
-
-        attributes.put(Constants.BUNDLE_SYMBOLICNAME, sn);
-        attributes.put(Constants.BUNDLE_VERSION, v.toString());
     }
 
     /**
@@ -694,4 +654,92 @@ public class RegisteredResourceImpl
             this.temporaryAttributes.put(key, value);
         }
     }
+
+    /**
+     * Update this resource from the result.
+     * Currently only the input stream and resource type is updated.
+     * @param tr Transformation result
+     */
+    public boolean update(final TransformationResult tr) {
+        final InputStream is = tr.getInputStream();
+        if ( is != null ) {
+            try {
+                this.copyToLocalStorage(is);
+                this.setAttributesFromManifest(true);
+            } catch (final IOException ioe) {
+                // if an error occurs, we can ignore this resource from now on!
+                return false;
+            } finally {
+                try {
+                    is.close();
+                } catch (final IOException ignore) {}
+            }
+        }
+        if ( tr.getResourceType() != null ) {
+            try {
+                updateResourceType(this.getURL(), tr.getResourceType(), true);
+            } catch (final IOException ioe) {
+                // if an error occurs, we can ignore this resource from now on!
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private void updateResourceType(final String id, final String type, final boolean ignoreErrors)
throws IOException {
+        String lastIdPart = id;
+        final int slashPos = lastIdPart.lastIndexOf('/');
+        if ( slashPos != -1 ) {
+            lastIdPart = lastIdPart.substring(slashPos + 1);
+        }
+
+        if (type.equals(InstallableResource.TYPE_BUNDLE)) {
+            this.setAttributesFromManifest(ignoreErrors);
+            final String name = (String)attributes.get(Constants.BUNDLE_SYMBOLICNAME);
+            if (name == null) {
+                // not a bundle - we assume it to be a jar, this allows
+                // a resource transformer to transform it into a bundle
+                this.resourceType = "jar";
+                entity = resourceType + ':' + lastIdPart;
+            } else {
+                this.resourceType = InstallableResource.TYPE_BUNDLE;
+                entity = resourceType + ':' + name;
+            }
+        } else if ( type.equals(InstallableResource.TYPE_CONFIG)) {
+            this.resourceType = InstallableResource.TYPE_CONFIG;
+            // remove path
+            String pid = lastIdPart;
+            // remove extension
+            if ( RegisteredResourceImpl.isConfigExtension(RegisteredResourceImpl.getExtension(pid)))
{
+                final int lastDot = pid.lastIndexOf('.');
+                pid = pid.substring(0, lastDot);
+            }
+            // split pid and factory pid alias
+            final String factoryPid;
+            final String configPid;
+            int n = pid.indexOf('-');
+            if (n > 0) {
+                configPid = pid.substring(n + 1);
+                factoryPid = pid.substring(0, n);
+            } else {
+                factoryPid = null;
+                configPid = pid;
+            }
+            this.entity = resourceType + ':' + (factoryPid == null ? "" : factoryPid + ".")
+ configPid;
+
+            attributes.put(Constants.SERVICE_PID, configPid);
+            // Add pseudo-properties
+            this.dictionary.put(ConfigTaskCreator.CONFIG_PATH_KEY, this.getURL());
+
+            // Factory?
+            if (factoryPid != null) {
+                attributes.put(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+                this.dictionary.put(ConfigTaskCreator.ALIAS_KEY, configPid);
+            }
+
+        } else {
+            this.resourceType = type;
+            this.entity = resourceType + ':' + lastIdPart;
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message