private Collection<DeployableComponent> parseDescriptor()
			throws IOException {
		if (logger.isTraceEnabled()) {
			logger.trace("Parsing Descriptor for " + this.diURL.toString());
		}

		Collection<DeployableComponent> deployableComponents = new ArrayList<DeployableComponent>();

		SleeContainer sleeContainer = SleeContainer.lookupFromJndi();
		ComponentDescriptorFactory componentDescriptorFactory = sleeContainer
				.getComponentManagement().getComponentDescriptorFactory();

		// Special case for the services...
		if (this.diShortName.endsWith(".xml")) {
			if (logger.isTraceEnabled()) {
				logger.trace("Parsing Service Descriptor.");
			}

			InputStream is = null;

			try {
				is = diURL.openStream();

				ServiceDescriptorFactory sdf = componentDescriptorFactory
						.getServiceDescriptorFactory();
				List<? extends ServiceDescriptor> serviceDescriptors = sdf
						.parse(is);

				for (ServiceDescriptor sd : serviceDescriptors) {
					DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

					dc.componentType = SERVICE_COMPONENT;

					dc.componentID = sd.getServiceID();

					dc.componentKey = getComponentIdAsString(dc.componentID);

					if (logger.isTraceEnabled()) {
						logger.trace("Component ID: " + dc.componentKey);
						logger.trace("------------------------------ Dependencies ------------------------------");
					}

					// Get the set of this sbb dependencies
					Set<ComponentID> serviceDependencies = sd
							.getDependenciesSet();

					// Iterate through dependencies set
					for (ComponentID dependencyId : serviceDependencies) {
						// Add the dependency
						dc.dependencies
								.add(getComponentIdAsString(dependencyId));

						if (logger.isTraceEnabled()) {
							logger.trace(getComponentIdAsString(dependencyId));
						}
					}

					if (logger.isTraceEnabled()) {
						logger.trace("--------------------------- End of Dependencies --------------------------");
					}

					dc.installActions.add(new ActivateServiceAction(
							(ServiceID) dc.componentID, sleeContainerDeployer.getSleeContainer().getServiceManagement()));

					dc.uninstallActions.add(new DeactivateServiceAction(
							(ServiceID) dc.componentID, sleeContainerDeployer.getSleeContainer().getServiceManagement()));

					deployableComponents.add(dc);
				}

				return deployableComponents;
			} catch (Exception e) {
				logger.error("", e);
				return null;
			} finally {
				// Clean up!
				if (is != null) {
					try {
						is.close();
					} finally {
						is = null;
					}
				}
			}
		}

		try {
			URL descriptorXML = null;

			// Determine whether the type of this instance is an sbb, event, RA
			// type, etc.
			if ((descriptorXML = duWrapper.getEntry("META-INF/sbb-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing SBB Descriptor.");
				}

				InputStream is = null;

				try {
					is = descriptorXML.openStream();

					// Parse the descriptor using the factory
					SbbDescriptorFactory sbbdf = componentDescriptorFactory
							.getSbbDescriptorFactory();
					List<? extends SbbDescriptor> sbbDescriptors = sbbdf
							.parse(is);

					if (sbbDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no sbb definitions");
						return null;
					}

					for (SbbDescriptor sbbDescriptor : sbbDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						dc.componentType = SBB_COMPONENT;

						// Get the Component ID
						dc.componentID = sbbDescriptor.getSbbID();

						// Get the Component Key
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						// Get the set of this sbb dependencies
						Set<ComponentID> sbbDependencies = sbbDescriptor
								.getDependenciesSet();

						// Iterate through dependencies set
						for (ComponentID dependencyId : sbbDependencies) {
							// Add the dependency
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						// FIXME: This is special case for Links. Maybe it
						// should be treated in SbbDescriptorImpl?
						for (ResourceAdaptorTypeBindingDescriptor raTypeBinding : sbbDescriptor
								.getResourceAdaptorTypeBindings()) {
							for (ResourceAdaptorEntityBindingDescriptor raEntityBinding : raTypeBinding
									.getResourceAdaptorEntityBinding()) {
								String raLink = raEntityBinding
										.getResourceAdaptorEntityLink();

								// Add the dependency
								dc.dependencies.add(raLink);

								if (logger.isTraceEnabled()) {
									logger.trace(raLink);
								}
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					// Clean up!
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/profile-spec-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Profile Specification Descriptor.");
				}

				InputStream is = null;

				try {
					// Get the InputStream
					is = descriptorXML.openStream();

					// Parse the descriptor using the factory
					ProfileSpecificationDescriptorFactory psdf = componentDescriptorFactory
							.getProfileSpecificationDescriptorFactory();
					List<? extends ProfileSpecificationDescriptor> psDescriptors = psdf
							.parse(is);

					// Get a list of the profile specifications in the
					// deployable unit.
					if (psDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no profile-spec definitions");
						return null;
					}

					// Iterate through the profile spec nodes
					for (ProfileSpecificationDescriptor psDescriptor : psDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						// Set Component Type
						dc.componentType = PROFILESPEC_COMPONENT;

						// Get the Component ID
						dc.componentID = psDescriptor
								.getProfileSpecificationID();

						// Get the Component Key
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						// Get the set of this sbb dependencies
						Set<ComponentID> psDependencies = psDescriptor
								.getDependenciesSet();

						// Iterate through dependencies set
						for (ComponentID dependencyId : psDependencies) {
							// Add the dependency
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					// Clean up!
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/event-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Event Definition Descriptor.");
				}

				InputStream is = null;

				try {
					// Get the InputStream
					is = descriptorXML.openStream();

					// Parse the descriptor using the factory
					EventTypeDescriptorFactory etdf = componentDescriptorFactory
							.getEventTypeDescriptorFactory();
					List<? extends EventTypeDescriptor> etDescriptors = etdf
							.parse(is);

					if (etDescriptors == null || etDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no event-type definitions");
						return null;
					}

					for (EventTypeDescriptor etDescriptor : etDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						// Set Component Type
						dc.componentType = EVENTTYPE_COMPONENT;

						// Get the Component ID
						dc.componentID = etDescriptor.getEventTypeID();

						// Get the Component Key
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						// Get the set of this sbb dependencies
						Set<ComponentID> etDependencies = etDescriptor
								.getDependenciesSet();

						// Iterate through dependencies set
						for (ComponentID dependencyId : etDependencies) {
							// Add the dependency
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}

				} catch (Exception e) {
					logger.error("", e);
				} finally {
					// Clean up!
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/resource-adaptor-type-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Resource Adaptor Type Descriptor.");
				}

				InputStream is = null;

				try {
					// Get the InputStream
					is = descriptorXML.openStream();

					// Parse the descriptor using the factory
					ResourceAdaptorTypeDescriptorFactory ratdf = componentDescriptorFactory
							.getResourceAdaptorTypeDescriptorFactory();
					List<? extends ResourceAdaptorTypeDescriptor> ratDescriptors = ratdf
							.parse(is);

					if (ratDescriptors == null || ratDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no resource-adaptor-type definitions");
						return null;
					}

					// Go through all the Resource Adaptor Type Elements
					for (ResourceAdaptorTypeDescriptor ratDescriptor : ratDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						// Set Component Type
						dc.componentType = RATYPE_COMPONENT;

						// Get the Component ID
						dc.componentID = ratDescriptor
								.getResourceAdaptorTypeID();

						// Get the Component Key
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						// Get the set of this sbb dependencies
						Set<ComponentID> ratDependencies = ratDescriptor
								.getDependenciesSet();

						// Iterate through dependencies set
						for (ComponentID dependencyId : ratDependencies) {
							// Add the dependency
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					// Clean up!
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/resource-adaptor-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Resource Adaptor Descriptor.");
				}

				InputStream is = null;

				try {
					// Get the InputStream
					is = descriptorXML.openStream();

					// Parse the descriptor using the factory
					ResourceAdaptorDescriptorFactory radf = componentDescriptorFactory
							.getResourceAdaptorDescriptorFactory();
					List<? extends ResourceAdaptorDescriptor> raDescriptors = radf
							.parse(is);

					DeployConfigParser sleeDeployConfigParser = sleeContainerDeployer.getSLEEDeployConfigParser();

					// Go through all the Resource Adaptor Elements
					for (ResourceAdaptorDescriptor raDescriptor : raDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						// Set Component Type
						dc.componentType = RA_COMPONENT;

						// Set the Component ID
						dc.componentID = raDescriptor.getResourceAdaptorID();

						// Set the Component Key
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						// Get the set of this sbb dependencies
						Set<ComponentID> raDependencies = raDescriptor
								.getDependenciesSet();

						// Iterate through dependencies set
						for (ComponentID dependencyId : raDependencies) {
							// Add the dependency
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						// get management actions for this ra, in SLEE's deploy config
						if (sleeDeployConfigParser != null) {
							Collection<ManagementAction> managementActions = sleeDeployConfigParser.getPostInstallActions().get(dc.getComponentKey());
							if (managementActions != null) {
								dc.installActions.addAll(managementActions);
							}
							managementActions = sleeDeployConfigParser.getPreUninstallActions().get(dc.getComponentKey());
							if (managementActions != null) {
								dc.uninstallActions.addAll(managementActions);
							}
						}
						
						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					// Clean up!
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/library-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Library Descriptor.");
				}

				InputStream is = null;

				try {
					// Get the InputStream
					is = descriptorXML.openStream();

					// Parse the descriptor using the factory
					LibraryDescriptorFactory ldf = componentDescriptorFactory
							.getLibraryDescriptorFactory();
					List<? extends LibraryDescriptor> libraryDescriptors = ldf
							.parse(is);

					// Go through all the Resource Adaptor Elements
					for (LibraryDescriptor libraryDescriptor : libraryDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						// Set Component Type
						dc.componentType = LIBRARY_COMPONENT;

						// Set the Component ID
						dc.componentID = libraryDescriptor.getLibraryID();

						// Set the Component Key
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						// Get the set of this sbb dependencies
						Set<ComponentID> libraryDependencies = libraryDescriptor
								.getDependenciesSet();

						// Iterate through dependencies set
						for (ComponentID dependencyId : libraryDependencies) {
							// Add the dependency
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					// Clean up!
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else {
				logger.warn("\r\n--------------------------------------------------------------------------------\r\n"
						+ "No Component Descriptor found in '"
						+ duWrapper.getFileName()
						+ "'.\r\n"
						+ "--------------------------------------------------------------------------------");

				return new ArrayList<DeployableComponent>();
			}
		} finally {
		}

		return deployableComponents;
	}
private Collection<DeployableComponent> parseDescriptor()
			throws IOException {
		if (logger.isTraceEnabled()) {
			logger.trace("Parsing Descriptor for " + this.diURL.toString());
		}

		Collection<DeployableComponent> deployableComponents = new ArrayList<DeployableComponent>();

		SleeContainer sleeContainer = SleeContainer.lookupFromJndi();
		ComponentDescriptorFactory componentDescriptorFactory = sleeContainer
				.getComponentManagement().getComponentDescriptorFactory();

		
		if (this.diShortName.endsWith(".xml")) {
			if (logger.isTraceEnabled()) {
				logger.trace("Parsing Service Descriptor.");
			}

			InputStream is = null;

			try {
				is = diURL.openStream();

				ServiceDescriptorFactory sdf = componentDescriptorFactory
						.getServiceDescriptorFactory();
				List<? extends ServiceDescriptor> serviceDescriptors = sdf
						.parse(is);

				for (ServiceDescriptor sd : serviceDescriptors) {
					DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

					dc.componentType = SERVICE_COMPONENT;

					dc.componentID = sd.getServiceID();

					dc.componentKey = getComponentIdAsString(dc.componentID);

					if (logger.isTraceEnabled()) {
						logger.trace("Component ID: " + dc.componentKey);
						logger.trace("------------------------------ Dependencies ------------------------------");
					}

					
					Set<ComponentID> serviceDependencies = sd
							.getDependenciesSet();

					
					for (ComponentID dependencyId : serviceDependencies) {
						
						dc.dependencies
								.add(getComponentIdAsString(dependencyId));

						if (logger.isTraceEnabled()) {
							logger.trace(getComponentIdAsString(dependencyId));
						}
					}

					if (logger.isTraceEnabled()) {
						logger.trace("--------------------------- End of Dependencies --------------------------");
					}

					dc.installActions.add(new ActivateServiceAction(
							(ServiceID) dc.componentID, sleeContainerDeployer.getSleeContainer().getServiceManagement()));

					dc.uninstallActions.add(new DeactivateServiceAction(
							(ServiceID) dc.componentID, sleeContainerDeployer.getSleeContainer().getServiceManagement()));

					deployableComponents.add(dc);
				}

				return deployableComponents;
			} catch (Exception e) {
				logger.error("", e);
				return null;
			} finally {
				
				if (is != null) {
					try {
						is.close();
					} finally {
						is = null;
					}
				}
			}
		}

		try {
			URL descriptorXML = null;

			
			
			if ((descriptorXML = duWrapper.getEntry("META-INF/sbb-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing SBB Descriptor.");
				}

				InputStream is = null;

				try {
					is = descriptorXML.openStream();

					
					SbbDescriptorFactory sbbdf = componentDescriptorFactory
							.getSbbDescriptorFactory();
					List<? extends SbbDescriptor> sbbDescriptors = sbbdf
							.parse(is);

					if (sbbDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no sbb definitions");
						return null;
					}

					for (SbbDescriptor sbbDescriptor : sbbDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						dc.componentType = SBB_COMPONENT;

						
						dc.componentID = sbbDescriptor.getSbbID();

						
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						
						Set<ComponentID> sbbDependencies = sbbDescriptor
								.getDependenciesSet();

						
						for (ComponentID dependencyId : sbbDependencies) {
							
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						
						
						for (ResourceAdaptorTypeBindingDescriptor raTypeBinding : sbbDescriptor
								.getResourceAdaptorTypeBindings()) {
							for (ResourceAdaptorEntityBindingDescriptor raEntityBinding : raTypeBinding
									.getResourceAdaptorEntityBinding()) {
								String raLink = raEntityBinding
										.getResourceAdaptorEntityLink();

								
								dc.dependencies.add(raLink);

								if (logger.isTraceEnabled()) {
									logger.trace(raLink);
								}
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/profile-spec-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Profile Specification Descriptor.");
				}

				InputStream is = null;

				try {
					
					is = descriptorXML.openStream();

					
					ProfileSpecificationDescriptorFactory psdf = componentDescriptorFactory
							.getProfileSpecificationDescriptorFactory();
					List<? extends ProfileSpecificationDescriptor> psDescriptors = psdf
							.parse(is);

					
					
					if (psDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no profile-spec definitions");
						return null;
					}

					
					for (ProfileSpecificationDescriptor psDescriptor : psDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						
						dc.componentType = PROFILESPEC_COMPONENT;

						
						dc.componentID = psDescriptor
								.getProfileSpecificationID();

						
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						
						Set<ComponentID> psDependencies = psDescriptor
								.getDependenciesSet();

						
						for (ComponentID dependencyId : psDependencies) {
							
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/event-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Event Definition Descriptor.");
				}

				InputStream is = null;

				try {
					
					is = descriptorXML.openStream();

					
					EventTypeDescriptorFactory etdf = componentDescriptorFactory
							.getEventTypeDescriptorFactory();
					List<? extends EventTypeDescriptor> etDescriptors = etdf
							.parse(is);

					if (etDescriptors == null || etDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no event-type definitions");
						return null;
					}

					for (EventTypeDescriptor etDescriptor : etDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						
						dc.componentType = EVENTTYPE_COMPONENT;

						
						dc.componentID = etDescriptor.getEventTypeID();

						
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						
						Set<ComponentID> etDependencies = etDescriptor
								.getDependenciesSet();

						
						for (ComponentID dependencyId : etDependencies) {
							
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}

				} catch (Exception e) {
					logger.error("", e);
				} finally {
					
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/resource-adaptor-type-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Resource Adaptor Type Descriptor.");
				}

				InputStream is = null;

				try {
					
					is = descriptorXML.openStream();

					
					ResourceAdaptorTypeDescriptorFactory ratdf = componentDescriptorFactory
							.getResourceAdaptorTypeDescriptorFactory();
					List<? extends ResourceAdaptorTypeDescriptor> ratDescriptors = ratdf
							.parse(is);

					if (ratDescriptors == null || ratDescriptors.isEmpty()) {
						logger.warn("The "
								+ duWrapper.getFileName()
								+ " deployment descriptor contains no resource-adaptor-type definitions");
						return null;
					}

					
					for (ResourceAdaptorTypeDescriptor ratDescriptor : ratDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						
						dc.componentType = RATYPE_COMPONENT;

						
						dc.componentID = ratDescriptor
								.getResourceAdaptorTypeID();

						
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						
						Set<ComponentID> ratDependencies = ratDescriptor
								.getDependenciesSet();

						
						for (ComponentID dependencyId : ratDependencies) {
							
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/resource-adaptor-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Resource Adaptor Descriptor.");
				}

				InputStream is = null;

				try {
					
					is = descriptorXML.openStream();

					
					ResourceAdaptorDescriptorFactory radf = componentDescriptorFactory
							.getResourceAdaptorDescriptorFactory();
					List<? extends ResourceAdaptorDescriptor> raDescriptors = radf
							.parse(is);

					DeployConfigParser sleeDeployConfigParser = sleeContainerDeployer.getSLEEDeployConfigParser();

					
					for (ResourceAdaptorDescriptor raDescriptor : raDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						
						dc.componentType = RA_COMPONENT;

						
						dc.componentID = raDescriptor.getResourceAdaptorID();

						
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						
						Set<ComponentID> raDependencies = raDescriptor
								.getDependenciesSet();

						
						for (ComponentID dependencyId : raDependencies) {
							
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						
						if (sleeDeployConfigParser != null) {
							Collection<ManagementAction> managementActions = sleeDeployConfigParser.getPostInstallActions().get(dc.getComponentKey());
							if (managementActions != null) {
								dc.installActions.addAll(managementActions);
							}
							managementActions = sleeDeployConfigParser.getPreUninstallActions().get(dc.getComponentKey());
							if (managementActions != null) {
								dc.uninstallActions.addAll(managementActions);
							}
						}
						
						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else if ((descriptorXML = duWrapper
					.getEntry("META-INF/library-jar.xml")) != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Parsing Library Descriptor.");
				}

				InputStream is = null;

				try {
					
					is = descriptorXML.openStream();

					
					LibraryDescriptorFactory ldf = componentDescriptorFactory
							.getLibraryDescriptorFactory();
					List<? extends LibraryDescriptor> libraryDescriptors = ldf
							.parse(is);

					
					for (LibraryDescriptor libraryDescriptor : libraryDescriptors) {
						DeployableComponent dc = new DeployableComponent(this,sleeContainerDeployer);

						
						dc.componentType = LIBRARY_COMPONENT;

						
						dc.componentID = libraryDescriptor.getLibraryID();

						
						dc.componentKey = getComponentIdAsString(dc.componentID);

						if (logger.isTraceEnabled()) {
							logger.trace("Component ID: " + dc.componentKey);
							logger.trace("------------------------------ Dependencies ------------------------------");
						}

						
						Set<ComponentID> libraryDependencies = libraryDescriptor
								.getDependenciesSet();

						
						for (ComponentID dependencyId : libraryDependencies) {
							
							dc.dependencies
									.add(getComponentIdAsString(dependencyId));

							if (logger.isTraceEnabled()) {
								logger.trace(getComponentIdAsString(dependencyId));
							}
						}

						if (logger.isTraceEnabled()) {
							logger.trace("--------------------------- End of Dependencies --------------------------");
						}

						deployableComponents.add(dc);
					}
				} catch (Exception e) {
					logger.error("", e);
				} finally {
					
					if (is != null) {
						try {
							is.close();
						} finally {
							is = null;
						}
					}
				}
			} else {
				logger.warn("\r\n--------------------------------------------------------------------------------\r\n"
						+ "No Component Descriptor found in '"
						+ duWrapper.getFileName()
						+ "'.\r\n"
						+ "--------------------------------------------------------------------------------");

				return new ArrayList<DeployableComponent>();
			}
		} finally {
		}

		return deployableComponents;
	}
private Collection < DeployableComponent > parseDescriptor ( ) throws IOException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Descriptor for " + this . diURL . toString ( ) ) ; } Collection < DeployableComponent > deployableComponents = new ArrayList < DeployableComponent > ( ) ; SleeContainer sleeContainer = SleeContainer . lookupFromJndi ( ) ; ComponentDescriptorFactory componentDescriptorFactory = sleeContainer . getComponentManagement ( ) . getComponentDescriptorFactory ( ) ; // Special case for the services...
 if ( this . diShortName . endsWith ( ".xml" ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Service Descriptor." ) ; } InputStream is = null ; try { is = diURL . openStream ( ) ; ServiceDescriptorFactory sdf = componentDescriptorFactory . getServiceDescriptorFactory ( ) ; List < ? extends ServiceDescriptor > serviceDescriptors = sdf . parse ( is ) ; for ( ServiceDescriptor sd : serviceDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; dc . componentType = SERVICE_COMPONENT ; dc . componentID = sd . getServiceID ( ) ; dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > serviceDependencies = sd . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : serviceDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } dc . installActions . add ( new ActivateServiceAction ( ( ServiceID ) dc . componentID , sleeContainerDeployer . getSleeContainer ( ) . getServiceManagement ( ) ) ) ; dc . uninstallActions . add ( new DeactivateServiceAction ( ( ServiceID ) dc . componentID , sleeContainerDeployer . getSleeContainer ( ) . getServiceManagement ( ) ) ) ; deployableComponents . add ( dc ) ; } return deployableComponents ; } catch ( Exception e ) { logger . error ( "" , e ) ; return null ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } try { URL descriptorXML = null ; // Determine whether the type of this instance is an sbb, event, RA
 // type, etc.
 if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/sbb-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing SBB Descriptor." ) ; } InputStream is = null ; try { is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 SbbDescriptorFactory sbbdf = componentDescriptorFactory . getSbbDescriptorFactory ( ) ; List < ? extends SbbDescriptor > sbbDescriptors = sbbdf . parse ( is ) ; if ( sbbDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no sbb definitions" ) ; return null ; } for ( SbbDescriptor sbbDescriptor : sbbDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; dc . componentType = SBB_COMPONENT ; // Get the Component ID
 dc . componentID = sbbDescriptor . getSbbID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > sbbDependencies = sbbDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : sbbDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } // FIXME: This is special case for Links. Maybe it
 // should be treated in SbbDescriptorImpl?
 for ( ResourceAdaptorTypeBindingDescriptor raTypeBinding : sbbDescriptor . getResourceAdaptorTypeBindings ( ) ) { for ( ResourceAdaptorEntityBindingDescriptor raEntityBinding : raTypeBinding . getResourceAdaptorEntityBinding ( ) ) { String raLink = raEntityBinding . getResourceAdaptorEntityLink ( ) ; // Add the dependency
 dc . dependencies . add ( raLink ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( raLink ) ; } } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/profile-spec-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Profile Specification Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 ProfileSpecificationDescriptorFactory psdf = componentDescriptorFactory . getProfileSpecificationDescriptorFactory ( ) ; List < ? extends ProfileSpecificationDescriptor > psDescriptors = psdf . parse ( is ) ; // Get a list of the profile specifications in the
 // deployable unit.
 if ( psDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no profile-spec definitions" ) ; return null ; } // Iterate through the profile spec nodes
 for ( ProfileSpecificationDescriptor psDescriptor : psDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = PROFILESPEC_COMPONENT ; // Get the Component ID
 dc . componentID = psDescriptor . getProfileSpecificationID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > psDependencies = psDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : psDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/event-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Event Definition Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 EventTypeDescriptorFactory etdf = componentDescriptorFactory . getEventTypeDescriptorFactory ( ) ; List < ? extends EventTypeDescriptor > etDescriptors = etdf . parse ( is ) ; if ( etDescriptors == null || etDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no event-type definitions" ) ; return null ; } for ( EventTypeDescriptor etDescriptor : etDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = EVENTTYPE_COMPONENT ; // Get the Component ID
 dc . componentID = etDescriptor . getEventTypeID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > etDependencies = etDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : etDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/resource-adaptor-type-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Resource Adaptor Type Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 ResourceAdaptorTypeDescriptorFactory ratdf = componentDescriptorFactory . getResourceAdaptorTypeDescriptorFactory ( ) ; List < ? extends ResourceAdaptorTypeDescriptor > ratDescriptors = ratdf . parse ( is ) ; if ( ratDescriptors == null || ratDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no resource-adaptor-type definitions" ) ; return null ; } // Go through all the Resource Adaptor Type Elements
 for ( ResourceAdaptorTypeDescriptor ratDescriptor : ratDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = RATYPE_COMPONENT ; // Get the Component ID
 dc . componentID = ratDescriptor . getResourceAdaptorTypeID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > ratDependencies = ratDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : ratDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/resource-adaptor-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Resource Adaptor Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 ResourceAdaptorDescriptorFactory radf = componentDescriptorFactory . getResourceAdaptorDescriptorFactory ( ) ; List < ? extends ResourceAdaptorDescriptor > raDescriptors = radf . parse ( is ) ; DeployConfigParser sleeDeployConfigParser = sleeContainerDeployer . getSLEEDeployConfigParser ( ) ; // Go through all the Resource Adaptor Elements
 for ( ResourceAdaptorDescriptor raDescriptor : raDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = RA_COMPONENT ; // Set the Component ID
 dc . componentID = raDescriptor . getResourceAdaptorID ( ) ; // Set the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > raDependencies = raDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : raDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } // get management actions for this ra, in SLEE's deploy config
 if ( sleeDeployConfigParser != null ) { Collection < ManagementAction > managementActions = sleeDeployConfigParser . getPostInstallActions ( ) . get ( dc . getComponentKey ( ) ) ; if ( managementActions != null ) { dc . installActions . addAll ( managementActions ) ; } managementActions = sleeDeployConfigParser . getPreUninstallActions ( ) . get ( dc . getComponentKey ( ) ) ; if ( managementActions != null ) { dc . uninstallActions . addAll ( managementActions ) ; } } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/library-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Library Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 LibraryDescriptorFactory ldf = componentDescriptorFactory . getLibraryDescriptorFactory ( ) ; List < ? extends LibraryDescriptor > libraryDescriptors = ldf . parse ( is ) ; // Go through all the Resource Adaptor Elements
 for ( LibraryDescriptor libraryDescriptor : libraryDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = LIBRARY_COMPONENT ; // Set the Component ID
 dc . componentID = libraryDescriptor . getLibraryID ( ) ; // Set the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > libraryDependencies = libraryDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : libraryDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else { logger . warn ( "\r\n--------------------------------------------------------------------------------\r\n" + "No Component Descriptor found in '" + duWrapper . getFileName ( ) + "'.\r\n" + "--------------------------------------------------------------------------------" ) ; return new ArrayList < DeployableComponent > ( ) ; } } finally { } return deployableComponents ; }
Parser for the deployment descriptor. Minimal version obtained from
Container.

@return a String containing the Component ID.
@throws IOException
Parser for the deployment descriptor . Minimal version obtained from Container .