[ONOS-5724],[ONOS-5725],[ONOS-5736] onos buck plugin modifications for support of private package property.

Change-Id: Ic3a2f13c14816e803debc208826445ef27b49a4f
diff --git a/apps/yms/app/BUCK b/apps/yms/app/BUCK
index 97bd7a4..be5b01b 100644
--- a/apps/yms/app/BUCK
+++ b/apps/yms/app/BUCK
@@ -7,5 +7,7 @@
 ]
 
 osgi_jar_with_tests(
+  name = 'onos-apps-yms-app',
   deps = COMPILE_DEPS,
+  #private_packages = 'org.onosproject.yangutils.datamodel.*,org.onosproject.yangutils.translator.*,org.onosproject.yangutils.linker.*,org.onosproject.yangutils.utils.*',
 )
diff --git a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java
index 0c4e22f..59d414f 100644
--- a/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java
+++ b/apps/yms/app/src/main/java/org/onosproject/yms/app/ysr/DefaultYangSchemaRegistry.java
@@ -140,26 +140,28 @@
 
     @Override
     public void registerApplication(Object appObject, Class<?> serviceClass) {
-        synchronized (serviceClass) {
+        synchronized (DefaultYangSchemaRegistry.class) {
             doPreProcessing(serviceClass, appObject);
             if (!verifyIfApplicationAlreadyRegistered(serviceClass)) {
                 BundleContext context = getBundle(serviceClass).getBundleContext();
-                Bundle[] bundles = context.getBundles();
-                Bundle bundle;
-                int len = bundles.length;
-                List<YangNode> curNodes;
-                String jarPath;
-                for (int i = len - 1; i >= 0; i--) {
-                    bundle = bundles[i];
-                    if (bundle.getSymbolicName().contains(ONOS)) {
-                        jarPath = getJarPathFromBundleLocation(
-                                bundle.getLocation(), context.getProperty(USER_DIRECTORY));
-                        curNodes = processJarParsingOperations(jarPath);
-                        // process application registration.
-                        if (curNodes != null && !curNodes.isEmpty()) {
-                            jarPathStore.put(serviceClass.getName(), jarPath);
-                            processRegistration(serviceClass, jarPath,
-                                                curNodes, appObject, false);
+                if (context != null) {
+                    Bundle[] bundles = context.getBundles();
+                    Bundle bundle;
+                    int len = bundles.length;
+                    List<YangNode> curNodes;
+                    String jarPath;
+                    for (int i = len - 1; i >= 0; i--) {
+                        bundle = bundles[i];
+                        if (bundle.getSymbolicName().contains(ONOS)) {
+                            jarPath = getJarPathFromBundleLocation(
+                                    bundle.getLocation(), context.getProperty(USER_DIRECTORY));
+                            curNodes = processJarParsingOperations(jarPath);
+                            // process application registration.
+                            if (curNodes != null && !curNodes.isEmpty()) {
+                                jarPathStore.put(serviceClass.getName(), jarPath);
+                                processRegistration(serviceClass, jarPath,
+                                                    curNodes, appObject, false);
+                            }
                         }
                     }
                 }
@@ -170,7 +172,7 @@
     @Override
     public void unRegisterApplication(Object managerObject,
                                       Class<?> serviceClass) {
-        synchronized (serviceClass) {
+        synchronized (DefaultYangSchemaRegistry.class) {
             YangSchemaNode curNode;
             String serviceName = serviceClass.getName();
 
@@ -296,7 +298,7 @@
 
     @Override
     public boolean verifyNotificationObject(Object appObj, Class<?> service) {
-        synchronized (service) {
+        synchronized (DefaultYangSchemaRegistry.class) {
             YangSchemaNode node = appNameKeyStore.get(service.getName());
             if (node == null) {
                 log.error("application is not registered with YMS {}",
@@ -336,7 +338,7 @@
     @Override
     public void processModuleLibrary(String serviceName,
                                      YangModuleLibrary library) {
-        synchronized (serviceName) {
+        synchronized (DefaultYangSchemaRegistry.class) {
             YangSchemaNode node = appNameKeyStore.get(serviceName);
             if (node != null) {
                 YangModuleInformation moduleInformation =