String resName = "META-INF/jbosgi-xservice.properties";
VirtualFile virtualFile = VirtualFileAttachment.getVirtualFileAttachment(context);
VirtualFile xserviceFile = virtualFile.getChild(resName);
if (xserviceFile.exists()) {
try {
OSGiMetaData metadata = OSGiMetaDataBuilder.load(xserviceFile.openStream());
String location = virtualFile.getPathName();
String symbolicName = metadata.getBundleSymbolicName();
Version version = metadata.getBundleVersion();
deployment = DeploymentFactory.createDeployment(AbstractVFS.adapt(virtualFile), location, symbolicName, version);
deployment.addAttachment(OSGiMetaData.class, metadata);