You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/03/28 18:33:24 UTC

[3/4] git commit: [KARAF-2859] Decouple features/core from persistent/core

[KARAF-2859] Decouple features/core from persistent/core

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/8bba2546
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/8bba2546
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/8bba2546

Branch: refs/heads/master
Commit: 8bba25467d56f96e5175863b386425c36b0ecfbe
Parents: 5f5239a
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Fri Mar 28 16:58:44 2014 +0100
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Fri Mar 28 16:58:44 2014 +0100

----------------------------------------------------------------------
 assemblies/features/framework/pom.xml           |   2 +
 .../framework/src/main/feature/feature.xml      |   1 -
 .../standard/src/main/feature/feature.xml       |   2 +-
 features/core/pom.xml                           |   1 +
 .../karaf/features/internal/BundleManager.java  |  26 +-
 .../internal/PersistentBundleManager.java       |  59 ++
 .../karaf/features/internal/osgi/Activator.java |  25 +-
 .../internal/FeaturesServiceImplTest.java       |   2 +-
 region/core/pom.xml                             | 121 +++-
 .../region/persist/internal/Activator.java      |  89 +++
 .../persist/internal/RegionsBundleTracker.java  |  77 +++
 .../internal/RegionsPersistenceImpl.java        | 202 ++++++
 .../internal/model/FilterAttributeType.java     |  94 +++
 .../internal/model/FilterBundleType.java        | 156 +++++
 .../internal/model/FilterNamespaceType.java     | 102 +++
 .../internal/model/FilterPackageType.java       | 129 ++++
 .../persist/internal/model/FilterType.java      | 195 ++++++
 .../persist/internal/model/ObjectFactory.java   | 116 ++++
 .../internal/model/RegionBundleType.java        |  94 +++
 .../persist/internal/model/RegionType.java      | 106 +++
 .../persist/internal/model/RegionsType.java     | 112 ++++
 .../persist/internal/model/package-info.java    |   9 +
 .../internal/util/ManifestHeaderProcessor.java  | 661 +++++++++++++++++++
 .../internal/util/ManifestHeaderUtils.java      |  85 +++
 .../persist/internal/util/VersionRange.java     | 456 +++++++++++++
 .../org/apache/karaf/region/persist/region.xsd  | 109 +++
 region/persist/NOTICE                           |  71 --
 region/persist/pom.xml                          | 129 ----
 .../region/persist/internal/Activator.java      |  89 ---
 .../persist/internal/RegionsBundleTracker.java  |  77 ---
 .../internal/RegionsPersistenceImpl.java        | 202 ------
 .../internal/model/FilterAttributeType.java     |  94 ---
 .../internal/model/FilterBundleType.java        | 156 -----
 .../internal/model/FilterNamespaceType.java     | 102 ---
 .../internal/model/FilterPackageType.java       | 129 ----
 .../persist/internal/model/FilterType.java      | 195 ------
 .../persist/internal/model/ObjectFactory.java   | 116 ----
 .../internal/model/RegionBundleType.java        |  94 ---
 .../persist/internal/model/RegionType.java      | 106 ---
 .../persist/internal/model/RegionsType.java     | 112 ----
 .../persist/internal/model/package-info.java    |   9 -
 .../internal/util/ManifestHeaderProcessor.java  | 661 -------------------
 .../internal/util/ManifestHeaderUtils.java      |  85 ---
 .../persist/internal/util/VersionRange.java     | 456 -------------
 .../org/apache/karaf/region/persist/region.xsd  | 109 ---
 region/pom.xml                                  |   1 -
 .../util/tracker/SingleServiceTracker.java      |   6 +
 47 files changed, 2971 insertions(+), 3059 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/assemblies/features/framework/pom.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/framework/pom.xml b/assemblies/features/framework/pom.xml
index 1b28a0d..4675b0a 100644
--- a/assemblies/features/framework/pom.xml
+++ b/assemblies/features/framework/pom.xml
@@ -361,6 +361,8 @@
                                 <excludedArtifactId>sshd-core</excludedArtifactId>
                                 <excludedArtifactId>jline</excludedArtifactId>
                                 <excludedArtifactId>core</excludedArtifactId>
+                                <excludedArtifactId>org.apache.karaf.region.core</excludedArtifactId>
+                                <excludedArtifactId>region</excludedArtifactId>
                             </excludedArtifactIds>
                         </configuration>
                     </execution>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/assemblies/features/framework/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/framework/src/main/feature/feature.xml b/assemblies/features/framework/src/main/feature/feature.xml
index 70315fb..51b97e5 100644
--- a/assemblies/features/framework/src/main/feature/feature.xml
+++ b/assemblies/features/framework/src/main/feature/feature.xml
@@ -33,7 +33,6 @@
         <!-- file install -->
         <bundle start="true" start-level="11">mvn:org.apache.felix/org.apache.felix.fileinstall/${felix.fileinstall.version}</bundle>
         <!-- features service -->
-        <bundle start="true" start-level="15">mvn:org.apache.karaf.region/org.apache.karaf.region.core/${project.version}</bundle>
         <bundle start="true" start-level="15">mvn:org.apache.karaf.features/org.apache.karaf.features.core/${project.version}</bundle>
     </feature>
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/assemblies/features/standard/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index 932fa72..6371ce3 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -151,7 +151,7 @@
 
     <feature name="region" description="Provide Region Support" version="${project.version}">
         <bundle start-level="30">mvn:org.eclipse.equinox/region/${equinox.region.version}</bundle>
-        <bundle start-level="30">mvn:org.apache.karaf.region/org.apache.karaf.region.persist/${project.version}</bundle>
+        <bundle start-level="30">mvn:org.apache.karaf.region/org.apache.karaf.region.core/${project.version}</bundle>
         <bundle start-level="30">mvn:org.apache.karaf.region/org.apache.karaf.region.command/${project.version}</bundle>
     </feature>
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/features/core/pom.xml
----------------------------------------------------------------------
diff --git a/features/core/pom.xml b/features/core/pom.xml
index e5f36db..b7efe10 100644
--- a/features/core/pom.xml
+++ b/features/core/pom.xml
@@ -113,6 +113,7 @@
                                 -noimport:=true
                         </Export-Package>
                         <Import-Package>
+                            org.apache.karaf.region.persist;resolution:=optional,
                             *
                         </Import-Package>
                         <Private-Package>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java b/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
index 04a5f5b..647fbb9 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java
@@ -65,30 +65,18 @@ public class BundleManager {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(BundleManager.class);
     private final BundleContext bundleContext;
-    private final RegionsPersistence regionsPersistence;
     private final long refreshTimeout;
 
     public BundleManager(BundleContext bundleContext) {
-        this(bundleContext, null);
+        this(bundleContext, 5000);
     }
 
-    public BundleManager(BundleContext bundleContext, RegionsPersistence regionsPersistence) {
-        this(bundleContext, regionsPersistence, 5000);
-    }
-
-    public BundleManager(BundleContext bundleContext, RegionsPersistence regionsPersistence, long refreshTimeout) {
+    public BundleManager(BundleContext bundleContext, long refreshTimeout) {
         this.bundleContext = bundleContext;
-        this.regionsPersistence = regionsPersistence;
         this.refreshTimeout = refreshTimeout;
     }
 
     public BundleInstallerResult installBundleIfNeeded(String bundleLocation, int startLevel, String regionName) throws IOException, BundleException {
-        BundleInstallerResult result = doInstallBundleIfNeeded(bundleLocation, startLevel);
-        installToRegion(regionName, result.bundle, result.isNew);
-        return result;
-    }
-
-    private BundleInstallerResult doInstallBundleIfNeeded(String bundleLocation, int startLevel) throws IOException, BundleException {
         InputStream is = getInputStreamForBundle(bundleLocation);
         try {
             is.mark(256 * 1024);
@@ -178,16 +166,6 @@ public class BundleManager {
         return is;
     }
 
-    private void installToRegion(String region, Bundle b, boolean isNew) throws BundleException {
-        if (region != null && isNew) {
-            if (regionsPersistence != null) {
-                regionsPersistence.install(b, region);
-            } else {
-                throw new RuntimeException("Unable to find RegionsPersistence service, while installing " + region);
-            }
-        }
-    }
-
     /**
      * Will wait for the {@link URLStreamHandlerService} service for the
      * specified protocol to be registered.

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/features/core/src/main/java/org/apache/karaf/features/internal/PersistentBundleManager.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/PersistentBundleManager.java b/features/core/src/main/java/org/apache/karaf/features/internal/PersistentBundleManager.java
new file mode 100644
index 0000000..30ff446
--- /dev/null
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/PersistentBundleManager.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.karaf.features.internal;
+
+import java.io.IOException;
+
+import org.apache.karaf.region.persist.RegionsPersistence;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class PersistentBundleManager extends BundleManager {
+
+    private final RegionsPersistence regionsPersistence;
+
+    public PersistentBundleManager(BundleContext bundleContext, RegionsPersistence regionsPersistence) {
+        super(bundleContext);
+        this.regionsPersistence = regionsPersistence;
+    }
+
+    public PersistentBundleManager(BundleContext bundleContext, long refreshTimeout, RegionsPersistence regionsPersistence) {
+        super(bundleContext, refreshTimeout);
+        this.regionsPersistence = regionsPersistence;
+    }
+
+    @Override
+    public BundleInstallerResult installBundleIfNeeded(String bundleLocation, int startLevel, String regionName) throws IOException, BundleException {
+        BundleInstallerResult result = super.installBundleIfNeeded(bundleLocation, startLevel, regionName);
+        installToRegion(regionName, result.bundle, result.isNew);
+        return result;
+    }
+
+    private void installToRegion(String region, Bundle bundle, boolean isNew) throws BundleException {
+        if (region != null && isNew) {
+            if (regionsPersistence != null) {
+                regionsPersistence.install(bundle, region);
+            } else {
+                throw new RuntimeException("Unable to find RegionsPersistence service, while installing " + region);
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java b/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
index c6abdb4..36e83ba 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/osgi/Activator.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Properties;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
@@ -36,8 +37,10 @@ import org.apache.karaf.features.internal.BundleManager;
 import org.apache.karaf.features.internal.FeatureConfigInstaller;
 import org.apache.karaf.features.internal.FeatureFinder;
 import org.apache.karaf.features.internal.FeaturesServiceImpl;
+import org.apache.karaf.features.internal.PersistentBundleManager;
 import org.apache.karaf.features.management.internal.FeaturesServiceMBeanImpl;
 import org.apache.karaf.region.persist.RegionsPersistence;
+import org.apache.karaf.util.locks.FileLockUtils;
 import org.apache.karaf.util.tracker.SingleServiceTracker;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -58,7 +61,7 @@ public class Activator implements BundleActivator, SingleServiceTracker.SingleSe
 
     private ExecutorService executor = Executors.newSingleThreadExecutor();
     private BundleContext bundleContext;
-    private SingleServiceTracker<RegionsPersistence> regionsPersistenceTracker;
+    private SingleServiceTracker regionsPersistenceTracker;
     private SingleServiceTracker<URLStreamHandlerService> mvnUrlHandlerTracker;
     private SingleServiceTracker<ConfigurationAdmin> configurationAdminTracker;
     private ServiceTracker<FeaturesListener, FeaturesListener> featuresListenerTracker;
@@ -71,8 +74,8 @@ public class Activator implements BundleActivator, SingleServiceTracker.SingleSe
     @Override
     public void start(BundleContext context) throws Exception {
         bundleContext = context;
-        regionsPersistenceTracker = new SingleServiceTracker<RegionsPersistence>(
-                bundleContext, RegionsPersistence.class, this
+        regionsPersistenceTracker = new SingleServiceTracker(
+                bundleContext, "org.apache.karaf.region.persist.RegionsPersistence", this
         );
         mvnUrlHandlerTracker = new SingleServiceTracker<URLStreamHandlerService>(
                 bundleContext, URLStreamHandlerService.class, "(url.handler.protocol=mvn)", this
@@ -96,7 +99,7 @@ public class Activator implements BundleActivator, SingleServiceTracker.SingleSe
 
     protected void doStart() {
         ConfigurationAdmin configurationAdmin = configurationAdminTracker.getService();
-        RegionsPersistence regionsPersistence = regionsPersistenceTracker.getService();
+        Object regionsPersistence = regionsPersistenceTracker.getService();
         URLStreamHandlerService mvnUrlHandler = mvnUrlHandlerTracker.getService();
 
         if (configurationAdmin == null || mvnUrlHandler == null) {
@@ -118,7 +121,19 @@ public class Activator implements BundleActivator, SingleServiceTracker.SingleSe
         props.put(Constants.SERVICE_PID, "org.apache.karaf.features.repos");
         featureFinderRegistration = bundleContext.registerService(ManagedService.class, featureFinder, props);
 
-        BundleManager bundleManager = new BundleManager(bundleContext, regionsPersistence);
+        BundleManager bundleManager;
+        if (regionsPersistence != null) {
+            final Object rg = regionsPersistence;
+            // Use an inner class to isolate from the region persistence package
+            bundleManager = new Callable<BundleManager>() {
+                @Override
+                public BundleManager call() {
+                    return new PersistentBundleManager(bundleContext, (RegionsPersistence) rg);
+                }
+            }.call();
+        } else {
+            bundleManager = new BundleManager(bundleContext);
+        }
         FeatureConfigInstaller configInstaller = new FeatureConfigInstaller(configurationAdmin);
         String featuresRepositories = getString(configuration, "featuresRepositories", "");
         boolean respectStartLvlDuringFeatureStartup = getBoolean(configuration, "respectStartLvlDuringFeatureStartup", true);

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/features/core/src/test/java/org/apache/karaf/features/internal/FeaturesServiceImplTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/internal/FeaturesServiceImplTest.java b/features/core/src/test/java/org/apache/karaf/features/internal/FeaturesServiceImplTest.java
index 120588b..4776bf4 100644
--- a/features/core/src/test/java/org/apache/karaf/features/internal/FeaturesServiceImplTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/internal/FeaturesServiceImplTest.java
@@ -165,7 +165,7 @@ public class FeaturesServiceImplTest extends TestBase {
 
     @Test
     public void testGetOptionalImportsOnly() {
-        BundleManager bundleManager = new BundleManager(null, null, 0l);
+        BundleManager bundleManager = new BundleManager(null, 0l);
 
         List<Clause> result = bundleManager.getOptionalImports("org.apache.karaf,org.apache.karaf.optional;resolution:=optional");
         assertEquals("One optional import expected", 1, result.size());

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/pom.xml
----------------------------------------------------------------------
diff --git a/region/core/pom.xml b/region/core/pom.xml
index 8882747..8e9fe95 100644
--- a/region/core/pom.xml
+++ b/region/core/pom.xml
@@ -1,24 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
 
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
 
     <parent>
         <groupId>org.apache.karaf.region</groupId>
@@ -28,10 +29,57 @@
 
     <artifactId>org.apache.karaf.region.core</artifactId>
     <packaging>bundle</packaging>
-    <name>Apache Karaf :: Region :: Core</name>
-    <description>This bundle provides an API for interacting with Regions.</description>
+    <name>Apache Karaf :: Region :: Persistence</name>
+    <description>This bundle provides an xml regions model and install/dump actions.</description>
 
-        <build>
+    <properties>
+        <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.util</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.equinox</groupId>
+            <artifactId>region</artifactId>
+            <version>1.0.0.v20110506</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
+		<dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
         <resources>
             <resource>
                 <directory>${project.basedir}/src/main/resources</directory>
@@ -39,6 +87,13 @@
                     <include>**/*</include>
                 </includes>
             </resource>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*.info</include>
+                </includes>
+            </resource>
         </resources>
         <plugins>
             <plugin>
@@ -46,22 +101,20 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Import-Package>
-                            *
-                        </Import-Package>
-                        <Export-Package>org.apache.karaf.region.persist;version="${project.version}"</Export-Package>
+                        <Bundle-Activator>
+                            org.apache.karaf.region.persist.internal.Activator
+                        </Bundle-Activator>
+                        <Export-Package>
+                            org.apache.karaf.region.persist;version="${project.version}"
+                        </Export-Package>
+                        <Private-Package>
+                            org.apache.karaf.region.persist.internal.*,
+                            org.apache.karaf.util.tracker
+                        </Private-Package>
                     </instructions>
                 </configuration>
             </plugin>
         </plugins>
     </build>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-</project>
\ No newline at end of file
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/Activator.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/Activator.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/Activator.java
new file mode 100644
index 0000000..4705818
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/Activator.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.karaf.region.persist.internal;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.karaf.region.persist.RegionsPersistence;
+import org.apache.karaf.util.tracker.SingleServiceTracker;
+import org.eclipse.equinox.region.RegionDigraph;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator implements BundleActivator {
+
+    private static final Logger log = LoggerFactory.getLogger(Activator.class);
+
+    private SingleServiceTracker<RegionDigraph> tracker;
+    private final AtomicReference<RegionsPersistenceImpl> persistence = new AtomicReference<RegionsPersistenceImpl>();
+    private final AtomicReference<RegionsBundleTracker> bundleTracker = new AtomicReference<RegionsBundleTracker>();
+    private ServiceRegistration<RegionsPersistence> reg;
+
+    @Override
+    public void start(final BundleContext bundleContext) throws Exception {
+        tracker = new SingleServiceTracker<RegionDigraph>(bundleContext, RegionDigraph.class, new SingleServiceTracker.SingleServiceListener() {
+            public void serviceFound() {
+                log.debug("Found RegionDigraph service, initializing");
+                RegionDigraph regionDigraph = tracker.getService();
+                Bundle framework = bundleContext.getBundle(0);
+                RegionsPersistenceImpl persistence = null;
+                try {
+                    persistence = new RegionsPersistenceImpl(regionDigraph, framework);
+                    reg = bundleContext.registerService(RegionsPersistence.class, persistence, null);
+
+                    RegionsBundleTracker bundleTracker = new RegionsBundleTracker();
+                    bundleTracker.start(bundleContext, persistence);
+                    Activator.this.bundleTracker.set(bundleTracker);
+                } catch (Exception e) {
+                    log.info("Could not create RegionsPersistenceImpl", e);
+                }
+                Activator.this.persistence.set(persistence);
+            }
+
+            public void serviceLost() {
+                if (reg != null) {
+                    reg.unregister();
+                    reg = null;
+                }
+                Activator.this.persistence.set(null);
+                Activator.this.bundleTracker.set(null);
+            }
+
+            public void serviceReplaced() {
+                //??
+            }
+        });
+        tracker.open();
+    }
+
+    @Override
+    public void stop(BundleContext bundleContext) throws Exception {
+        tracker.close();
+        persistence.set(null);
+        bundleTracker.set(null);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsBundleTracker.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsBundleTracker.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsBundleTracker.java
new file mode 100644
index 0000000..890fb58
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsBundleTracker.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.karaf.region.persist.internal;
+
+import org.apache.karaf.region.persist.RegionsPersistence;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.util.tracker.BundleTracker;
+import org.osgi.util.tracker.BundleTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RegionsBundleTracker {
+    private static final Logger log = LoggerFactory.getLogger(RegionsBundleTracker.class);
+
+    private BundleTracker bundleTracker;
+    private RegionsPersistence regionsPersistence;
+
+    void start(BundleContext bundleContext, RegionsPersistence regionsPersistence) {
+        this.regionsPersistence = regionsPersistence;
+        int stateMask = Bundle.INSTALLED;
+        bundleTracker = new BundleTracker(bundleContext, stateMask, new BundleTrackerCustomizer() {
+            @Override
+            public Object addingBundle(Bundle bundle, BundleEvent bundleEvent) {
+                return RegionsBundleTracker.this.addingBundle(bundle);
+            }
+
+            @Override
+            public void modifiedBundle(Bundle bundle, BundleEvent bundleEvent, Object o) {
+            }
+
+            @Override
+            public void removedBundle(Bundle bundle, BundleEvent bundleEvent, Object o) {
+            }
+        });
+        bundleTracker.open();
+    }
+
+    private Object addingBundle(Bundle bundle) {
+        String region = bundle.getHeaders().get("Region");
+        if (region != null) {
+            try {
+                regionsPersistence.install(bundle, region);
+                log.debug("Installed bundle " + bundle + " in region " + region);
+                return bundle;
+            } catch (BundleException e) {
+                log.info("Could not install bundle " + bundle + " in region " + region, e);
+            }
+        }
+        return null;
+    }
+
+    void stop() {
+        bundleTracker.close();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsPersistenceImpl.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsPersistenceImpl.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsPersistenceImpl.java
new file mode 100644
index 0000000..9cfda9f
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/RegionsPersistenceImpl.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.karaf.region.persist.internal;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import org.apache.karaf.region.persist.RegionsPersistence;
+import org.apache.karaf.region.persist.internal.model.FilterAttributeType;
+import org.apache.karaf.region.persist.internal.model.FilterBundleType;
+import org.apache.karaf.region.persist.internal.model.FilterNamespaceType;
+import org.apache.karaf.region.persist.internal.model.FilterPackageType;
+import org.apache.karaf.region.persist.internal.model.FilterType;
+import org.apache.karaf.region.persist.internal.model.RegionBundleType;
+import org.apache.karaf.region.persist.internal.model.RegionType;
+import org.apache.karaf.region.persist.internal.model.RegionsType;
+import org.apache.karaf.region.persist.internal.util.ManifestHeaderProcessor;
+import org.eclipse.equinox.region.Region;
+import org.eclipse.equinox.region.RegionDigraph;
+import org.eclipse.equinox.region.RegionFilterBuilder;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRevision;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RegionsPersistenceImpl implements RegionsPersistence {
+
+    private static final Logger log = LoggerFactory.getLogger(RegionsPersistenceImpl.class);
+
+    private JAXBContext jaxbContext;
+    private RegionDigraph regionDigraph;
+    private Region kernel;
+    private Bundle framework;
+
+    public RegionsPersistenceImpl(RegionDigraph regionDigraph, Bundle framework) throws JAXBException, BundleException, IOException, InvalidSyntaxException {
+        log.info("Loading region digraph persistence");
+        this.framework = framework;
+        this.regionDigraph = regionDigraph;
+        kernel = regionDigraph.getRegion(0);
+        jaxbContext = JAXBContext.newInstance(RegionsType.class);
+        load();
+    }
+
+    @Override
+    public void install(Bundle b, String regionName) throws BundleException {
+        Region region = regionDigraph.getRegion(regionName);
+        if (region == null) {
+            region = regionDigraph.createRegion(regionName);
+        }
+        kernel.removeBundle(b);
+        region.addBundle(b);
+    }
+
+    void save(RegionsType regionsType, Writer out) throws JAXBException {
+        Marshaller marshaller = jaxbContext.createMarshaller();
+        marshaller.marshal(regionsType, out);
+    }
+
+    void load() throws IOException, BundleException, JAXBException, InvalidSyntaxException {
+        if (this.regionDigraph.getRegions().size() <= 1) {
+            File etc = new File(System.getProperty("karaf.etc"));
+            File regionsConfig = new File(etc, "regions-config.xml");
+            if (regionsConfig.exists()) {
+                log.info("initializing region digraph from etc/regions-config.xml");
+                Reader in = new FileReader(regionsConfig);
+                try {
+                        load(this.regionDigraph, in);
+                    } finally {
+                        in.close();
+                    }
+            } else {
+                log.info("no regions config file");
+            }
+        }
+
+    }
+
+    void  load(RegionDigraph regionDigraph, Reader in) throws JAXBException, BundleException, InvalidSyntaxException {
+        RegionsType regionsType = load(in);
+        load(regionsType, regionDigraph);
+    }
+
+    RegionsType load(Reader in) throws JAXBException {
+        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+        return (RegionsType) unmarshaller.unmarshal(in);
+    }
+
+    void load(RegionsType regionsType, RegionDigraph regionDigraph) throws BundleException, InvalidSyntaxException {
+        BundleContext frameworkContext = framework.getBundleContext();
+        for (RegionType regionType: regionsType.getRegion()) {
+            String name = regionType.getName();
+            log.debug("Creating region: " + name);
+            Region region = regionDigraph.createRegion(name);
+            for (RegionBundleType bundleType: regionType.getBundle()) {
+                if (bundleType.getId() != null) {
+                    region.addBundle(bundleType.getId());
+                } else {
+                    Bundle b = frameworkContext.getBundle(bundleType.getLocation());
+                    region.addBundle(b);
+                }
+            }
+        }
+        for (FilterType filterType: regionsType.getFilter()) {
+            Region from = regionDigraph.getRegion(filterType.getFrom());
+            Region to = regionDigraph.getRegion(filterType.getTo());
+            log.debug("Creating filter between " + from.getName() + " to " + to.getName());
+            RegionFilterBuilder builder = regionDigraph.createRegionFilterBuilder();
+            for (FilterBundleType bundleType: filterType.getBundle()) {
+                String symbolicName = bundleType.getSymbolicName();
+                String version = bundleType.getVersion();
+                if (bundleType.getId() != null) {
+                    Bundle b = frameworkContext.getBundle(bundleType.getId());
+                    symbolicName = b.getSymbolicName();
+                    version = b.getVersion().toString();
+                }
+                String namespace = BundleRevision.BUNDLE_NAMESPACE;
+                List<FilterAttributeType> attributeTypes = bundleType.getAttribute();
+                buildFilter(symbolicName, version, namespace, attributeTypes, builder);
+            }
+            for (FilterPackageType packageType: filterType.getPackage()) {
+                String packageName = packageType.getName();
+                String version = packageType.getVersion();
+                String namespace = BundleRevision.PACKAGE_NAMESPACE;
+                List<FilterAttributeType> attributeTypes = packageType.getAttribute();
+                buildFilter(packageName, version, namespace, attributeTypes, builder);
+            }
+            if (to == kernel) {
+                //add framework exports
+                BundleRevision rev = framework.adapt(BundleRevision.class);
+                List<BundleCapability> caps = rev.getDeclaredCapabilities(BundleRevision.PACKAGE_NAMESPACE);
+                for (BundleCapability cap : caps) {
+                    String filter = ManifestHeaderProcessor.generateFilter(filter(cap.getAttributes()));
+                    builder.allow(BundleRevision.PACKAGE_NAMESPACE, filter);
+                }
+            }
+            //TODO explicit services?
+            for (FilterNamespaceType namespaceType: filterType.getNamespace()) {
+                String namespace = namespaceType.getName();
+                HashMap<String, Object> attributes = new HashMap<String, Object>();
+                for (FilterAttributeType attributeType: namespaceType.getAttribute()) {
+                    attributes.put(attributeType.getName(), attributeType.getValue());
+                }
+                String filter = ManifestHeaderProcessor.generateFilter(attributes);
+                builder.allow(namespace, filter);
+            }
+            regionDigraph.connect(from, builder.build(), to);
+        }
+    }
+
+    private Map<String, Object> filter(Map<String, Object> attributes) {
+        Map<String, Object> result = new HashMap<String, Object>(attributes);
+        result.remove("bundle-version");
+        result.remove("bundle-symbolic-name");
+        return result;
+    }
+
+    private void buildFilter(String packageName, String version, String namespace, List<FilterAttributeType> attributeTypes, RegionFilterBuilder builder) throws InvalidSyntaxException {
+        HashMap<String, Object> attributes = new HashMap<String, Object>();
+        if (namespace != null) {
+            attributes.put(namespace, packageName);
+        }
+        if (version != null) {
+            attributes.put("version", version);
+        }
+        for (FilterAttributeType attributeType: attributeTypes) {
+            attributes.put(attributeType.getName(), attributeType.getValue());
+        }
+        String filter = ManifestHeaderProcessor.generateFilter(attributes);
+        builder.allow(namespace, filter);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterAttributeType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterAttributeType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterAttributeType.java
new file mode 100644
index 0000000..857c2b3
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterAttributeType.java
@@ -0,0 +1,94 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for filterAttributeType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="filterAttributeType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterAttributeType")
+public class FilterAttributeType {
+
+    @XmlAttribute(required = true)
+    protected String name;
+    @XmlAttribute(required = true)
+    protected String value;
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    /**
+     * Gets the value of the value property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the value of the value property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterBundleType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterBundleType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterBundleType.java
new file mode 100644
index 0000000..a9a9fbb
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterBundleType.java
@@ -0,0 +1,156 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for filterBundleType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="filterBundleType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="attribute" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterAttributeType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}long" />
+ *       &lt;attribute name="symbolic-name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterBundleType", propOrder = {
+    "attribute"
+})
+public class FilterBundleType {
+
+    protected List<FilterAttributeType> attribute;
+    @XmlAttribute
+    protected Long id;
+    @XmlAttribute(name = "symbolic-name")
+    protected String symbolicName;
+    @XmlAttribute
+    protected String version;
+
+    /**
+     * Gets the value of the attribute property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the attribute property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAttribute().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterAttributeType }
+     * 
+     * 
+     */
+    public List<FilterAttributeType> getAttribute() {
+        if (attribute == null) {
+            attribute = new ArrayList<FilterAttributeType>();
+        }
+        return this.attribute;
+    }
+
+    /**
+     * Gets the value of the id property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Long }
+     *     
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Long }
+     *     
+     */
+    public void setId(Long value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets the value of the symbolicName property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getSymbolicName() {
+        return symbolicName;
+    }
+
+    /**
+     * Sets the value of the symbolicName property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setSymbolicName(String value) {
+        this.symbolicName = value;
+    }
+
+    /**
+     * Gets the value of the version property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets the value of the version property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setVersion(String value) {
+        this.version = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterNamespaceType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterNamespaceType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterNamespaceType.java
new file mode 100644
index 0000000..52b937a
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterNamespaceType.java
@@ -0,0 +1,102 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for filterNamespaceType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="filterNamespaceType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="attribute" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterAttributeType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterNamespaceType", propOrder = {
+    "attribute"
+})
+public class FilterNamespaceType {
+
+    protected List<FilterAttributeType> attribute;
+    @XmlAttribute(required = true)
+    protected String name;
+
+    /**
+     * Gets the value of the attribute property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the attribute property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAttribute().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterAttributeType }
+     * 
+     * 
+     */
+    public List<FilterAttributeType> getAttribute() {
+        if (attribute == null) {
+            attribute = new ArrayList<FilterAttributeType>();
+        }
+        return this.attribute;
+    }
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterPackageType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterPackageType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterPackageType.java
new file mode 100644
index 0000000..b4216ee
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterPackageType.java
@@ -0,0 +1,129 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for filterPackageType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="filterPackageType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="attribute" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterAttributeType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterPackageType", propOrder = {
+    "attribute"
+})
+public class FilterPackageType {
+
+    protected List<FilterAttributeType> attribute;
+    @XmlAttribute
+    protected String name;
+    @XmlAttribute
+    protected String version;
+
+    /**
+     * Gets the value of the attribute property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the attribute property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAttribute().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterAttributeType }
+     * 
+     * 
+     */
+    public List<FilterAttributeType> getAttribute() {
+        if (attribute == null) {
+            attribute = new ArrayList<FilterAttributeType>();
+        }
+        return this.attribute;
+    }
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    /**
+     * Gets the value of the version property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets the value of the version property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setVersion(String value) {
+        this.version = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterType.java
new file mode 100644
index 0000000..f4d1352
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/FilterType.java
@@ -0,0 +1,195 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for filterType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="filterType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="bundle" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterBundleType" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element name="package" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterPackageType" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element name="namespace" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterNamespaceType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="from" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="to" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "filterType", propOrder = {
+    "bundle",
+    "_package",
+    "namespace"
+})
+public class FilterType {
+
+    protected List<FilterBundleType> bundle;
+    @XmlElement(name = "package")
+    protected List<FilterPackageType> _package;
+    protected List<FilterNamespaceType> namespace;
+    @XmlAttribute(required = true)
+    protected String from;
+    @XmlAttribute(required = true)
+    protected String to;
+
+    /**
+     * Gets the value of the bundle property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the bundle property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getBundle().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterBundleType }
+     * 
+     * 
+     */
+    public List<FilterBundleType> getBundle() {
+        if (bundle == null) {
+            bundle = new ArrayList<FilterBundleType>();
+        }
+        return this.bundle;
+    }
+
+    /**
+     * Gets the value of the package property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the package property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getPackage().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterPackageType }
+     * 
+     * 
+     */
+    public List<FilterPackageType> getPackage() {
+        if (_package == null) {
+            _package = new ArrayList<FilterPackageType>();
+        }
+        return this._package;
+    }
+
+    /**
+     * Gets the value of the namespace property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the namespace property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getNamespace().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterNamespaceType }
+     * 
+     * 
+     */
+    public List<FilterNamespaceType> getNamespace() {
+        if (namespace == null) {
+            namespace = new ArrayList<FilterNamespaceType>();
+        }
+        return this.namespace;
+    }
+
+    /**
+     * Gets the value of the from property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getFrom() {
+        return from;
+    }
+
+    /**
+     * Sets the value of the from property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setFrom(String value) {
+        this.from = value;
+    }
+
+    /**
+     * Gets the value of the to property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTo() {
+        return to;
+    }
+
+    /**
+     * Sets the value of the to property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTo(String value) {
+        this.to = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/ObjectFactory.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/ObjectFactory.java
new file mode 100644
index 0000000..54f5f3c
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/ObjectFactory.java
@@ -0,0 +1,116 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the org.apache.karaf.region.persist.internal.model package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+    private final static QName _Regions_QNAME = new QName("http://karaf.apache.org/xmlns/region/v1.0.0", "regions");
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.karaf.region.persist.internal.model
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link FilterNamespaceType }
+     * 
+     */
+    public FilterNamespaceType createFilterNamespaceType() {
+        return new FilterNamespaceType();
+    }
+
+    /**
+     * Create an instance of {@link FilterType }
+     * 
+     */
+    public FilterType createFilterType() {
+        return new FilterType();
+    }
+
+    /**
+     * Create an instance of {@link RegionBundleType }
+     * 
+     */
+    public RegionBundleType createRegionBundleType() {
+        return new RegionBundleType();
+    }
+
+    /**
+     * Create an instance of {@link FilterBundleType }
+     * 
+     */
+    public FilterBundleType createFilterBundleType() {
+        return new FilterBundleType();
+    }
+
+    /**
+     * Create an instance of {@link FilterPackageType }
+     * 
+     */
+    public FilterPackageType createFilterPackageType() {
+        return new FilterPackageType();
+    }
+
+    /**
+     * Create an instance of {@link FilterAttributeType }
+     * 
+     */
+    public FilterAttributeType createFilterAttributeType() {
+        return new FilterAttributeType();
+    }
+
+    /**
+     * Create an instance of {@link RegionType }
+     * 
+     */
+    public RegionType createRegionType() {
+        return new RegionType();
+    }
+
+    /**
+     * Create an instance of {@link RegionsType }
+     * 
+     */
+    public RegionsType createRegionsType() {
+        return new RegionsType();
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link RegionsType }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://karaf.apache.org/xmlns/region/v1.0.0", name = "regions")
+    public JAXBElement<RegionsType> createRegions(RegionsType value) {
+        return new JAXBElement<RegionsType>(_Regions_QNAME, RegionsType.class, null, value);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionBundleType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionBundleType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionBundleType.java
new file mode 100644
index 0000000..7ba3585
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionBundleType.java
@@ -0,0 +1,94 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for regionBundleType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="regionBundleType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *       &lt;/sequence>
+ *       &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}long" />
+ *       &lt;attribute name="location" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "regionBundleType")
+public class RegionBundleType {
+
+    @XmlAttribute
+    protected Long id;
+    @XmlAttribute
+    protected String location;
+
+    /**
+     * Gets the value of the id property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Long }
+     *     
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Long }
+     *     
+     */
+    public void setId(Long value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets the value of the location property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getLocation() {
+        return location;
+    }
+
+    /**
+     * Sets the value of the location property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setLocation(String value) {
+        this.location = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionType.java
new file mode 100644
index 0000000..f7a810d
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionType.java
@@ -0,0 +1,106 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * 
+ *                 Regions element
+ *             
+ * 
+ * <p>Java class for regionType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="regionType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="bundle" type="{http://karaf.apache.org/xmlns/region/v1.0.0}regionBundleType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "regionType", propOrder = {
+    "bundle"
+})
+public class RegionType {
+
+    protected List<RegionBundleType> bundle;
+    @XmlAttribute(required = true)
+    protected String name;
+
+    /**
+     * Gets the value of the bundle property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the bundle property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getBundle().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link RegionBundleType }
+     * 
+     * 
+     */
+    public List<RegionBundleType> getBundle() {
+        if (bundle == null) {
+            bundle = new ArrayList<RegionBundleType>();
+        }
+        return this.bundle;
+    }
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionsType.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionsType.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionsType.java
new file mode 100644
index 0000000..be172e4
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/RegionsType.java
@@ -0,0 +1,112 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+
+package org.apache.karaf.region.persist.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * 
+ *                 Regions element
+ *             
+ * 
+ * <p>Java class for regionsType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="regionsType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="region" type="{http://karaf.apache.org/xmlns/region/v1.0.0}regionType" maxOccurs="unbounded" minOccurs="0"/>
+ *         &lt;element name="filter" type="{http://karaf.apache.org/xmlns/region/v1.0.0}filterType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlRootElement(name = "regions")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "regionsType", propOrder = {
+    "region",
+    "filter"
+})
+public class RegionsType {
+
+    protected List<RegionType> region;
+    protected List<FilterType> filter;
+
+    /**
+     * Gets the value of the region property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the region property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getRegion().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link RegionType }
+     * 
+     * 
+     */
+    public List<RegionType> getRegion() {
+        if (region == null) {
+            region = new ArrayList<RegionType>();
+        }
+        return this.region;
+    }
+
+    /**
+     * Gets the value of the filter property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the filter property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getFilter().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link FilterType }
+     * 
+     * 
+     */
+    public List<FilterType> getFilter() {
+        if (filter == null) {
+            filter = new ArrayList<FilterType>();
+        }
+        return this.filter;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8bba2546/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/package-info.java
----------------------------------------------------------------------
diff --git a/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/package-info.java b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/package-info.java
new file mode 100644
index 0000000..cae062c
--- /dev/null
+++ b/region/core/src/main/java/org/apache/karaf/region/persist/internal/model/package-info.java
@@ -0,0 +1,9 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2011.10.28 at 03:20:55 PM PDT 
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://karaf.apache.org/xmlns/region/v1.0.0", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.karaf.region.persist.internal.model;