brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [07/12] incubator-brooklyn git commit: [BROOKLYN-183] Re-add deleted interfaces with deprecated annotation
Date Wed, 28 Oct 2015 00:56:31 GMT
[BROOKLYN-183] Re-add deleted interfaces with deprecated annotation

Implemented in terms of newer classes and/or functions during OSGification.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/a145b55c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/a145b55c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/a145b55c

Branch: refs/heads/master
Commit: a145b55c9edff4776fb807467a75eb8c43904d8e
Parents: a929b7b
Author: Ciprian Ciubotariu <cheepeero@gmx.net>
Authored: Tue Oct 27 22:29:14 2015 +0200
Committer: Ciprian Ciubotariu <cheepeero@gmx.net>
Committed: Tue Oct 27 22:29:14 2015 +0200

----------------------------------------------------------------------
 .../core/mgmt/persist/XmlMementoSerializer.java |  4 +-
 .../apache/brooklyn/util/core/osgi/Osgis.java   | 66 +++++++++++++++++++-
 2 files changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a145b55c/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
index 6e1ac65..3d2ecef 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
@@ -352,7 +352,7 @@ public class XmlMementoSerializer<T> extends XmlSerializer<T>
implements Memento
     // Perhaps context.getRequiredType(); can be used instead?
     // Other users of xstream (e.g. jenkinsci) manually check for resoved-to and class attributes
     //   for compatibility with older versions of xstream
-    public static Class readClassType(HierarchicalStreamReader reader, Mapper mapper) {
+    private static Class readClassType(HierarchicalStreamReader reader, Mapper mapper) {
         String classAttribute = readClassAttribute(reader, mapper);
         Class type;
         if (classAttribute == null) {
@@ -363,7 +363,7 @@ public class XmlMementoSerializer<T> extends XmlSerializer<T>
implements Memento
         return type;
     }
 
-    public static String readClassAttribute(HierarchicalStreamReader reader, Mapper mapper)
{
+    private static String readClassAttribute(HierarchicalStreamReader reader, Mapper mapper)
{
         String attributeName = mapper.aliasForSystemAttribute("resolves-to");
         String classAttribute = attributeName == null ? null : reader.getAttribute(attributeName);
         if (classAttribute == null) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a145b55c/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java b/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
index f3603d8..006604d 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/osgi/Osgis.java
@@ -51,12 +51,15 @@ import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.Strings;
 
 import com.google.common.annotations.Beta;
+import com.google.common.base.Function;
 import com.google.common.base.Joiner;
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
+import java.util.Map;
 import org.apache.brooklyn.util.osgi.OsgiUtils;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.launch.FrameworkFactory;
 
 /** 
  * utilities for working with osgi.
@@ -71,7 +74,23 @@ public class Osgis {
     private static final String EXTENSION_PROTOCOL = "system";
     private static final Set<String> SYSTEM_BUNDLES = MutableSet.of();
 
-    
+    /** @deprecated since 0.9.0, replaced with {@link org.apache.brooklyn.util.osgi.VersionedName}
*/
+    @Deprecated
+    public static class VersionedName extends org.apache.brooklyn.util.osgi.VersionedName
{
+
+        private VersionedName(org.apache.brooklyn.util.osgi.VersionedName src) {
+            super(src.getSymbolicName(), src.getVersion());
+        }
+
+        public VersionedName(Bundle b) {
+            super(b);
+        }
+
+        public VersionedName(String symbolicName, Version version) {
+            super(symbolicName, version);
+        }
+    }
+
     public static class BundleFinder {
         protected final Framework framework;
         protected String symbolicName;
@@ -98,14 +117,14 @@ public class Osgis {
             if (Strings.isBlank(symbolicNameOptionallyWithVersion))
                 return this;
             
-            Maybe<VersionedName> nv = OsgiUtils.parseOsgiIdentifier(symbolicNameOptionallyWithVersion);
+            Maybe<org.apache.brooklyn.util.osgi.VersionedName> nv = OsgiUtils.parseOsgiIdentifier(symbolicNameOptionallyWithVersion);
             if (nv.isAbsent())
                 throw new IllegalArgumentException("Cannot parse symbolic-name:version string
'"+symbolicNameOptionallyWithVersion+"'");
 
             return id(nv.get());
         }
 
-        private BundleFinder id(VersionedName nv) {
+        private BundleFinder id(org.apache.brooklyn.util.osgi.VersionedName nv) {
             symbolicName(nv.getSymbolicName());
             if (nv.getVersion() != null) {
                 version(nv.getVersion().toString());
@@ -277,6 +296,18 @@ public class Osgis {
         return bundleFinder(framework).symbolicName(symbolicName).version(Predicates.equalTo(version)).findUnique();
     }
 
+    /** @deprecated since 0.9.0, replaced by {@link EmbeddedFelixFramework#newFrameworkFactory()
*/
+    @Deprecated
+    public static FrameworkFactory newFrameworkFactory() {
+        return EmbeddedFelixFramework.newFrameworkFactory();
+    }
+
+    /** @deprecated since 0.9.0, replaced by {@link #getFramework(java.lang.String, boolean)
} */
+    @Deprecated
+    public static Framework newFrameworkStarted(String felixCacheDir, boolean clean, Map<?,?>
extraStartupConfig) {
+        return getFramework(felixCacheDir, clean);
+    }
+
     /** 
      * Provides an OSGI framework.
      *
@@ -329,6 +360,18 @@ public class Osgis {
         return FrameworkUtil.getBundle(Framework.class) != null;
     }
 
+    /** @deprecated since 0.9.0, replaced with {@link OsgiUtils#getVersionedId(org.osgi.framework.Bundle)
} */
+    @Deprecated
+    public static String getVersionedId(Bundle b) {
+        return OsgiUtils.getVersionedId(b);
+    }
+
+    /** @deprecated since 0.9.0, replaced with {@link OsgiUtils#getVersionedId(java.util.jar.Manifest)
} */
+    @Deprecated
+    public static String getVersionedId(Manifest manifest) {
+        return OsgiUtils.getVersionedId(manifest);
+    }
+
     /**
      * Installs a bundle from the given URL, doing a check if already installed, and
      * using the {@link ResourceUtils} loader for this project (brooklyn core)
@@ -425,4 +468,21 @@ public class Osgis {
                 EXTENSION_PROTOCOL.equals(Urls.getProtocol(location));
     }
 
+    /** @deprecated since 0.9.0, replaced with {@link OsgiUtils#parseOsgiIdentifier(java.lang.String)
} */
+    @Deprecated
+    public static Maybe<VersionedName> parseOsgiIdentifier(String symbolicNameOptionalWithVersion)
{
+        final Maybe<org.apache.brooklyn.util.osgi.VersionedName> original = OsgiUtils.parseOsgiIdentifier(symbolicNameOptionalWithVersion);
+        return original.transform(new Function<org.apache.brooklyn.util.osgi.VersionedName,
VersionedName>() {
+            @Override
+            public VersionedName apply(org.apache.brooklyn.util.osgi.VersionedName input)
{
+                return new VersionedName(input);
+            }
+        });
+    }
+
+    /** @deprecated since 0.9.0, replaced with {@link org.apache.brooklyn.rt.felix.ManifestHelper}
*/
+    @Deprecated
+    public static class ManifestHelper extends org.apache.brooklyn.rt.felix.ManifestHelper
{
+
+    }
 }


Mime
View raw message