code: public void deployResource(Resource resource, int options)
      {
      	String name = resource.getSymbolicName() + "/" + resource.getVersion();
          
      	Lock lock = this.getLock(name);
          try {
  	        boolean acquired = lock.tryLock();
  			if (acquired) {	// Good, deploy this resource
  			    try {
  			        Resolver resolver = repositoryAdmin.resolver();
  			        resolver.add(resource);
  			        int resolveAttempt = 5;
  			        while (resolveAttempt-- > 0)
  			        {
  			            try {
  			                if (resolver.resolve(options))
  			                {
  			                    resolver.deploy(options);
  			                    break;     // Resolve successful, exception thrown on previous instruction if not
  			                } else {
  			                    Reason[] reqs = resolver.getUnsatisfiedRequirements();
  			                    for (int i = 0; i < reqs.length; i++) {
  			                        ClassServiceUtility.log(bundleContext, LogService.LOG_ERROR, "Unable to resolve: " + reqs[i]);
  			                    }
  			                    break;     // Resolve unsuccessful, but it did finish
  			                }
  			            } catch (IllegalStateException e) {
  			                // If resolve unsuccessful, try again
  			                if (resolveAttempt == 0)
  			                    e.printStackTrace();
  			            }
  			        }
  			    } finally {
  			        lock.unlock();
  			    }
  			} else {	// Lock was not acquired, wait until it is unlocked and return (resource should be deployed by then)
  				acquired = lock.tryLock(secondsToWait, TimeUnit.SECONDS);
  				if (acquired) {
  				    try {
  				        // Success
  				    } finally {
  				        lock.unlock();
  				    }
  				} else {
  				    // failure code here
  				}
  			}
  		} catch (InterruptedException e) {
  			e.printStackTrace();
  		} finally {
  			this.removeLock(name);
  		}
      }
docs: Deploy this resource.
  @param resource
  @param options