river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtra...@apache.org
Subject [5/7] git commit: AdminSvc now starts up in privileged mode and joins the workgroup. Classloader spec in deployer config now has an option to set "parent priority" or "application priority", in which setting "application priority" causes classes to be lo
Date Tue, 18 Feb 2014 03:06:51 GMT
AdminSvc now starts up in privileged mode and joins the workgroup.
Classloader spec in deployer config now has an option to set "parent priority" or "application priority", in which setting "application priority" causes classes to be loaded from the application in preference to the parent loader.


Project: http://git-wip-us.apache.org/repos/asf/river-container/repo
Commit: http://git-wip-us.apache.org/repos/asf/river-container/commit/317dac09
Tree: http://git-wip-us.apache.org/repos/asf/river-container/tree/317dac09
Diff: http://git-wip-us.apache.org/repos/asf/river-container/diff/317dac09

Branch: refs/heads/plugin-work
Commit: 317dac09de78169564215cef125a936abe99afe1
Parents: f3245a2
Author: Greg Trasuk <trasukg@trasuk.com>
Authored: Thu Jan 23 18:00:50 2014 -0500
Committer: Greg Trasuk <trasukg@trasuk.com>
Committed: Thu Jan 23 18:00:50 2014 -0500

----------------------------------------------------------------------
 .gitignore                                      |   7 +-
 admin-svc/admin-svc-api/pom.xml                 |  44 +++++
 .../apache/river/container/admin/api/Admin.java |  34 ++++
 .../container/admin/api/ApplicationInfo.java    |  24 +++
 .../container/admin/api/ApplicationStatus.java  |  29 +++
 .../river/container/admin/api/AppTest.java      |  38 ++++
 .../admin/api/ApplicationStatusTest.java        |  52 ++++++
 admin-svc/admin-svc-dl/pom.xml                  |  49 +++++
 .../river/container/admin/dl/AdminRemote.java   |  18 ++
 .../river/container/admin/dl/AppTest.java       |  38 ++++
 admin-svc/admin-svc-impl/pom.xml                |  65 +++++++
 .../river/container/admin/impl/AdminImpl.java   | 100 ++++++++++
 admin-svc/admin-svc-module/pom.xml              |  61 ++++++
 .../admin-svc-module/src/assemble/module.xml    |  67 +++++++
 .../src/main/root/admin-svc.config              |  38 ++++
 .../src/main/root/start.properties              |  20 ++
 admin-svc/pom.xml                               |  38 ++++
 pom.xml                                         |   3 +-
 product/pom.xml                                 |   5 +
 product/src/assemble/product-container.xml      |   7 +-
 product/src/main/root/bin/logging.properties    |   4 +-
 .../src/main/root/profile/default/config.xml    |  16 ++
 .../default/privileged-service-starter.cfg      | 100 ++++++++++
 .../apache/river/container/MessageNames.java    |   1 +
 .../org/apache/river/container/Strings.java     |   1 +
 .../java/org/apache/river/container/Utils.java  |  49 +++--
 .../VirtualFileSystemClassLoader.java           | 184 ++++++++++++++-----
 .../deployer/StarterServiceDeployer.java        |  42 +++--
 .../container/deployer/StartupDeployer.java     |  16 ++
 .../container/security/ContainerCodePolicy.java |  30 +--
 .../container/security/SecurityInitializer.java |  56 +++---
 .../src/main/jjtree/DeployerConfigParser.jjt    |  30 ++-
 .../apache/river/container/Messages.properties  |   1 +
 .../org/apache/river/container/core-config.xml  |   1 +
 .../deployer/DeployerConfigParserTest.java      |   3 +
 .../river/container/deployer/sample.config      |   2 +
 36 files changed, 1153 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index b2ae2aa..03e7b9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,9 @@
 *.jar
 *.war
 *.ear
-/target/
\ No newline at end of file
+/target/
+/admin-svc-api/nbproject/private/
+/admin-svc/admin-svc-api/target/
+/admin-svc/admin-svc-module/target/
+/admin-svc/admin-svc-impl/target/
+/admin-svc/admin-svc-dl/target/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-api/pom.xml
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-api/pom.xml b/admin-svc/admin-svc-api/pom.xml
new file mode 100644
index 0000000..fdd9ac1
--- /dev/null
+++ b/admin-svc/admin-svc-api/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+ 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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.river.container</groupId>
+        <artifactId>admin-svc</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.river.container</groupId>
+    <artifactId>admin-svc-api</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>admin-svc-api</name>
+    <url>http://maven.apache.org</url>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/Admin.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/Admin.java b/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/Admin.java
new file mode 100644
index 0000000..1af7375
--- /dev/null
+++ b/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/Admin.java
@@ -0,0 +1,34 @@
+/*
+ * 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.river.container.admin.api;
+
+import java.io.IOException;
+
+/**
+ * Administration interface for River Container.
+ */
+public interface Admin {
+    
+    /**
+     * List applications in the container.
+     * @return the applications.
+     * @throws java.io.IOException
+     */
+    public ApplicationInfo[] listApplications() throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationInfo.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationInfo.java b/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationInfo.java
new file mode 100644
index 0000000..df3f73b
--- /dev/null
+++ b/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationInfo.java
@@ -0,0 +1,24 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.river.container.admin.api;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ApplicationInfo implements Serializable {
+    String name;
+    ApplicationStatus status;
+
+    public ApplicationInfo(String name, ApplicationStatus status) {
+        this.name = name;
+        this.status = status;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationStatus.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationStatus.java b/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationStatus.java
new file mode 100644
index 0000000..4bbab7a
--- /dev/null
+++ b/admin-svc/admin-svc-api/src/main/java/org/apache/river/container/admin/api/ApplicationStatus.java
@@ -0,0 +1,29 @@
+/*
+ * 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.river.container.admin.api;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author trasukg
+ */
+public enum ApplicationStatus implements Serializable {
+    STOPPED,FAILED,RUNNING,UNKNOWN;
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/AppTest.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/AppTest.java b/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/AppTest.java
new file mode 100644
index 0000000..1780b29
--- /dev/null
+++ b/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/AppTest.java
@@ -0,0 +1,38 @@
+package org.apache.river.container.admin.api;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/ApplicationStatusTest.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/ApplicationStatusTest.java b/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/ApplicationStatusTest.java
new file mode 100644
index 0000000..fbd19a7
--- /dev/null
+++ b/admin-svc/admin-svc-api/src/test/java/org/apache/river/container/admin/api/ApplicationStatusTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.river.container.admin.api;
+
+
+import junit.framework.TestCase;
+import static junit.framework.Assert.*;
+
+import org.apache.river.container.admin.api.ApplicationStatus;
+import org.junit.Test;
+
+/**
+ *
+ * @author trasukg
+ */
+public class ApplicationStatusTest extends TestCase {
+    
+    public ApplicationStatusTest(String testName) {
+        super(testName);
+    }
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    @Test
+    public void testEnumString() {
+        assertEquals("String value of ApplicationStatus.RUNNING", "RUNNING", ApplicationStatus.RUNNING.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-dl/pom.xml
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-dl/pom.xml b/admin-svc/admin-svc-dl/pom.xml
new file mode 100644
index 0000000..9bdceff
--- /dev/null
+++ b/admin-svc/admin-svc-dl/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+ 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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.river.container</groupId>
+        <artifactId>admin-svc</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.river.container</groupId>
+    <artifactId>admin-svc-dl</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>admin-svc-dl</name>
+    <url>http://maven.apache.org</url>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>admin-svc-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-dl/src/main/java/org/apache/river/container/admin/dl/AdminRemote.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-dl/src/main/java/org/apache/river/container/admin/dl/AdminRemote.java b/admin-svc/admin-svc-dl/src/main/java/org/apache/river/container/admin/dl/AdminRemote.java
new file mode 100644
index 0000000..338f9cb
--- /dev/null
+++ b/admin-svc/admin-svc-dl/src/main/java/org/apache/river/container/admin/dl/AdminRemote.java
@@ -0,0 +1,18 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.river.container.admin.dl;
+
+import java.rmi.Remote;
+import org.apache.river.container.admin.api.Admin;
+
+/**
+ *
+ * @author trasukg
+ */
+public interface AdminRemote extends Admin, Remote {
+    
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-dl/src/test/java/org/apache/river/container/admin/dl/AppTest.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-dl/src/test/java/org/apache/river/container/admin/dl/AppTest.java b/admin-svc/admin-svc-dl/src/test/java/org/apache/river/container/admin/dl/AppTest.java
new file mode 100644
index 0000000..1579e76
--- /dev/null
+++ b/admin-svc/admin-svc-dl/src/test/java/org/apache/river/container/admin/dl/AppTest.java
@@ -0,0 +1,38 @@
+package org.apache.river.container.admin.dl;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-impl/pom.xml
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-impl/pom.xml b/admin-svc/admin-svc-impl/pom.xml
new file mode 100644
index 0000000..ee174b0
--- /dev/null
+++ b/admin-svc/admin-svc-impl/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+ 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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.river.container</groupId>
+        <artifactId>admin-svc</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.river.container</groupId>
+    <artifactId>admin-svc-impl</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>admin-svc-impl</name>
+    <url>http://maven.apache.org</url>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.jini</groupId>
+            <artifactId>jsk-lib</artifactId>
+            <version>2.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>admin-svc-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>admin-svc-dl</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>river-container-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-impl/src/main/java/org/apache/river/container/admin/impl/AdminImpl.java
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-impl/src/main/java/org/apache/river/container/admin/impl/AdminImpl.java b/admin-svc/admin-svc-impl/src/main/java/org/apache/river/container/admin/impl/AdminImpl.java
new file mode 100644
index 0000000..ca0de09
--- /dev/null
+++ b/admin-svc/admin-svc-impl/src/main/java/org/apache/river/container/admin/impl/AdminImpl.java
@@ -0,0 +1,100 @@
+/*
+ * 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.river.container.admin.impl;
+
+import com.sun.jini.config.Config;
+import com.sun.jini.start.LifeCycle;
+import java.io.IOException;
+import java.net.SocketPermission;
+import java.rmi.server.ExportException;
+import java.security.AccessController;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationException;
+import net.jini.config.ConfigurationProvider;
+import net.jini.core.entry.Entry;
+import net.jini.core.lookup.ServiceID;
+import net.jini.discovery.DiscoveryManagement;
+import net.jini.export.Exporter;
+import net.jini.lookup.JoinManager;
+import net.jini.lookup.ServiceIDListener;
+import net.jini.security.ProxyPreparer;
+import org.apache.river.container.MessageNames;
+import org.apache.river.container.Utils;
+import org.apache.river.container.admin.api.Admin;
+import org.apache.river.container.admin.api.ApplicationInfo;
+import org.apache.river.container.admin.api.ApplicationStatus;
+import org.apache.river.container.admin.dl.AdminRemote;
+
+/**
+ *
+ * @author trasukg
+ */
+public class AdminImpl implements ServiceIDListener, AdminRemote {
+
+    private static final Logger log
+            = Logger.getLogger(AdminImpl.class.getName(), MessageNames.BUNDLE_NAME);
+
+    private static final String COMPONENT_ID = "basic";
+
+    Configuration config = null;
+    Admin myProxy = null;
+    Exporter exporter = null;
+    ProxyPreparer registrarPreparer = null;
+    JoinManager joinManager = null;
+    DiscoveryManagement discoveryManager = null;
+    Entry[] attributes = null;
+
+    public AdminImpl(String args[], final LifeCycle lc) throws ConfigurationException, ExportException, IOException {
+
+        config = ConfigurationProvider.getInstance(args);
+        // Get the exporter and create our proxy.
+        exporter = (Exporter) Config.getNonNullEntry(config, COMPONENT_ID, "exporter", Exporter.class);
+        log.fine("\n");
+        org.apache.river.container.Utils.logClassLoaderHierarchy(log, this.getClass());
+        org.apache.river.container.Utils.logClassLoaderHierarchy(log, config.getClass());
+        log.fine("\n");
+        Utils.logGrantsToClass(log, Level.FINE, this.getClass());
+        try {
+            myProxy = (Admin) exporter.export(this);
+        } catch (SecurityException se) {
+            log.log(Level.SEVERE, "Caught security exception:", se);
+        }
+        discoveryManager = (DiscoveryManagement) config.getEntry(COMPONENT_ID, "discoveryManager", DiscoveryManagement.class);
+        attributes = (Entry[]) config.getEntry(COMPONENT_ID, "attributes", Entry[].class);
+
+        // Publish it using the join manager.
+        // We don't have to do anything with it - just creating it starts the join process.
+        joinManager = new JoinManager(myProxy, attributes, this, discoveryManager, null, config);
+        log.info("Started the admin service");
+    }
+
+    ServiceID sid = null;
+
+    public void serviceIDNotify(ServiceID sid) {
+        this.sid = sid;
+    }
+
+    public ApplicationInfo[] listApplications() throws IOException {
+        return new ApplicationInfo[]{
+            new ApplicationInfo("abc", ApplicationStatus.UNKNOWN)
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-module/pom.xml
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-module/pom.xml b/admin-svc/admin-svc-module/pom.xml
new file mode 100644
index 0000000..6cf4789
--- /dev/null
+++ b/admin-svc/admin-svc-module/pom.xml
@@ -0,0 +1,61 @@
+<?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>
+    <parent>
+        <artifactId>admin-svc</artifactId>
+        <groupId>org.apache.river.container</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.river.container</groupId>
+    <artifactId>admin-svc-module</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>admin-svc-module</name>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptor>src/assemble/module.xml</descriptor>
+                    <appendAssemblyId>false</appendAssemblyId>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>ssar</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        
+                    </execution>
+                </executions>
+            </plugin>
+            
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>admin-svc-impl</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-module/src/assemble/module.xml
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-module/src/assemble/module.xml b/admin-svc/admin-svc-module/src/assemble/module.xml
new file mode 100644
index 0000000..d8f36d3
--- /dev/null
+++ b/admin-svc/admin-svc-module/src/assemble/module.xml
@@ -0,0 +1,67 @@
+<!--
+ 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.
+
+-->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    
+    <id>ssar</id>
+    
+    <formats>
+        <format>jar</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+
+  <fileSets>
+
+        <fileSet>
+            <directory>${basedir}/src/main/root</directory>
+            <includes>
+                <include>**/**</include>
+                <include>*</include>
+            </includes>
+            <outputDirectory>/</outputDirectory>
+        </fileSet>
+  
+  </fileSets>    
+  <dependencySets>
+     
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <outputDirectory>/lib</outputDirectory>
+            <!-- jsk jars are already provided by the container. -->
+            <excludes>
+                <exclude>*:jsk-*</exclude>
+            </excludes>
+        </dependencySet>
+        
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <outputDirectory>/lib-dl</outputDirectory>
+            <includes>
+                <include>*:*-dl</include>
+                <include>*:*-api</include>
+            </includes>
+            <!-- jsk jars are already provided by the container. -->
+            <excludes>
+                <exclude>*:jsk-*</exclude>
+            </excludes>
+        </dependencySet>
+    </dependencySets>
+
+</assembly>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-module/src/main/root/admin-svc.config
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-module/src/main/root/admin-svc.config b/admin-svc/admin-svc-module/src/main/root/admin-svc.config
new file mode 100644
index 0000000..7b6854f
--- /dev/null
+++ b/admin-svc/admin-svc-module/src/main/root/admin-svc.config
@@ -0,0 +1,38 @@
+import java.security.Permission;
+import net.jini.constraint.BasicMethodConstraints;
+import net.jini.core.constraint.InvocationConstraints;
+import net.jini.core.entry.Entry;
+import net.jini.core.lookup.ServiceID;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.jeri.BasicILFactory;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.tcp.TcpServerEndpoint;
+import net.jini.lookup.JoinManager;
+import net.jini.lookup.entry.Name;
+import net.jini.security.BasicProxyPreparer;
+
+basic {
+	
+    groups = new String[] {$discoveryGroup};
+    
+    exporter = new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
+                                     new BasicILFactory());
+
+    serviceInvocationConstraints=InvocationConstraints.EMPTY;
+        
+    registrarPreparer = 
+        new BasicProxyPreparer(false, new BasicMethodConstraints(serviceInvocationConstraints),
+            new Permission[] { new RuntimePermission("accessClassInPackage.com.sun.proxy") } );
+
+    static discoveryManager = 
+        new LookupDiscovery( groups, this);
+
+    static attributes = new Entry[] { new Name("admin-service") };
+
+}
+
+net.jini.lookup.JoinManager {
+    registrarPreparer = basic.registrarPreparer;
+    registrationPreparer = basic.registrarPreparer;
+    
+}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/admin-svc-module/src/main/root/start.properties
----------------------------------------------------------------------
diff --git a/admin-svc/admin-svc-module/src/main/root/start.properties b/admin-svc/admin-svc-module/src/main/root/start.properties
new file mode 100644
index 0000000..6ac1420
--- /dev/null
+++ b/admin-svc/admin-svc-module/src/main/root/start.properties
@@ -0,0 +1,20 @@
+
+ # 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.
+ #
+
+startClass=org.apache.river.container.admin.impl.AdminImpl
+startParameters=admin-svc.config

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/admin-svc/pom.xml
----------------------------------------------------------------------
diff --git a/admin-svc/pom.xml b/admin-svc/pom.xml
new file mode 100644
index 0000000..5ad8f60
--- /dev/null
+++ b/admin-svc/pom.xml
@@ -0,0 +1,38 @@
+<?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>
+    <parent>
+        <artifactId>river-container</artifactId>
+        <groupId>org.apache.river.container</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.river.container</groupId>
+    <artifactId>admin-svc</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>admin-svc</name>
+    <modules>
+        <module>admin-svc-api</module>
+        <module>admin-svc-dl</module>
+        <module>admin-svc-impl</module>
+        <module>admin-svc-module</module>
+    </modules>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e8ef195..e624b0f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,8 @@
         <module>river-hsm</module>
         <module>admin-app</module>
         <module>admin-module</module>
-    </modules>
+    <module>admin-svc</module>
+  </modules>
     <properties>
         <jsk-version>2.2.2</jsk-version>
     </properties>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/product/pom.xml
----------------------------------------------------------------------
diff --git a/product/pom.xml b/product/pom.xml
index 992f8d7..07bfdf5 100644
--- a/product/pom.xml
+++ b/product/pom.xml
@@ -70,6 +70,11 @@
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>admin-svc-module</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
   
     <build>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/product/src/assemble/product-container.xml
----------------------------------------------------------------------
diff --git a/product/src/assemble/product-container.xml b/product/src/assemble/product-container.xml
index 763d831..8a9898b 100644
--- a/product/src/assemble/product-container.xml
+++ b/product/src/assemble/product-container.xml
@@ -73,6 +73,7 @@
         
         <!-- Default profile
         -->
+        
         <dependencySet>
             <useProjectArtifact>false</useProjectArtifact>
             <outputDirectory>/profile/default/deploy</outputDirectory>
@@ -84,13 +85,13 @@
         </dependencySet>
         <dependencySet>
             <useProjectArtifact>false</useProjectArtifact>
-            <outputDirectory>/profile/client/deploy</outputDirectory>
+            <outputDirectory>/profile/default/deploy-privileged</outputDirectory>
             <scope>runtime</scope>
             <includes>
-                <include>*:browser-module</include>
+                <include>*:admin-svc-module</include>
             </includes>
         </dependencySet>
-        
+
         <!-- Client Profile
         -->
         <dependencySet>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/product/src/main/root/bin/logging.properties
----------------------------------------------------------------------
diff --git a/product/src/main/root/bin/logging.properties b/product/src/main/root/bin/logging.properties
index fdbd071..66e0a0c 100644
--- a/product/src/main/root/bin/logging.properties
+++ b/product/src/main/root/bin/logging.properties
@@ -73,7 +73,9 @@ org.apache.river.container.level = INFO
 org.apache.river.container.ShowContextToConsole.level=INFO
 
 net.jini.config.level=INFO
-org.apache.river.container.security.ContainerCodePolicy.level=INFO
+org.apache.river.container.security.ContainerCodePolicy.level=SEVERE
+org.apache.river.container.admin.level=INFO
+org.apache.river.container.deployer.level=INFO
 org.apache.river.container.deployer.ClasspathFilterBuilder.level=INFO
 org.apache.river.container.deployer.DeployerConfigParser=INFO
 org.apache.river.container.hsm.level=SEVERE

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/product/src/main/root/profile/default/config.xml
----------------------------------------------------------------------
diff --git a/product/src/main/root/profile/default/config.xml b/product/src/main/root/profile/default/config.xml
index 7d81f52..69488e2 100644
--- a/product/src/main/root/profile/default/config.xml
+++ b/product/src/main/root/profile/default/config.xml
@@ -49,6 +49,22 @@
         <cfg:property name="autoDeploy" value="true"/>
     </cfg:component>
     
+    <!-- Deployer for privileged 'service-starter'-style applications. 
+        i.e. the Admin service.
+    -->
+    <cfg:component class="org.apache.river.container.deployer.StarterServiceDeployer"
+        name="privileged-deployer">
+        <cfg:property name="config" value="privileged-service-starter.cfg"/>
+    </cfg:component>
+    
+    <!-- Deployer for applications that are in the 'deploy' directory
+    at startup. -->
+    <cfg:component class="org.apache.river.container.deployer.StartupDeployer">
+        <cfg:property name="deployDirectory" value="deploy-privileged"/>
+        <cfg:property name="autoDeploy" value="true"/>
+        <cfg:property name="deployerName" value="privileged-deployer"/>
+    </cfg:component>
+    
     <!-- Deployer for 'system apps' like the remote deployment service 
     <cfg:component class="org.apache.river.container.deployer.StarterServiceDeployer">
         <cfg:property name="config" value="privileged-services.cfg"/>

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/product/src/main/root/profile/default/privileged-service-starter.cfg
----------------------------------------------------------------------
diff --git a/product/src/main/root/profile/default/privileged-service-starter.cfg b/product/src/main/root/profile/default/privileged-service-starter.cfg
new file mode 100644
index 0000000..91c48c5
--- /dev/null
+++ b/product/src/main/root/profile/default/privileged-service-starter.cfg
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+// Sample file that our policy file parser should be able to process.
+
+// Grants given to all applications.
+grant {
+    java.security.AllPermission;
+    //java.io.FilePermission "${serviceArchive}" "read";
+    java.io.FilePermission "-" "read";
+    java.net.SocketPermission "*" "connect,listen,accept,resolve";
+
+    // Required for VFSFileManager
+    java.util.PropertyPermission "java.io.tmpdir" "read";
+    java.util.PropertyPermission "os.*" "read";
+    java.util.PropertyPermission "path.*" "read";
+    java.lang.RuntimePermission "getClassLoader";
+    java.lang.RuntimePermission "setContextClassLoader";
+    /* net.jini.security.Security requires createSecurityManager, but we
+    don't grant 'setSecurityManager'. */
+    java.lang.RuntimePermission "createSecurityManager";
+    java.lang.RuntimePermission "getProtectionDomain";
+    java.lang.RuntimePermission "setFactory";
+    java.lang.RuntimePermission "modifyThread";
+    java.lang.RuntimePermission "modifyThreadGroup";
+    java.security.SecurityPermission "getDomainCombiner";
+    java.security.SecurityPermission "createAccessControlContext";
+    java.security.SecurityPermission "getPolicy";
+
+    // BasicProxyPreparer requirements:
+    javax.security.auth.AuthPermission "getSubject";
+    // Should not be required once UmbrellaGrantPolicy is implemented.
+    // TODO: Config file parser doesn't recognize \"
+    // net.jini.security.GrantPermission "delim=| java.lang.RuntimePermission |accessClassInPackage.com.sun.proxy|";
+
+    net.jini.security.policy.UmbrellaGrantPermission;
+    com.sun.jini.thread.ThreadPoolPermission "getSystemThreadPool";
+    com.sun.jini.thread.ThreadPoolPermission "getUserThreadPool";
+    com.sun.jini.discovery.internal.EndpointInternalsPermission "set";
+    com.sun.jini.discovery.internal.EndpointInternalsPermission "get";
+    java.lang.reflect.ReflectPermission "suppressAccessChecks";
+    net.jini.export.ExportPermission "exportRemoteInterface.*";
+    net.jini.discovery.DiscoveryPermission "*";
+    java.lang.RuntimePermission "shutdownHooks";
+    java.util.PropertyPermission "*" "read";
+
+    java.lang.RuntimePermission "accessClassInPackage.com.sun.proxy";
+
+    // Only in client configuration - apps can call System.exit()
+    java.lang.RuntimePermission "exitVM.*";
+}
+
+classloader {
+    // Variables required to set up the application classloader.
+    //For a privileged application deployer, parent=containerClassLoader;
+    //parent systemClassLoader;
+    parent containerClassLoader;
+
+    // Indicates that for this loader, classes are to be loaded from the 
+    // application loader first, rather than the parent.
+    // Default is priority parent.
+    priority application;
+
+    jars {
+        //commons-vfs2-2.0.jar,
+        //commons-logging-1.1.1.jar,
+        //jsk-platform-${jsk-version}.jar,
+        //jsk-lib-${jsk-version}.jar,
+        //jsk-resources-${jsk-version}.jar,
+        river-container-core-1.0-SNAPSHOT.jar(org.apache.river.container.liaison.Strings,
+            org.apache.river.container.liaison.VirtualFileSystemConfiguration, 
+            org.apache.river.container.liaison.VirtualFileSystemConfiguration$MyConfigurationFile, 
+            "META-INF/services/*")
+    }
+
+    codebase {jsk-dl-${jsk-version}.jar}
+}
+configuration {
+    // Anything on the left-hand side of '=' is set into the application config
+    // as a "special variable, accessible through '$name'.
+    discoveryGroup=defaultDiscoveryGroup;
+    
+    // For privileged deployer, include 
+    context=context;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/MessageNames.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/MessageNames.java b/river-container-core/src/main/java/org/apache/river/container/MessageNames.java
index a566d03..95828e8 100644
--- a/river-container-core/src/main/java/org/apache/river/container/MessageNames.java
+++ b/river-container-core/src/main/java/org/apache/river/container/MessageNames.java
@@ -85,6 +85,7 @@ public class MessageNames {
             FAILED_TO_SET_PROPERTY="failedToSetProperty",
             FOUND_NO_SERVICE_ARCHIVES="foundNoServiceArchives",
             FOUND_SERVICE_ARCHIVES="foundServiceArchives",
+            GRANTS_TO_CLASS_ARE="grantsToClassAre",
             ILLEGAL_ARGUMENT_EXCEPTION="illegalArgumentException",
             ILLEGAL_ACCESS_EXCEPTION="illegalAccessException",
             INITIALIZATION_EXCEPTION="initializationException",

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/Strings.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/Strings.java b/river-container-core/src/main/java/org/apache/river/container/Strings.java
index 8528ab9..4bbc2be 100644
--- a/river-container-core/src/main/java/org/apache/river/container/Strings.java
+++ b/river-container-core/src/main/java/org/apache/river/container/Strings.java
@@ -55,6 +55,7 @@ public class Strings {
             MAIN="main",
             MESSAGES="messages",
             NAME="name",
+            NEWLINE="\n",
             PLATFORM_JARS="platformJars",
             PLATFORM_CODEBASE="platformCodebase",
             PROFILE = "profile",

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/Utils.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/Utils.java b/river-container-core/src/main/java/org/apache/river/container/Utils.java
index 7da2d6f..ccce2a1 100644
--- a/river-container-core/src/main/java/org/apache/river/container/Utils.java
+++ b/river-container-core/src/main/java/org/apache/river/container/Utils.java
@@ -19,6 +19,10 @@ package org.apache.river.container;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.Policy;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -26,13 +30,14 @@ import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import net.jini.security.policy.DynamicPolicyProvider;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileType;
 
 /**
-
- @author trasukg
+ *
+ * @author trasukg
  */
 public class Utils {
 
@@ -107,12 +112,17 @@ public class Utils {
             Class cls) {
         log.log(level, MessageNames.CLASSLOADER_IS,
                 new Object[]{cls.getName(), cls.getClassLoader()});
-        ClassLoader parent = cls.getClassLoader().getParent();
-        while (parent != null) {
-            log.log(level, MessageNames.PARENT_CLASS_LOADER_IS,
-                    new Object[]{parent});
-            parent = parent.getParent();
+        try {
+            ClassLoader parent = cls.getClassLoader().getParent();
+            while (parent != null) {
+                log.log(level, MessageNames.PARENT_CLASS_LOADER_IS,
+                        new Object[]{parent});
+                parent = parent.getParent();
+            }
+        } catch (Throwable t) {
+            log.log(level, Strings.NEWLINE);
         }
+
     }
 
     public static void logClassLoaderHierarchy(Logger log,
@@ -124,14 +134,31 @@ public class Utils {
         while (parent != null) {
             log.log(level, MessageNames.PARENT_CLASS_LOADER_IS,
                     new Object[]{parent});
-            parent = parent.getParent();
+            try {
+                parent = parent.getParent();
+            } catch (Throwable t) {
+                parent = null;
+            }
         }
     }
-    
+
     public static String stackTrace(Throwable t) {
-        StringWriter s=new StringWriter();
-        PrintWriter pw=new PrintWriter(s);
+        StringWriter s = new StringWriter();
+        PrintWriter pw = new PrintWriter(s);
         t.printStackTrace(pw);
         return s.toString();
     }
+
+    public static void logGrantsToClass(final Logger log, final Level level, final Class c) {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                ClassLoader cl = c.getClassLoader();
+                DynamicPolicyProvider dpp = (DynamicPolicyProvider) Policy.getPolicy();
+                Permission[] perms = dpp.getGrants(c, null);
+                log.log(level, MessageNames.GRANTS_TO_CLASS_ARE,
+                        new Object[]{c.getName(), Utils.format(perms)});
+                return null;
+            }
+        });
+    }
 }

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java b/river-container-core/src/main/java/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
index 19a6c63..a3c8b9f 100644
--- a/river-container-core/src/main/java/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
+++ b/river-container-core/src/main/java/org/apache/river/container/classloading/VirtualFileSystemClassLoader.java
@@ -38,17 +38,23 @@ import org.apache.river.container.LocalizedRuntimeException;
 import org.apache.river.container.MessageNames;
 
 /**
-
- @author trasukg
+ *
+ * @author trasukg
  */
 public class VirtualFileSystemClassLoader extends URLClassLoader {
 
     private FileObject fileSystemRoot = null;
     private List<ClasspathEntry> classpathEntries = new ArrayList<ClasspathEntry>();
     private CodeSource codeSource = null;
+    private boolean isAppPriority = false;
 
     public VirtualFileSystemClassLoader(FileObject fileSystemRoot, ClassLoader parent, CodeSource codeSource) {
+        this(fileSystemRoot, parent, codeSource, false);
+    }
+
+    public VirtualFileSystemClassLoader(FileObject fileSystemRoot, ClassLoader parent, CodeSource codeSource, boolean isAppPriority) {
         super(new URL[0], parent);
+        this.isAppPriority = isAppPriority;
         this.fileSystemRoot = fileSystemRoot;
         this.codeSource = codeSource;
     }
@@ -59,10 +65,10 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     }
 
     /**
-     Add the given classpath to this classloader, based on the default root
-     supplied at construction time.
-
-     @param classPath
+     * Add the given classpath to this classloader, based on the default root
+     * supplied at construction time.
+     *
+     * @param classPath
      */
     public void addClassPathEntry(String classPath) {
 
@@ -70,14 +76,14 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     }
 
     /**
-     Add the given classpath to this classloader, based on the given fileRoot.
-     The classpath can contain multiple entries, separated by colons, e.g.
-     'jsk-platform.jar:jsk-lib.jar'.<br> Each entry can either be a jar file or
-     a jar file with a list of classes that the jar file can be used to provide.
-     For instance, 'surrogate.jar(org.apache.ABC, org.apache.DEF)'.
-
-     @param fileRoot
-     @param classPath
+     * Add the given classpath to this classloader, based on the given fileRoot.
+     * The classpath can contain multiple entries, separated by colons, e.g.
+     * 'jsk-platform.jar:jsk-lib.jar'.<br> Each entry can either be a jar file
+     * or a jar file with a list of classes that the jar file can be used to
+     * provide. For instance, 'surrogate.jar(org.apache.ABC, org.apache.DEF)'.
+     *
+     * @param fileRoot
+     * @param classPath
      */
     public void addClassPathEntry(FileObject fileRoot, String classPath) {
 
@@ -100,18 +106,18 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
         for (ClasspathFilter filter : filters) {
             FileObject entryObject = fileRoot.resolveFile(filter.getJarName());
 
-            FileObject entryFileSystem =
-                    fileRoot.getFileSystem().getFileSystemManager().createFileSystem(entryObject);
+            FileObject entryFileSystem
+                    = fileRoot.getFileSystem().getFileSystemManager().createFileSystem(entryObject);
             classpathEntries.add(new ClasspathEntry(filter, entryFileSystem));
         }
     }
 
     /**
-     Find a resource by searching through all the classpath entries that have
-     been set up.
-
-     @param name
-     @return
+     * Find a resource by searching through all the classpath entries that have
+     * been set up.
+     *
+     * @param name
+     * @return
      */
     @Override
     public URL findResource(final String name) {
@@ -134,8 +140,7 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     @Override
     public Enumeration<URL> findResources(final String name) throws IOException {
 
-        Enumeration result = (Enumeration)
-                Security.doPrivileged(new PrivilegedAction<Enumeration>() {
+        Enumeration result = (Enumeration) Security.doPrivileged(new PrivilegedAction<Enumeration>() {
 
             public Enumeration run() {
                 List<URL> urlList = new ArrayList<URL>();
@@ -155,11 +160,11 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     }
 
     /**
-     Find the file object for a resource by searching through all the classpath
-     entries that have been set up.
-
-     @param name
-     @return
+     * Find the file object for a resource by searching through all the
+     * classpath entries that have been set up.
+     *
+     * @param name
+     * @return
      */
     public FileObject findResourceFileObject(String name) {
         for (ClasspathEntry cpEntry : classpathEntries) {
@@ -176,11 +181,11 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     }
 
     /**
-     Find the all the file objects for a resource by searching through all the
-     classpath entries that have been set up.
-
-     @param name
-     @return
+     * Find the all the file objects for a resource by searching through all the
+     * classpath entries that have been set up.
+     *
+     * @param name
+     * @return
      */
     public List<FileObject> findResourceFileObjects(String name) {
         List<FileObject> foList = new ArrayList<FileObject>();
@@ -223,12 +228,12 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     }
 
     /**
-     Set the codebase URLs to an arbitrary list of URLs. These URLs form the
-     codebase annotation for classes loaded through this classloader. For the
-     sake of general paranoia, sets the codebase to a copy of the provided
-     array.
-
-     @param codebase
+     * Set the codebase URLs to an arbitrary list of URLs. These URLs form the
+     * codebase annotation for classes loaded through this classloader. For the
+     * sake of general paranoia, sets the codebase to a copy of the provided
+     * array.
+     *
+     * @param codebase
      */
     public void setCodebase(URL[] codebase) {
         if (codebase == null || codebase.length == 0) {
@@ -242,20 +247,20 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
     }
 
     /**
-     Get the list of URLs that are used for the codebase annotation. Note that
-     this list is not the actual classpath (that is in the superclass). The
-     codebase URLs are imposed to match whatever the Jini service wants to
-     expose as its codebase annotation.
-
-     @return
+     * Get the list of URLs that are used for the codebase annotation. Note that
+     * this list is not the actual classpath (that is in the superclass). The
+     * codebase URLs are imposed to match whatever the Jini service wants to
+     * expose as its codebase annotation.
+     *
+     * @return
      */
     @Override
     public URL[] getURLs() {
         return codebaseURLs;
     }
     /**
-     Stores the codebase that will be returned as the codebase annotation.
-
+     * Stores the codebase that will be returned as the codebase annotation.
+     *
      */
     private URL codebaseURLs[] = new URL[0];
 
@@ -295,4 +300,89 @@ public class VirtualFileSystemClassLoader extends URLClassLoader {
 
         return sb.toString();
     }
+
+    /**
+     * Loads a class with the specified name.
+     *
+     * <p>
+     * <code>VirtualFileSystemClassLoader</code> implements this method as
+     * follows:
+     *
+     * <li>If <code>isAppPriority</code> is <code>true</code>, then this method
+     * invokes {@link #findClass
+     * findClass} with <code>name</code>. If <code>findClass</code> throws an
+     * exception, then this method throws that exception. Otherwise, this method
+     * returns the <code>Class</code> returned by <code>findClass</code>, and if
+     * <code>resolve</code> is <code>true</code>,
+     * {@link #resolveClass resolveClass} is invoked with the <code>Class</code>
+     * before returning.
+     *
+     * <li>If <code>isAppPriority</code> is <code>false</code>, then this method
+     * invokes the superclass implementation of {@link ClassLoader#loadClass(String,boolean)
+     * loadClass} with <code>name</code> and <code>resolve</code> and returns
+     * the result. If the superclass's <code>loadClass</code> throws an
+     * exception, then this method throws that exception.
+     *
+     * </ul>
+     *
+     * @param name the binary name of the class to load
+     *
+     * @param resolve if <code>true</code>, then {@link #resolveClass
+     * resolveClass} will be invoked with the loaded class before returning
+     *
+     * @return the loaded class
+     *
+     * @throws ClassNotFoundException if the class could not be found
+     *
+     */
+    protected synchronized Class loadClass(String name, boolean resolve)
+            throws ClassNotFoundException {
+        // First, check if the class has already been loaded
+	Class c = findLoadedClass(name);
+        if (c!=null) return c;
+        
+        if (isAppPriority) {
+            try {
+                c = findClass(name);
+            } catch (ClassNotFoundException e) {
+                return super.loadClass(name, resolve);
+            }
+            if (resolve) {
+                resolveClass(c);
+            }
+            return c;
+        } else {
+            return super.loadClass(name, resolve);
+        }
+    }
+
+    /**
+     * Gets a resource with the specified name.
+     *
+     * <p>
+     * <code>VirtualFileSystemClassLoader</code> implements this method as
+     * follows:
+     * <li>If <code>isAppPriority</code> is <code>true</code>, then this method
+     * invokes {@link
+     * #findResource findResource} with <code>name</code> and returns the
+     * result.
+     *
+     * <li>If <code>isAppPriority</code> is <code>false</code>, then this method
+     * invokes the superclass implementation of
+     * {@link ClassLoader#getResource getResource} with <code>name</code> and
+     * returns the result.
+     *
+     * </ul>
+     *
+     * @param name the name of the resource to get
+     *
+     * @return a <code>URL</code> for the resource, or <code>null</code> if the
+     * resource could not be found
+     *
+     */
+    public URL getResource(String name) {
+        return isAppPriority
+                ? findResource(name) : super.getResource(name);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/deployer/StarterServiceDeployer.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/deployer/StarterServiceDeployer.java b/river-container-core/src/main/java/org/apache/river/container/deployer/StarterServiceDeployer.java
index 3f33689..54578dc 100644
--- a/river-container-core/src/main/java/org/apache/river/container/deployer/StarterServiceDeployer.java
+++ b/river-container-core/src/main/java/org/apache/river/container/deployer/StarterServiceDeployer.java
@@ -137,17 +137,23 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
         String parentLoaderName = configNode.search(
                 new Class[]{ASTconfig.class, ASTclassloader.class, ASTparent.class}).get(0).jjtGetChild(0).toString();
         log.log(Level.FINE, MessageNames.SERVICE_PARENT_CLASSLOADER_IS, parentLoaderName);
+        boolean isAppPriority=false;
+        if (!configNode.search( new Class[]{ ASTconfig.class, ASTclassloader.class, ASTappPriority.class}).isEmpty()) {
+            isAppPriority=true;
+        }
         ClassLoader parentLoader = (ClassLoader) context.get(parentLoaderName);
         VirtualFileSystemClassLoader cl
-                = createChildOfGivenClassloader(parentLoader, codeSource);
+                = createChildOfGivenClassloader(parentLoader, codeSource, isAppPriority);
         /*
          Include platform jars from the container's lib directory.
          */
-        ASTclasspath platformJarSpec = (ASTclasspath) configNode.search(new Class[]{ASTconfig.class,
-            ASTclassloader.class, ASTjars.class, ASTclasspath.class}).get(0);
-        addPlatformJarsToClassloader(platformJarSpec, cl);
+        List classpathNodes = configNode.search(new Class[]{ASTconfig.class,
+            ASTclassloader.class, ASTjars.class, ASTclasspath.class});
+        if (classpathNodes.size() > 0) {
+            ASTclasspath platformJarSpec = (ASTclasspath) classpathNodes.get(0);
+            addPlatformJarsToClassloader(platformJarSpec, cl);
+        }
         addLibDirectoryJarsToClasspath(serviceRoot, cl);
-
         return cl;
 
     }
@@ -171,12 +177,12 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
         cl.addClasspathFilters(filters, fileUtility.getLibDirectory());
     }
 
-    protected VirtualFileSystemClassLoader createChildOfGivenClassloader(ClassLoader parent, CodeSource codeSource) {
+    protected VirtualFileSystemClassLoader createChildOfGivenClassloader(ClassLoader parent, CodeSource codeSource, boolean isAppPriority) {
         /*
          Create the service classloader.
          */
         VirtualFileSystemClassLoader cl
-                = new VirtualFileSystemClassLoader(null, parent, codeSource);
+                = new VirtualFileSystemClassLoader(null, parent, codeSource, isAppPriority);
         return cl;
     }
 
@@ -215,7 +221,7 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
         log.log(Level.FINE, MessageNames.CALLING_MAIN, new Object[]{
             startClassName, Utils.format(args)
         });
-        Runnable task=null;
+        Runnable task = null;
         if (hasServiceStarterConstructor(env.getClassLoader(), startClassName)) {
             task = new Runnable() {
                 @Override
@@ -238,7 +244,7 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
                     }
                 }
             };
-            
+
         } else {
             throw new UnsupportedOperationException();
         }
@@ -484,11 +490,11 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
         try {
             Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String[].class, lifeCycleClass});
             return true;
-        } catch(NoSuchMethodException nsme) {
+        } catch (NoSuchMethodException nsme) {
             return false;
         }
     }
-    
+
     private boolean hasMain(ClassLoader cl, String className) throws ClassNotFoundException {
         Class clazz = Class.forName(className, true, cl);
         log.log(Level.FINE, MessageNames.CLASSLOADER_IS,
@@ -496,15 +502,14 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
 
         // Get this through dynamic lookup becuase it won't be in the parent
         // classloader!
-        
         try {
             Method main = clazz.getMethod(Strings.MAIN, new Class[]{String[].class});
             return true;
-        } catch(NoSuchMethodException nsme) {
+        } catch (NoSuchMethodException nsme) {
             return false;
         }
     }
-    
+
     private void callMain(ClassLoader cl, String className, String[] args) throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
         Class clazz = Class.forName(className, true, cl);
         log.log(Level.FINE, MessageNames.CLASSLOADER_IS,
@@ -512,16 +517,15 @@ public class StarterServiceDeployer implements StarterServiceDeployerMXBean {
 
         // Get this through dynamic lookup becuase it won't be in the parent
         // classloader!
-        
         try {
             Method main = clazz.getMethod(Strings.MAIN, new Class[]{String[].class});
-            main.invoke(null, new Object[] {args});
-        } catch(NoSuchMethodException nsme) {
+            main.invoke(null, new Object[]{args});
+        } catch (NoSuchMethodException nsme) {
             throw new RuntimeException(nsme);
         }
-        
+
     }
-    
+
     private Object instantiateService(ClassLoader cl, String className, String[] parms)
             throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, InstantiationException {
         Class clazz = Class.forName(className, true, cl);

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/deployer/StartupDeployer.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/deployer/StartupDeployer.java b/river-container-core/src/main/java/org/apache/river/container/deployer/StartupDeployer.java
index 26e5598..92c78ac 100644
--- a/river-container-core/src/main/java/org/apache/river/container/deployer/StartupDeployer.java
+++ b/river-container-core/src/main/java/org/apache/river/container/deployer/StartupDeployer.java
@@ -113,6 +113,16 @@ public class StartupDeployer {
 
     FileObject deploymentDirectoryFile = null;
 
+    private String deployerName=null;
+
+    public String getDeployerName() {
+        return deployerName;
+    }
+
+    public void setDeployerName(String deployerName) {
+        this.deployerName = deployerName;
+    }
+    
     @Init
     public void init() {
         try {
@@ -128,6 +138,12 @@ public class StartupDeployer {
     private void tryInitialize() throws IOException, ParseException {
         log.log(Level.FINE, MessageNames.STARTER_SERVICE_DEPLOYER_STARTING, myName);
         /*
+        If the deployerName is supplied, look it up and override the injected deployer.
+        */
+        if(deployerName != null) {
+            deployer=(StarterServiceDeployer) context.get(deployerName);
+        }
+        /*
          Establish the deployment directory.
          */
         deploymentDirectoryFile = fileUtility.getProfileDirectory().resolveFile(deployDirectory);

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/security/ContainerCodePolicy.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/security/ContainerCodePolicy.java b/river-container-core/src/main/java/org/apache/river/container/security/ContainerCodePolicy.java
index e927e0d..fb26969 100644
--- a/river-container-core/src/main/java/org/apache/river/container/security/ContainerCodePolicy.java
+++ b/river-container-core/src/main/java/org/apache/river/container/security/ContainerCodePolicy.java
@@ -35,17 +35,18 @@ import org.apache.river.container.MessageNames;
  */
 public class ContainerCodePolicy extends Policy {
 
-    private static final Logger log =
-            Logger.getLogger(ContainerCodePolicy.class.getName(),
-            MessageNames.BUNDLE_NAME);
+    private static final Logger log
+            = Logger.getLogger(ContainerCodePolicy.class.getName(),
+                    MessageNames.BUNDLE_NAME);
     List<ClassLoader> privilegedClassLoaders = new ArrayList<ClassLoader>();
 
-    public ContainerCodePolicy(ClassLoader bootstrapClassLoader) {
-        privilegedClassLoaders.add(bootstrapClassLoader);
-        ClassLoader cl = this.getClass().getClassLoader();
-        while (cl != null) {
-            privilegedClassLoaders.add(cl);
-            cl = cl.getParent();
+    public ContainerCodePolicy(ClassLoader... classLoaders) {
+
+        for (ClassLoader cl : classLoaders) {
+            while (cl != null) {
+                privilegedClassLoaders.add(cl);
+                cl = cl.getParent();
+            }
         }
         allPermissions.add(new AllPermission());
         allPermissions.setReadOnly();
@@ -67,12 +68,13 @@ public class ContainerCodePolicy extends Policy {
 
     /**
      * This seems to be necessary to allow the com.sun.rmi.server.LoaderHandler
-     * class to read the marshalled object.  LoaderHandler will call 
-     * this method to get the permissions that are granted to all classes, which
-     * in the case of the container, is none.  But the permissions collection
-     * must be writable.
+     * class to read the marshalled object. LoaderHandler will call this method
+     * to get the permissions that are granted to all classes, which in the case
+     * of the container, is none. But the permissions collection must be
+     * writable.
+     *
      * @param codesource
-     * @return 
+     * @return
      */
     @Override
     public PermissionCollection getPermissions(CodeSource codesource) {

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/java/org/apache/river/container/security/SecurityInitializer.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/java/org/apache/river/container/security/SecurityInitializer.java b/river-container-core/src/main/java/org/apache/river/container/security/SecurityInitializer.java
index d200975..95b8364 100644
--- a/river-container-core/src/main/java/org/apache/river/container/security/SecurityInitializer.java
+++ b/river-container-core/src/main/java/org/apache/river/container/security/SecurityInitializer.java
@@ -18,8 +18,10 @@
 package org.apache.river.container.security;
 
 import java.security.Policy;
+import java.security.PrivilegedAction;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import net.jini.security.Security;
 import net.jini.security.policy.DynamicPolicyProvider;
 import org.apache.river.container.ConfigurationException;
 import org.apache.river.container.Context;
@@ -27,40 +29,52 @@ import org.apache.river.container.Init;
 import org.apache.river.container.Injected;
 import org.apache.river.container.InjectionStyle;
 import org.apache.river.container.MessageNames;
+import org.apache.river.container.Utils;
 
 /**
- This class is the container component that sets up the security manager and
- dynamic policy provider.
-
- @author trasukg
+ * This class is the container component that sets up the security manager and
+ * dynamic policy provider.
+ *
+ * @author trasukg
  */
 public class SecurityInitializer {
 
-    private static Logger log =
-            Logger.getLogger(SecurityInitializer.class.getName(),
-            MessageNames.BUNDLE_NAME);
+    private static Logger log
+            = Logger.getLogger(SecurityInitializer.class.getName(),
+                    MessageNames.BUNDLE_NAME);
     @Injected(style = InjectionStyle.BY_TYPE)
     private Context context;
 
     @Injected
+    private ClassLoader containerClassLoader;
+
+    @Injected 
     private ClassLoader bootstrapClassLoader;
     
     @Init
     public void initialize() {
-        Policy basePolicy = new ContainerCodePolicy(bootstrapClassLoader);
-        DynamicPolicyProvider policy = new DynamicPolicyProvider(basePolicy);
-        Policy.setPolicy(policy);
-        
-        context.put(org.apache.river.container.Strings.SECURITY_POLICY, policy);
-        
-        System.setSecurityManager(new SecurityManager());
-        
-        Policy installedPolicy = Policy.getPolicy();
-        if (installedPolicy != policy) {
-            throw new ConfigurationException(MessageNames.SECURITY_INIT_WRONG_POLICY,
-                    installedPolicy);
-        }
-        
+        Security.doPrivileged(new PrivilegedAction() {
+
+            public Object run() {
+                log.info("Container classloader is...");
+                Utils.logClassLoaderHierarchy(log, Level.INFO, containerClassLoader);
+                Policy basePolicy = new ContainerCodePolicy(containerClassLoader, bootstrapClassLoader);
+                DynamicPolicyProvider policy = new DynamicPolicyProvider(basePolicy);
+                Policy.setPolicy(policy);
+
+                context.put(org.apache.river.container.Strings.SECURITY_POLICY, policy);
+
+                System.setSecurityManager(new SecurityManager());
+
+                Policy installedPolicy = Policy.getPolicy();
+                if (installedPolicy != policy) {
+                    throw new ConfigurationException(MessageNames.SECURITY_INIT_WRONG_POLICY,
+                            installedPolicy);
+                }
+                return null;
+            }
+        });
+
         log.log(Level.INFO, MessageNames.SECURITY_INIT_SUCCEEDED);
 
     }

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/jjtree/DeployerConfigParser.jjt
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/jjtree/DeployerConfigParser.jjt b/river-container-core/src/main/jjtree/DeployerConfigParser.jjt
index dabc18d..1df99fd 100644
--- a/river-container-core/src/main/jjtree/DeployerConfigParser.jjt
+++ b/river-container-core/src/main/jjtree/DeployerConfigParser.jjt
@@ -99,11 +99,13 @@ TOKEN :
 |       < CONFIGURATION: "configuration">
 |       < JARS: "jars">
 |       < PARENT: "parent">
+|       < APPLICATION: "application">
 | 	< AND: "and" >
 | 	< OR: "or" >
 | 	< NOT: "not" >
 | 	< TRUE: "true" >
 | 	< FALSE: "false" >
+|       < PRIORITY: "priority" >
 |  	< SYMBOL:
 		["A"-"Z", "a"-"z", "_"] 
                     (["0"-"9", "A"-"Z", "a"-"z", ".", "_", "-", "$"])*>
@@ -184,7 +186,31 @@ void classloader() #classloader:
     log.fine("classloader()");
 }
 {
-    <CLASSLOADER> <LBRACE> parent() [jars()] [codebase()] <RBRACE>
+    <CLASSLOADER> <LBRACE> parent() [loaderPriority()] [jars()] [codebase()] <RBRACE>
+}
+
+void loaderPriority():
+{
+    log.fine("loaderPriority");
+}
+{
+    <PRIORITY> (appPriority() | parentPriority()) <SEMICOLON>
+}
+
+void appPriority() #appPriority:
+{
+    log.fine("appPriority");
+}
+{
+    <APPLICATION>
+}
+
+void parentPriority() #parentPriority:
+{
+    log.fine("parentPriority()");
+}
+{   
+    <PARENT>
 }
 
 void jars() #jars:
@@ -192,7 +218,7 @@ void jars() #jars:
     log.fine("jars()");
 }
 {
-    <JARS> <LBRACE> classpath() <RBRACE>
+    <JARS> <LBRACE> [classpath()] <RBRACE>
 }
 
 void parent() #parent:

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/resources/org/apache/river/container/Messages.properties
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/resources/org/apache/river/container/Messages.properties b/river-container-core/src/main/resources/org/apache/river/container/Messages.properties
index 7a93455..2dcf8c2 100644
--- a/river-container-core/src/main/resources/org/apache/river/container/Messages.properties
+++ b/river-container-core/src/main/resources/org/apache/river/container/Messages.properties
@@ -64,6 +64,7 @@ failedToRemoveMBean=Failed to remove MBean for application ''{0}''.
 failedToSetProperty=Failed to set property ''{0}'' on component class ''{1}'' to ''{2}''.
 foundNoServiceArchives=Found no service archives for deployment dir ''{0}''.
 foundServiceArchives=Found {0} service archives in deployment dir ''{1}''.
+grantsToClassAre=Permissions granted to class ''{0}'' are {1}.
 illegalArgumentException=An operation threw an IllegalArgumentException.
 illegalAccessException=An operation threw an IllegalAccessException.
 invalidClasspathEntry=Invalid classpath entry: {0}

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/main/resources/org/apache/river/container/core-config.xml
----------------------------------------------------------------------
diff --git a/river-container-core/src/main/resources/org/apache/river/container/core-config.xml b/river-container-core/src/main/resources/org/apache/river/container/core-config.xml
index b99cd8f..d4bb419 100644
--- a/river-container-core/src/main/resources/org/apache/river/container/core-config.xml
+++ b/river-container-core/src/main/resources/org/apache/river/container/core-config.xml
@@ -51,6 +51,7 @@
         lib/commons-logging-1.1.1.jar
         lib/commons-vfs2-2.0.jar
         lib/jsk-platform-${jsk-version}.jar
+        lib/jsk-lib-${jsk-version}.jar
         lib/jsk-resources-${jsk-version}.jar
         lib/regexp-1.3.jar
         lib/river-hsm-${project.version}.jar

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/test/java/org/apache/river/container/deployer/DeployerConfigParserTest.java
----------------------------------------------------------------------
diff --git a/river-container-core/src/test/java/org/apache/river/container/deployer/DeployerConfigParserTest.java b/river-container-core/src/test/java/org/apache/river/container/deployer/DeployerConfigParserTest.java
index d017b26..4c658f5 100644
--- a/river-container-core/src/test/java/org/apache/river/container/deployer/DeployerConfigParserTest.java
+++ b/river-container-core/src/test/java/org/apache/river/container/deployer/DeployerConfigParserTest.java
@@ -20,6 +20,7 @@ package org.apache.river.container.deployer;
 import java.util.List;
 import java.util.logging.Logger;
 import java.io.InputStream;
+import java.util.logging.Level;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -60,11 +61,13 @@ public class DeployerConfigParserTest {
      it through the parser without errors.
      */
     public void testBasicParsing() throws ParseException {
+        log.setLevel(Level.FINE);
         ASTconfig config = parseTestConfig();
         log.fine("grants string is:" + config.toString());
         String expected = "config (grant (permission java.io.FilePermission \"${serviceArchive}\" \"read\") "
                 + "(permission java.net.SocketPermission \"*\" \"connect\")) "
                 + "(classloader (parent systemClassLoader) "
+                + "appPriority "
                 + "(jars (classpath (cpEntry commons-vfs-1.0.jar) "
                 + "(cpEntry commons-logging-1.1.1.jar) (cpEntry jsk-platform.jar) "
                 + "(cpEntry jsk-lib.jar) (cpEntry jsk-resources.jar) "

http://git-wip-us.apache.org/repos/asf/river-container/blob/317dac09/river-container-core/src/test/resources/org/apache/river/container/deployer/sample.config
----------------------------------------------------------------------
diff --git a/river-container-core/src/test/resources/org/apache/river/container/deployer/sample.config b/river-container-core/src/test/resources/org/apache/river/container/deployer/sample.config
index d7116d5..157ce66 100644
--- a/river-container-core/src/test/resources/org/apache/river/container/deployer/sample.config
+++ b/river-container-core/src/test/resources/org/apache/river/container/deployer/sample.config
@@ -29,6 +29,8 @@ classloader {
     //For a privileged application deployer, parent=containerClassLoader;
     parent systemClassLoader;
 
+    priority application;
+
     jars {
         commons-vfs-1.0.jar,
         commons-logging-1.1.1.jar,


Mime
View raw message