You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by ni...@apache.org on 2008/12/10 06:23:13 UTC
svn commit: r724994 [5/10] - in
/incubator/river/jtsk/skunk/niclas1/examples: ./ browser/ browser/src/
browser/src/main/ browser/src/main/java/ browser/src/main/java/com/
browser/src/main/java/com/sun/ browser/src/main/java/com/sun/jini/
browser/src/ma...
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ConfirmingInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ConfirmingInvocationHandler.java?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ConfirmingInvocationHandler.java (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ConfirmingInvocationHandler.java Tue Dec 9 21:23:07 2008
@@ -0,0 +1,85 @@
+/*
+ * 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 com.sun.jini.example.hello;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import javax.swing.JOptionPane;
+import net.jini.core.constraint.MethodConstraints;
+import net.jini.jeri.BasicInvocationHandler;
+import net.jini.jeri.ObjectEndpoint;
+
+/**
+ * Defines an invocation handler that confirms calls.
+ */
+public class ConfirmingInvocationHandler extends BasicInvocationHandler
+{
+
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * Create a confirming invocation handler from a basic handler and
+ * constraints.
+ */
+ public ConfirmingInvocationHandler( ConfirmingInvocationHandler other,
+ MethodConstraints clientConstraints )
+ {
+ super( other, clientConstraints );
+ }
+
+ /**
+ * Create a confirming invocation handler for the object endpoint and
+ * server constraints.
+ */
+ public ConfirmingInvocationHandler( ObjectEndpoint oe,
+ MethodConstraints serverConstraints )
+ {
+ super( oe, serverConstraints );
+ }
+
+ /**
+ * Asks whether the call should be made, then writes a call identifier
+ * before the arguments.
+ */
+ protected void marshalArguments( Object proxy,
+ Method method,
+ Object[] args,
+ ObjectOutputStream out,
+ Collection context )
+ throws IOException
+ {
+ long callId = System.currentTimeMillis();
+ int result = JOptionPane.showConfirmDialog(
+ null,
+ "Make remote call?" +
+ "\n Object: " + proxy +
+ "\n Method: " + method.getName() +
+ "\n Call id: " + callId,
+ "Make remote call?",
+ JOptionPane.OK_CANCEL_OPTION );
+ if( result != JOptionPane.OK_OPTION )
+ {
+ throw new RuntimeException( "Client cancelled call" );
+ }
+ out.writeLong( callId );
+ super.marshalArguments( proxy, method, args, out, context );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Hello.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Hello.java?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Hello.java (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Hello.java Tue Dec 9 21:23:07 2008
@@ -0,0 +1,39 @@
+/*
+ * 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 com.sun.jini.example.hello;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Defines a simple remote interface.
+ *
+ * @author Sun Microsystems, Inc.
+ */
+public interface Hello extends Remote
+{
+
+ /**
+ * Returns a message string.
+ *
+ * @return message string
+ * @throws RemoteException if a remote communication problem occurs
+ */
+ String sayHello() throws RemoteException;
+}
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/MdClassAnnotationProvider.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/MdClassAnnotationProvider.java?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/MdClassAnnotationProvider.java (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/MdClassAnnotationProvider.java Tue Dec 9 21:23:07 2008
@@ -0,0 +1,93 @@
+/*
+ * 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 com.sun.jini.example.hello;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import net.jini.loader.pref.PreferredClassProvider;
+import net.jini.url.httpmd.HttpmdUtil;
+
+/**
+ * A preferred class provider that computes HTTPMD URLs to use as the class
+ * annotation for classes in the application and bootstrap classpath. The
+ * following system properties control the HTTPMD URLs created:
+ *
+ * o export.codebase -- a space-separated list of the HTTPMD URLs for use as
+ * the codebase. The digest values specified in the URLs will be ignored.
+ * The path portion of the URLs, without the message digest parameters, will
+ * be used to specify the source files, relative to the source directory, to
+ * use for computing message digests.
+ *
+ * o export.codebase.source -- the name of the directory containing the source
+ * files corresponding to the URLs in the codebase
+ *
+ * @author Sun Microsystems, Inc.
+ */
+public class MdClassAnnotationProvider
+ extends PreferredClassProvider
+{
+ private final String codebase;
+
+ public MdClassAnnotationProvider()
+ throws IOException, MalformedURLException
+ {
+ super( false );
+ String codebaseApp = null;
+ try
+ {
+ codebaseApp = HttpmdUtil.computeDigestCodebase(
+ System.getProperty( "export.codebase.source.app" ),
+ System.getProperty( "export.codebase.app" ) );
+ }
+ catch( NullPointerException e )
+ { /* properties not set */ }
+
+ String codebaseJsk = null;
+ try
+ {
+ codebaseJsk = HttpmdUtil.computeDigestCodebase(
+ System.getProperty( "export.codebase.source.jsk" ),
+ System.getProperty( "export.codebase.jsk" ) );
+ }
+ catch( NullPointerException e )
+ { /* properties not set */ }
+
+ if( ( codebaseApp != null ) && ( codebaseJsk != null ) )
+ {
+ codebase = codebaseApp + " " + codebaseJsk;
+ }
+ else if( codebaseApp != null )
+ {
+ codebase = codebaseApp;
+ }
+ else if( codebaseJsk != null )
+ {
+ codebase = codebaseJsk;
+ }
+ else
+ {
+ throw new NullPointerException( "no codebase properties defined" );
+ }
+ }
+
+ protected String getClassAnnotation( ClassLoader loader )
+ {
+ return codebase;
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Proxy.java?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Proxy.java (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Proxy.java Tue Dec 9 21:23:07 2008
@@ -0,0 +1,168 @@
+/*
+ * 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 com.sun.jini.example.hello;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import net.jini.core.constraint.MethodConstraints;
+import net.jini.core.constraint.RemoteMethodControl;
+import net.jini.export.proxytrust.ProxyTrustIterator;
+import net.jini.export.proxytrust.SingletonProxyTrustIterator;
+import net.jini.export.proxytrust.TrustEquivalence;
+import net.jini.security.TrustVerifier;
+
+/**
+ * Define a smart proxy for the server.
+ */
+class Proxy implements Serializable, Hello
+{
+
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * The server proxy
+ */
+ final Hello serverProxy;
+
+ /**
+ * Create a smart proxy, using an implementation that supports constraints
+ * if the server proxy does.
+ */
+ static Proxy create( Hello serverProxy )
+ {
+ return ( serverProxy instanceof RemoteMethodControl )
+ ? new ConstrainableProxy( serverProxy )
+ : new Proxy( serverProxy );
+ }
+
+ Proxy( Hello serverProxy )
+ {
+ this.serverProxy = serverProxy;
+ }
+
+ public boolean equals( Object o )
+ {
+ return getClass() == o.getClass()
+ && serverProxy.equals( ( (Proxy) o ).serverProxy );
+ }
+
+ public int hashCode()
+ {
+ return serverProxy.hashCode();
+ }
+
+ /**
+ * Implement Hello.
+ */
+ public String sayHello() throws RemoteException
+ {
+ System.out.println( "Calling sayHello in smart proxy" );
+ return serverProxy.sayHello();
+ }
+
+ /**
+ * A constrainable implementation of the smart proxy.
+ */
+ private static final class ConstrainableProxy extends Proxy
+ implements RemoteMethodControl
+ {
+ private static final long serialVersionUID = 2L;
+
+ ConstrainableProxy( Hello serverProxy )
+ {
+ super( serverProxy );
+ }
+
+ /**
+ * Implement RemoteMethodControl
+ */
+
+ public MethodConstraints getConstraints()
+ {
+ return ( (RemoteMethodControl) serverProxy ).getConstraints();
+ }
+
+ public RemoteMethodControl setConstraints( MethodConstraints mc )
+ {
+ return new ConstrainableProxy(
+ (Hello) ( (RemoteMethodControl) serverProxy ).setConstraints(
+ mc ) );
+ }
+
+ /*
+ * Provide access to the underlying server proxy to permit the
+ * ProxyTrustVerifier class to verify the proxy.
+ */
+ private ProxyTrustIterator getProxyTrustIterator()
+ {
+ return new SingletonProxyTrustIterator( serverProxy );
+ }
+ }
+
+ /**
+ * A trust verifier for secure smart proxies.
+ */
+ final static class Verifier implements TrustVerifier, Serializable
+ {
+
+ private static final long serialVersionUID = 2L;
+
+ private final RemoteMethodControl serverProxy;
+
+ /**
+ * Create the verifier, throwing UnsupportedOperationException if the
+ * server proxy does not implement both RemoteMethodControl and
+ * TrustEquivalence.
+ */
+ Verifier( Hello serverProxy )
+ {
+ if( serverProxy instanceof RemoteMethodControl &&
+ serverProxy instanceof TrustEquivalence )
+ {
+ this.serverProxy = (RemoteMethodControl) serverProxy;
+ }
+ else
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Implement TrustVerifier
+ */
+ public boolean isTrustedObject( Object obj, TrustVerifier.Context ctx )
+ throws RemoteException
+ {
+ if( obj == null || ctx == null )
+ {
+ throw new NullPointerException();
+ }
+ else if( !( obj instanceof ConstrainableProxy ) )
+ {
+ return false;
+ }
+ RemoteMethodControl otherServerProxy =
+ (RemoteMethodControl) ( (ConstrainableProxy) obj ).serverProxy;
+ MethodConstraints mc = otherServerProxy.getConstraints();
+ TrustEquivalence trusted =
+ (TrustEquivalence) serverProxy.setConstraints( mc );
+ return trusted.checkTrustEquivalence( otherServerProxy );
+ }
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Server.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Server.java?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Server.java (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/Server.java Tue Dec 9 21:23:07 2008
@@ -0,0 +1,245 @@
+/*
+ * 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 com.sun.jini.example.hello;
+
+import java.rmi.RemoteException;
+import java.security.PrivilegedExceptionAction;
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginContext;
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationException;
+import net.jini.config.ConfigurationProvider;
+import net.jini.config.NoSuchEntryException;
+import net.jini.core.lookup.ServiceID;
+import net.jini.discovery.DiscoveryManagement;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.export.Exporter;
+import net.jini.export.ProxyAccessor;
+import net.jini.export.proxytrust.ServerProxyTrust;
+import net.jini.id.Uuid;
+import net.jini.id.UuidFactory;
+import net.jini.jeri.BasicILFactory;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.tcp.TcpServerEndpoint;
+import net.jini.lookup.JoinManager;
+import net.jini.security.TrustVerifier;
+
+/**
+ * Defines an application server that provides an implementation of the Hello
+ * interface.
+ *
+ * The application uses the following arguments:
+ *
+ * [all] - All arguments are used as options when getting the configuration
+ *
+ * The application uses the following configuration entries, with component
+ * com.sun.jini.example.hello.Server:
+ *
+ * discoveryManager
+ * type: DiscoveryManagement
+ * default: new LookupDiscovery(new String[] { "" }, config)
+ * Object used to discover lookup services to join.
+ *
+ * exporter
+ * type: Exporter
+ * default: none
+ * The object to use for exporting the server
+ *
+ * loginContext
+ * type: LoginContext
+ * default: null
+ * If non-null, specifies the JAAS login context to use for performing a JAAS
+ * login and supplying the Subject to use when running the server. If null,
+ * no JAAS login is performed.
+ *
+ * @author Sun Microsystems, Inc.
+ */
+public class Server implements Hello, ServerProxyTrust, ProxyAccessor
+{
+
+ /**
+ * If the impl gets GC'ed, then the server will be unexported.
+ * Store the instance here to prevent this.
+ */
+ private static Server serverImpl;
+
+ /* The configuration to use for configuring the server */
+ protected final Configuration config;
+
+ /**
+ * The server proxy, for use by getProxyVerifier
+ */
+ protected Hello serverProxy;
+
+ /**
+ * Starts and registers a server that implements the Hello interface.
+ *
+ * @param args options to use when getting the Configuration
+ * @throws ConfigurationException if a problem occurs with the
+ * configuration
+ * @throws RemoteException if a remote communication problem occurs
+ */
+ public static void main( String[] args ) throws Exception
+ {
+ serverImpl = new Server( args );
+ serverImpl.init();
+ System.out.println( "Hello server is ready" );
+ }
+
+ /**
+ * Creates the server.
+ *
+ * @param configOptions options to use when getting the Configuration
+ * @throws ConfigurationException if a problem occurs creating the
+ * configuration
+ */
+ protected Server( String[] configOptions ) throws ConfigurationException
+ {
+ config = ConfigurationProvider.getInstance
+ ( configOptions, ( this.getClass() ).getClassLoader() );
+ }
+
+ /**
+ * Initializes the server, including exporting it and storing its proxy in
+ * the registry.
+ *
+ * @throws Exception if a problem occurs
+ */
+ protected void init() throws Exception
+ {
+ LoginContext loginContext = (LoginContext) config.getEntry(
+ "com.sun.jini.example.hello.Server", "loginContext",
+ LoginContext.class, null );
+ if( loginContext == null )
+ {
+ initAsSubject();
+ }
+ else
+ {
+ loginContext.login();
+ Subject.doAsPrivileged(
+ loginContext.getSubject(),
+ new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ initAsSubject();
+ return null;
+ }
+ },
+ null );
+ }
+ }
+
+ /**
+ * Initializes the server, assuming that the appropriate subject is in
+ * effect.
+ */
+ protected void initAsSubject() throws Exception
+ {
+ /* Export the server */
+ Exporter exporter = getExporter();
+ serverProxy = (Hello) exporter.export( this );
+
+ /* Create the smart proxy */
+ Proxy smartProxy = Proxy.create( serverProxy );
+
+ /* Get the discovery manager, for discovering lookup services */
+ DiscoveryManagement discoveryManager;
+ try
+ {
+ discoveryManager = (DiscoveryManagement) config.getEntry(
+ "com.sun.jini.example.hello.Server", "discoveryManager",
+ DiscoveryManagement.class );
+ }
+ catch( NoSuchEntryException e )
+ {
+ /* Use the public group */
+ discoveryManager = new LookupDiscovery(
+ new String[]{ "" }, config );
+ }
+
+ /* Get the join manager, for joining lookup services */
+ JoinManager joinManager =
+ new JoinManager( smartProxy, null /* attrSets */, getServiceID(),
+ discoveryManager, null /* leaseMgr */, config );
+ }
+
+ /**
+ * Returns the exporter for exporting the server.
+ *
+ * @throws ConfigurationException if a problem occurs getting the exporter
+ * from the configuration
+ * @throws RemoteException if a remote communication problem occurs
+ */
+ protected Exporter getExporter()
+ throws ConfigurationException, RemoteException
+ {
+ return (Exporter) config.getEntry(
+ "com.sun.jini.example.hello.Server", "exporter", Exporter.class,
+ new BasicJeriExporter( TcpServerEndpoint.getInstance( 0 ),
+ new BasicILFactory() ) );
+ }
+
+ /**
+ * Returns the service ID for this server.
+ */
+ protected ServiceID getServiceID()
+ {
+ return createServiceID();
+ }
+
+ /**
+ * Creates a new service ID.
+ */
+ protected static ServiceID createServiceID()
+ {
+ Uuid uuid = UuidFactory.generate();
+ return new ServiceID(
+ uuid.getMostSignificantBits(), uuid.getLeastSignificantBits() );
+ }
+
+ /**
+ * Implement the Hello interface.
+ */
+ public String sayHello()
+ {
+ return "Hello, world!";
+ }
+
+ /**
+ * Implement the ServerProxyTrust interface to provide a verifier for
+ * secure smart proxies.
+ */
+ public TrustVerifier getProxyVerifier()
+ {
+ return new Proxy.Verifier( serverProxy );
+ }
+
+ /**
+ * Returns a proxy object for this remote object.
+ *
+ * @return our proxy
+ */
+ public Object getProxy()
+ {
+ return serverProxy;
+ }
+
+}
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ServerPermission.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ServerPermission.java?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ServerPermission.java (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/ServerPermission.java Tue Dec 9 21:23:07 2008
@@ -0,0 +1,44 @@
+/*
+ * 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 com.sun.jini.example.hello;
+
+import net.jini.security.AccessPermission;
+
+/**
+ * Represents permissions used to express the access control policy for the
+ * Server class. The name specifies the names of the method which you have
+ * permission to call using the matching rules provided by AccessPermission.
+ *
+ * @author Sun Microsystems, Inc.
+ */
+public class ServerPermission extends AccessPermission
+{
+
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * Creates an instance with the specified target name.
+ *
+ * @param name the target name
+ */
+ public ServerPermission( String name )
+ {
+ super( name );
+ }
+}
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/build.xml
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/build.xml?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/build.xml (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/build.xml Tue Dec 9 21:23:07 2008
@@ -0,0 +1,365 @@
+<!--
+ ! 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 name="hello" basedir="." default="all">
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## ENVIRONMENT SETTINGS -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <property name="top" location="../../../../../.."/>
+
+ <property name="pkg-path" value="com/sun/jini/example/${ant.project.name}"/>
+
+ <!-- ## -->
+ <!-- ## Set java-source for use with the javac task: -->
+ <!-- ## -->
+
+ <property name="java-source" value="${pkg-path}/**/*.java"/>
+
+ <import file="${top}/build_common.xml"/>
+
+ <property name="hello.lib" location="${basedir}/lib"/>
+ <property name="hello.config" location="${basedir}/config"/>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: all -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="all"
+ description=""
+ depends="compile,
+ this.stubs">
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: clean -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="clean"
+ description="Removes all files and dirs created by the build."
+ depends="clean.jre.ext">
+
+ <delete dir="${build.classes}/${pkg-path}" quiet="true"/>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: hello.lib -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="hello.lib"
+ depends="">
+
+ <mkdir dir="${basedir}/lib"/>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: this.jars -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="this.jars"
+ depends="client.jar,
+ mdprefld.jar,
+ server.jar,
+ server-act.jar,
+ server-dl.jar">
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: client.jar -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="client.jar"
+ depends="tools,
+ hello.lib">
+
+ <property name="example-client.deps" location="${build.deps}/example-client.deps"/>
+
+ <!-- ## -->
+ <!-- ## Run ClassDep. -->
+ <!-- ## -->
+
+ <java classname="com.sun.jini.tool.ClassDep"
+ failonerror="true"
+ output="${example-client.deps}">
+
+ <classpath refid="path.classdep"/>
+ <arg value="-cp"/>
+ <arg path="${build.classes}"/>
+ <arg value="-files"/>
+ <arg line="${jskplatform.exclude}"/>
+
+ <arg line="-in net.jini"/>
+ <arg line="-in com.sun.jini"/>
+
+ <arg value="com.sun.jini.example.hello.Client"/>
+
+ </java>
+
+ <!-- ## -->
+ <!-- ## Generate the jar file. -->
+ <!-- ## -->
+
+ <delete file="${hello.lib}/client.jar" quiet="true"/>
+
+ <jar destfile="${hello.lib}/client.jar"
+ index="false"
+ manifest="${basedir}/client.mf">
+
+ <fileset dir="${build.classes}" includesfile="${example-client.deps}"/>
+
+ </jar>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: mdprefld.jar -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="mdprefld.jar"
+ depends="tools,
+ hello.lib">
+
+ <!-- ## -->
+ <!-- ## Generate the jar file. -->
+ <!-- ## -->
+
+ <delete file="${hello.lib}/mdprefld.jar" quiet="true"/>
+
+ <jar destfile="${hello.lib}/mdprefld.jar"
+ index="false">
+
+ <fileset dir="${build.classes}"
+ includes="com/sun/jini/example/hello/MdClassAnnotationProvider.class"/>
+ </jar>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: server.jar -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="server.jar"
+ depends="tools,
+ hello.lib">
+
+ <property name="example-server.deps" location="${build.deps}/example-server.deps"/>
+
+ <!-- ## -->
+ <!-- ## Run ClassDep. -->
+ <!-- ## -->
+
+ <java classname="com.sun.jini.tool.ClassDep"
+ failonerror="true"
+ output="${example-server.deps}">
+
+ <classpath refid="path.classdep"/>
+ <arg value="-cp"/>
+ <arg path="${build.classes}"/>
+ <arg value="-files"/>
+ <arg line="${jskplatform.exclude}"/>
+
+ <arg line="-in net.jini"/>
+ <arg line="-in com.sun.jini"/>
+
+ <arg value="com.sun.jini.example.hello.Server"/>
+ <arg value="com.sun.jini.example.hello.Server_Stub"/>
+ <arg value="com.sun.jini.example.hello.ConfirmingILFactory"/>
+ <arg value="com.sun.jini.example.hello.ConfirmingInvocationHandler"/>
+ <arg value="com.sun.jini.example.hello.ServerPermission"/>
+
+ </java>
+
+ <!-- ## -->
+ <!-- ## Generate the jar file. -->
+ <!-- ## -->
+
+ <delete file="${hello.lib}/server.jar" quiet="true"/>
+
+ <jar destfile="${hello.lib}/server.jar"
+ index="false"
+ manifest="${basedir}/server.mf">
+
+ <fileset dir="${build.classes}" includesfile="${example-server.deps}"/>
+
+ </jar>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: server-act.jar -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="server-act.jar"
+ depends="tools,
+ hello.lib">
+
+ <property name="example-server-act.deps" location="${build.deps}/example-server-act.deps"/>
+
+ <!-- ## -->
+ <!-- ## Run ClassDep. -->
+ <!-- ## -->
+
+ <java classname="com.sun.jini.tool.ClassDep"
+ failonerror="true"
+ output="${example-server-act.deps}">
+
+ <classpath refid="path.classdep"/>
+ <arg value="-cp"/>
+ <arg path="${build.classes}"/>
+ <arg value="-files"/>
+
+ <arg line="${jskplatform.exclude}"/>
+
+ <arg line="-in net.jini"/>
+ <arg line="-in com.sun.jini"/>
+
+ <arg value="com.sun.jini.example.hello.ActivatableServer"/>
+ <arg value="com.sun.jini.example.hello.ConfirmingILFactory"/>
+ <arg value="com.sun.jini.example.hello.ConfirmingInvocationHandler"/>
+ <arg value="com.sun.jini.example.hello.Server"/>
+ <arg value="com.sun.jini.example.hello.Server_Stub"/>
+ <arg value="com.sun.jini.example.hello.ServerPermission"/>
+
+ </java>
+
+ <!-- ## -->
+ <!-- ## Generate the jar file. -->
+ <!-- ## -->
+
+ <delete file="${hello.lib}/server-act.jar" quiet="true"/>
+
+ <jar destfile="${hello.lib}/server-act.jar"
+ index="false"
+ manifest="${basedir}/server-act.mf">
+
+ <fileset dir="${build.classes}" includesfile="${example-server-act.deps}"/>
+
+ </jar>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: server-dl.jar -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="server-dl.jar"
+ depends="tools,
+ hello.lib">
+
+ <property name="example-server-dl.deps" location="${build.deps}/example-server-dl.deps"/>
+
+ <!-- ## -->
+ <!-- ## Run ClassDep. -->
+ <!-- ## -->
+
+ <java classname="com.sun.jini.tool.ClassDep"
+ failonerror="true"
+ output="${example-server-dl.deps}">
+
+ <classpath refid="path.classdep"/>
+ <arg value="-cp"/>
+ <arg path="${build.classes}"/>
+ <arg value="-files"/>
+
+ <arg line="${jskplatform.exclude}"/>
+
+ <arg line="-in net.jini"/>
+ <arg line="-in com.sun.jini"/>
+
+ <arg value="com.sun.jini.example.hello.ConfirmingInvocationHandler"/>
+ <arg value="com.sun.jini.example.hello.Hello"/>
+ <arg value="com.sun.jini.example.hello.Proxy"/>
+ <arg value="com.sun.jini.example.hello.Server_Stub"/>
+ <arg value="com.sun.jini.example.hello.ServerPermission"/>
+
+ </java>
+
+ <!-- ## -->
+ <!-- ## Generate the jar file. -->
+ <!-- ## -->
+
+ <delete file="${hello.lib}/server-dl.jar" quiet="true"/>
+
+ <jar destfile="${hello.lib}/server-dl.jar"
+ index="false">
+
+ <fileset dir="${build.classes}" includesfile="${example-server-dl.deps}"/>
+
+ <metainf dir="${hello.config}/META-INF"/>
+
+ </jar>
+
+ </target>
+
+
+ <!-- ################################################################ -->
+ <!-- ## -->
+ <!-- ## TARGET: this.stubs -->
+ <!-- ## -->
+ <!-- ################################################################ -->
+
+ <target name="this.stubs"
+ description="Builds the RMI stubs for ${ant.project.name}."
+ depends="compile">
+
+ <rmic base="${build.classes}" stubversion="1.2">
+
+ <classpath refid="path.jini"/>
+
+ <include name="com/sun/jini/example/hello/Server.class"/>
+
+ </rmic>
+
+ </target>
+
+</project>
+
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/client.mf
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/client.mf?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/client.mf (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/client.mf Tue Dec 9 21:23:07 2008
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Main-Class: com.sun.jini.example.hello.Client
+Class-path: ../../../../../../../../lib/jsk-platform.jar ../../../../../../../../lib/jsk-lib.jar mdprefld.jar
+
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/META-INF/PREFERRED.LIST
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/META-INF/PREFERRED.LIST?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/META-INF/PREFERRED.LIST (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/META-INF/PREFERRED.LIST Tue Dec 9 21:23:07 2008
@@ -0,0 +1,28 @@
+#/*
+# 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.
+#*/
+
+PreferredResources-Version: 1.0
+
+Name: com/sun/jini/example/hello/ConfirmingInvocationHandler.class
+Preferred: true
+
+Name: com/sun/jini/example/hello/Proxy.class
+Preferred: true
+
+Name: com/sun/jini/example/hello/Server_Stub.class
+Preferred: true
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-jeri-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-jeri-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-jeri-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-jeri-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for activatable Jini ERI server */
+
+import java.net.SocketPermission;
+import java.rmi.activation.ActivationID;
+import java.security.Permission;
+import net.jini.activation.ActivationExporter;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.security.BasicProxyPreparer;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.BasicILFactory;
+import net.jini.jeri.tcp.TcpServerEndpoint;
+
+com.sun.jini.example.hello.Server {
+
+ /* Exporter for the server proxy */
+ exporter =
+ /* Use activation exporter */
+ new ActivationExporter(
+ (ActivationID) $data,
+ new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
+ new BasicILFactory()));
+
+ private groups = new String[] { "nonsecure.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}//end com.sun.jini.example.hello.Server
+
+/* Configuration block for the lookup discovery utility */
+net.jini.discovery.LookupDiscovery {
+
+ registrarPreparer = new BasicProxyPreparer(
+ false /* verify */,
+ new Permission[] {
+ new SocketPermission("*:1024-", "connect")
+ });
+
+}//end net.jini.discovery.LookupDiscovery
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for activatable Kerberos server */
+
+import com.sun.jini.example.hello.ServerPermission;
+import java.rmi.activation.ActivationID;
+import java.security.Permission;
+import java.util.Collections;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.login.LoginContext;
+import net.jini.activation.ActivationExporter;
+import net.jini.constraint.BasicMethodConstraints;
+import net.jini.core.constraint.Integrity;
+import net.jini.core.constraint.ClientAuthentication;
+import net.jini.core.constraint.InvocationConstraint;
+import net.jini.core.constraint.InvocationConstraints;
+import net.jini.core.constraint.ServerAuthentication;
+import net.jini.core.constraint.ServerMinPrincipal;
+import net.jini.jeri.kerberos.KerberosServerEndpoint;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.ProxyTrustILFactory;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.security.AuthenticationPermission;
+import net.jini.security.BasicProxyPreparer;
+
+com.sun.jini.example.hello.Server {
+
+ /* JAAS login */
+ loginContext = new LoginContext("com.sun.jini.example.hello.Server");
+
+ /* Identify principals */
+ static serverUser = Collections.singleton(
+ new KerberosPrincipal("${serverPrincipal}"));
+ static reggieUser = Collections.singleton(
+ new KerberosPrincipal("${reggiePrincipal}"));
+ static phoenixUser = Collections.singleton(
+ new KerberosPrincipal("${phoenixPrincipal}"));
+
+ /* Exporter for the server proxy */
+ exporter =
+ /* Use activation exporter */
+ new ActivationExporter(
+ (ActivationID) $data,
+ /* Use secure exporter */
+ new BasicJeriExporter(
+ /* Use Kerberos transport */
+ KerberosServerEndpoint.getInstance(0),
+ /* Support ProxyTrust */
+ new ProxyTrustILFactory(
+ /* Require integrity for all methods */
+ new BasicMethodConstraints(
+ new InvocationConstraints(Integrity.YES, null)),
+ /* Require ServerPermission */
+ ServerPermission.class)));
+
+ /* Constraints for talking to Phoenix */
+ private static activationSystemConstraints =
+ new BasicMethodConstraints(
+ new InvocationConstraints(
+ new InvocationConstraint[] {
+ Integrity.YES,
+ ServerAuthentication.YES,
+ new ServerMinPrincipal(phoenixUser) },
+ null));
+
+ /* Proxy preparer for the activation ID */
+ activationIdPreparer =
+ new BasicProxyPreparer(
+ false, /* No need to verify the proxy */
+ activationSystemConstraints,
+ null);
+
+ private groups = new String[] { "krb.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}//end com.sun.jini.example.hello.Server
+
+/* Configuration block for the lookup discovery utility */
+net.jini.discovery.LookupDiscovery {
+
+ private serviceLookupConstraints =
+ new BasicMethodConstraints(
+ new InvocationConstraints(
+ new InvocationConstraint[]{
+ Integrity.YES,
+ ClientAuthentication.YES,
+ ServerAuthentication.YES,
+ new ServerMinPrincipal(
+ com.sun.jini.example.hello.Server.reggieUser)
+ },
+ null));
+
+ static registrarPreparer = new BasicProxyPreparer(
+ true,
+ serviceLookupConstraints,
+ new Permission[] {
+ new AuthenticationPermission(
+ com.sun.jini.example.hello.Server.serverUser,
+ com.sun.jini.example.hello.Server.reggieUser,
+ "connect")
+ });
+
+}//end net.jini.discovery.LookupDiscovery
+
+/* Configuration block for the join manager */
+net.jini.lookup.JoinManager {
+
+ static registrarPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static registrationPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static serviceLeasePreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+
+}//end net.jini.lookup.JoinManager
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.policy
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.policy?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.policy (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-krb-server.policy Tue Dec 9 21:23:07 2008
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/* Security policy for activatable Kerberos server */
+
+/* Grant all permissions to local JAR files */
+grant codeBase "file:..${/}..${/}..${/}..${/}..${/}..${/}..${/}lib${/}*" {
+ permission java.security.AllPermission;
+};
+
+grant codeBase "file:lib${/}*" {
+ permission java.security.AllPermission;
+};
+
+/* Grant permissions to client principal */
+grant principal
+ javax.security.auth.kerberos.KerberosPrincipal "${clientPrincipal}"
+{
+ /* Call sayHello method */
+ permission com.sun.jini.example.hello.ServerPermission "sayHello";
+};
+
+/* Grant permissions to phoenix principal */
+grant principal
+ javax.security.auth.kerberos.KerberosPrincipal "${phoenixPrincipal}"
+{
+ /* Get proxy verifier */
+ permission com.sun.jini.phoenix.InstantiatorPermission "getProxyVerifier";
+
+ /* Instantiate activatable server */
+ permission com.sun.jini.phoenix.InstantiatorPermission "newInstance";
+};
+
+/* Grant permissions to reggie principal */
+grant principal
+ javax.security.auth.kerberos.KerberosPrincipal "${reggiePrincipal}"
+{
+ /* Allow reggie to call us back so join works */
+ permission net.jini.security.AccessPermission "notify";
+};
+
+/* Grant permissions to all principals */
+grant {
+ /* Call getProxyVerifier method */
+ permission com.sun.jini.example.hello.ServerPermission "getProxyVerifier";
+};
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-server.policy
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-server.policy?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-server.policy (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-server.policy Tue Dec 9 21:23:07 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+/* Security policy for non-secure, activatable server */
+
+/* Grant local JAR files all permissions */
+grant codeBase "file:..${/}..${/}..${/}..${/}..${/}..${/}..${/}lib${/}*" {
+ permission java.security.AllPermission;
+};
+
+grant codeBase "file:lib${/}*" {
+ permission java.security.AllPermission;
+};
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for activatable SSL server */
+
+import com.sun.jini.config.KeyStores;
+import com.sun.jini.example.hello.ServerPermission;
+import java.rmi.activation.ActivationID;
+import java.security.Permission;
+import java.util.Collections;
+import javax.security.auth.login.LoginContext;
+import net.jini.activation.*;
+import net.jini.constraint.*;
+import net.jini.core.constraint.*;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.jeri.*;
+import net.jini.jeri.ssl.*;
+import net.jini.security.*;
+
+com.sun.jini.example.hello.Server {
+
+ /* JAAS login */
+ loginContext = new LoginContext("com.sun.jini.example.hello.Server");
+
+ /* Public Key Certificates */
+ private static users =
+ KeyStores.getKeyStore("file:prebuiltkeys/truststore", null);
+
+ private static reggieUser = Collections.singleton(
+ KeyStores.getX500Principal("reggie", users));
+
+ private static serverUser = Collections.singleton(
+ KeyStores.getX500Principal("server", users));
+
+ private static phoenixUser = Collections.singleton(
+ KeyStores.getX500Principal("phoenix", users));
+
+ /* Exporter for the server proxy */
+ exporter =
+ /* Use activation exporter */
+ new ActivationExporter(
+ (ActivationID) $data,
+ /* Use secure exporter */
+ new BasicJeriExporter(
+ /* Use SSL transport */
+ SslServerEndpoint.getInstance(0),
+ /* Support ProxyTrust */
+ new ProxyTrustILFactory(
+ /* Require integrity for all methods */
+ new BasicMethodConstraints(
+ new InvocationConstraints(Integrity.YES, null)),
+ /* Require ServerPermission */
+ ServerPermission.class)));
+
+ /* Constraints for talking to Phoenix */
+ private static activationSystemConstraints =
+ new BasicMethodConstraints(
+ new InvocationConstraints(
+ new InvocationConstraint[] {
+ Integrity.YES,
+ ClientAuthentication.NO,
+ ServerAuthentication.YES,
+ new ServerMinPrincipal(phoenixUser) },
+ null));
+
+ /* Proxy preparer for the activation ID */
+ activationIdPreparer =
+ new BasicProxyPreparer(
+ false, /* No need to verify the proxy */
+ activationSystemConstraints,
+ null);
+
+ private groups = new String[] { "ssl.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}// end com.sun.jini.example.hello.Server
+
+/* Configuration block for the lookup discovery utility */
+net.jini.discovery.LookupDiscovery {
+
+ private serviceLookupConstraints =
+ new BasicMethodConstraints(
+ new InvocationConstraints(
+ new InvocationConstraint[]{
+ Integrity.YES,
+ ClientAuthentication.YES,
+ ServerAuthentication.YES,
+ new ServerMinPrincipal(
+ com.sun.jini.example.hello.Server.reggieUser)
+ },
+ null));
+
+ static registrarPreparer = new BasicProxyPreparer(
+ true,
+ serviceLookupConstraints,
+ new Permission[] {
+ new AuthenticationPermission(
+ com.sun.jini.example.hello.Server.serverUser,
+ com.sun.jini.example.hello.Server.reggieUser,
+ "connect")
+ });
+
+}//end net.jini.discovery.LookupDiscovery
+
+/* Configuration block for the join manager */
+net.jini.lookup.JoinManager {
+
+ static registrarPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static registrationPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static serviceLeasePreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+
+}//end net.jini.lookup.JoinManager
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.policy
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.policy?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.policy (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/activatable-ssl-server.policy Tue Dec 9 21:23:07 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+/* Security policy for activatable SSL server */
+
+/* Keystore containing trusted certificates to use for authentication */
+keystore "..${/}prebuiltkeys${/}truststore";
+
+/* Grant all permissions to local JAR files*/
+grant codeBase "file:..${/}..${/}..${/}..${/}..${/}..${/}..${/}lib${/}*" {
+ permission java.security.AllPermission;
+};
+
+grant codeBase "file:lib${/}*" {
+ permission java.security.AllPermission;
+};
+
+/* Grant permissions to phoenix principal */
+grant principal "phoenix" {
+ permission com.sun.jini.phoenix.InstantiatorPermission "getProxyVerifier";
+ permission com.sun.jini.phoenix.InstantiatorPermission "newInstance";
+};
+
+/* Grant permissions to client principal */
+grant principal "client" {
+ /* Call sayHello method */
+ permission com.sun.jini.example.hello.ServerPermission "sayHello";
+};
+
+/* Grant permissions to all principals */
+grant {
+ permission com.sun.jini.example.hello.ServerPermission "getProxyVerifier";
+};
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for non-secure client */
+
+import java.net.SocketPermission;
+import java.security.Permission;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.lookup.ServiceDiscoveryManager;
+import net.jini.security.BasicProxyPreparer;
+
+com.sun.jini.example.hello.Client {
+
+ private groups = new String[] { "nonsecure.hello.example.jini.sun.com" };
+ serviceDiscovery = new ServiceDiscoveryManager(
+ new LookupDiscovery(groups, this), null, this);
+
+}//end com.sun.jini.example.hello.Client
+
+/* Configuration block for the lookup discovery utility */
+net.jini.discovery.LookupDiscovery {
+
+ registrarPreparer = new BasicProxyPreparer(
+ false /* verify */,
+ new Permission[] {
+ new SocketPermission("*:1024-", "connect")
+ });
+
+}//end net.jini.discovery.LookupDiscovery
+
+/* Configuration block for the SDM */
+net.jini.lookup.ServiceDiscoveryManager {
+
+ registrarPreparer = net.jini.discovery.LookupDiscovery.registrarPreparer;
+
+}//end net.jini.lookup.ServiceDiscoveryManager
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.policy
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.policy?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.policy (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/client.policy Tue Dec 9 21:23:07 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+/* Security policy for non-secure client */
+
+/* Grant all permissions to our classes */
+grant codeBase "file:..${/}..${/}..${/}..${/}..${/}..${/}..${/}lib${/}*" {
+ permission java.security.AllPermission;
+};
+
+grant codebase "file:lib${/}*" {
+ permission java.security.AllPermission;
+};
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-jeri-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-jeri-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-jeri-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-jeri-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for confirming Jini ERI server */
+
+import com.sun.jini.example.hello.ConfirmingILFactory;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.tcp.TcpServerEndpoint;
+
+com.sun.jini.example.hello.Server {
+
+ /* Exporter for the server proxy */
+ exporter = new BasicJeriExporter(
+ TcpServerEndpoint.getInstance(0),
+ new ConfirmingILFactory());
+
+ private groups = new String[] { "nonsecure.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}//end com.sun.jini.example.hello.Server
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-krb-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-krb-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-krb-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-krb-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for confirming Kerberos server */
+
+import com.sun.jini.example.hello.ConfirmingILFactory;
+import com.sun.jini.example.hello.ServerPermission;
+import java.security.Permission;
+import java.util.Collections;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.login.LoginContext;
+import net.jini.constraint.BasicMethodConstraints;
+import net.jini.core.constraint.ClientAuthentication;
+import net.jini.core.constraint.Integrity;
+import net.jini.core.constraint.InvocationConstraint;
+import net.jini.core.constraint.InvocationConstraints;
+import net.jini.core.constraint.ServerAuthentication;
+import net.jini.core.constraint.ServerMinPrincipal;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.BasicILFactory;
+import net.jini.jeri.kerberos.KerberosServerEndpoint;
+import net.jini.security.AuthenticationPermission;
+import net.jini.security.BasicProxyPreparer;
+import net.jini.export.proxytrust.ProxyTrustExporter;
+
+com.sun.jini.example.hello.Server {
+
+ /* JAAS login */
+ loginContext = new LoginContext("com.sun.jini.example.hello.Server");
+
+ /* Identify principals */
+ private static serverUser = Collections.singleton(
+ new KerberosPrincipal("${serverPrincipal}"));
+ private static reggieUser = Collections.singleton(
+ new KerberosPrincipal("${reggiePrincipal}"));
+
+ /* Exporter for the server proxy */
+ exporter =
+ /* Use proxy trust exporter */
+ new ProxyTrustExporter(
+ /* main exporter */
+ new BasicJeriExporter(
+ /* Use Kerberos transport */
+ KerberosServerEndpoint.getInstance(0),
+ /* Confirm calls */
+ new ConfirmingILFactory(
+ /* Require integrity for all methods */
+ new BasicMethodConstraints(
+ new InvocationConstraints(Integrity.YES, null)),
+ /* Require ServerPermission */
+ ServerPermission.class)),
+ /* bootstrap exporter */
+ new BasicJeriExporter(
+ /* Use Kerberos transport */
+ KerberosServerEndpoint.getInstance(0),
+ new BasicILFactory(
+ /* Require integrity for all methods */
+ new BasicMethodConstraints(
+ new InvocationConstraints(Integrity.YES, null)),
+ /* Require ServerPermission */
+ ServerPermission.class)));
+
+ private groups = new String[] { "krb.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}//end com.sun.jini.example.hello.Server
+
+/* Configuration block for the lookup discovery utility */
+net.jini.discovery.LookupDiscovery {
+
+ private serviceLookupConstraints =
+ new BasicMethodConstraints(
+ new InvocationConstraints(
+ new InvocationConstraint[]{
+ Integrity.YES,
+ ClientAuthentication.YES,
+ ServerAuthentication.YES,
+ new ServerMinPrincipal(
+ com.sun.jini.example.hello.Server.reggieUser)
+ },
+ null));
+
+ static registrarPreparer = new BasicProxyPreparer(
+ true,
+ serviceLookupConstraints,
+ new Permission[] {
+ new AuthenticationPermission(
+ com.sun.jini.example.hello.Server.serverUser,
+ com.sun.jini.example.hello.Server.reggieUser,
+ "connect")
+ });
+
+}//end net.jini.discovery.LookupDiscovery
+
+/* Configuration block for the join manager */
+net.jini.lookup.JoinManager {
+
+ static registrarPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static registrationPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static serviceLeasePreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+
+}//end net.jini.lookup.JoinManager
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-ssl-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-ssl-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-ssl-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/confirming-ssl-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for confirming SSL server */
+
+import com.sun.jini.example.hello.ConfirmingILFactory;
+import com.sun.jini.example.hello.ServerPermission;
+import com.sun.jini.config.KeyStores;
+import java.util.Collections;
+import java.security.Permission;
+import javax.security.auth.login.LoginContext;
+import net.jini.constraint.BasicMethodConstraints;
+import net.jini.core.constraint.ClientAuthentication;
+import net.jini.core.constraint.InvocationConstraint;
+import net.jini.core.constraint.InvocationConstraints;
+import net.jini.core.constraint.Integrity;
+import net.jini.core.constraint.ServerAuthentication;
+import net.jini.core.constraint.ServerMinPrincipal;
+import net.jini.discovery.LookupDiscovery;
+import net.jini.export.proxytrust.ProxyTrustExporter;
+import net.jini.security.*;
+import net.jini.jeri.*;
+import net.jini.jeri.ssl.*;
+
+com.sun.jini.example.hello.Server {
+
+ /* JAAS login */
+ loginContext = new LoginContext("com.sun.jini.example.hello.Server");
+
+ /* Public Key Certificates */
+ private static users =
+ KeyStores.getKeyStore("file:prebuiltkeys/truststore", null);
+
+ private static reggieUser = Collections.singleton(
+ KeyStores.getX500Principal("reggie", users));
+
+ private static serverUser = Collections.singleton(
+ KeyStores.getX500Principal("server", users));
+
+ /* Exporter for the server proxy */
+ exporter =
+ /* Use proxy trust exporter */
+ new ProxyTrustExporter(
+ /* main exporter */
+ new BasicJeriExporter(
+ /* Use SSL transport */
+ SslServerEndpoint.getInstance(0),
+ /* Confirm calls */
+ new ConfirmingILFactory(
+ /* Require integrity for all methods */
+ new BasicMethodConstraints(
+ new InvocationConstraints(Integrity.YES, null)),
+ /* Require ServerPermission */
+ ServerPermission.class)),
+ /* bootstrap exporter */
+ new BasicJeriExporter(
+ /* Use SSL transport */
+ SslServerEndpoint.getInstance(0),
+ new BasicILFactory(
+ /* Require integrity for all methods */
+ new BasicMethodConstraints(
+ new InvocationConstraints(Integrity.YES, null)),
+ /* Require ServerPermission */
+ ServerPermission.class)));
+
+ private groups = new String[] { "ssl.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}//end com.sun.jini.example.hello.Server
+
+/* Configuration block for the lookup discovery utility */
+net.jini.discovery.LookupDiscovery {
+
+ private serviceLookupConstraints =
+ new BasicMethodConstraints(
+ new InvocationConstraints(
+ new InvocationConstraint[]{
+ Integrity.YES,
+ ClientAuthentication.YES,
+ ServerAuthentication.YES,
+ new ServerMinPrincipal(
+ com.sun.jini.example.hello.Server.reggieUser)
+ },
+ null));
+
+ static registrarPreparer = new BasicProxyPreparer(
+ true,
+ serviceLookupConstraints,
+ new Permission[] {
+ new AuthenticationPermission(
+ com.sun.jini.example.hello.Server.serverUser,
+ com.sun.jini.example.hello.Server.reggieUser,
+ "connect")
+ });
+
+}//end net.jini.discovery.LookupDiscovery
+
+/* Configuration block for the join manager */
+net.jini.lookup.JoinManager {
+
+ static registrarPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static registrationPreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+ static serviceLeasePreparer =
+ net.jini.discovery.LookupDiscovery.registrarPreparer;
+
+}//end net.jini.lookup.JoinManager
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/dynamic-policy.security-properties
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/dynamic-policy.security-properties?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/dynamic-policy.security-properties (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/dynamic-policy.security-properties Tue Dec 9 21:23:07 2008
@@ -0,0 +1,22 @@
+#/*
+# 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.
+#*/
+
+# Java security properties file to install the dynamic security policy
+# provider
+
+policy.provider=net.jini.security.policy.DynamicPolicyProvider
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix-group.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix-group.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix-group.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix-group.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+ /* Configuration source file for the non-secure phoenix group */
+
+import com.sun.jini.phoenix.AccessILFactory;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.tcp.TcpServerEndpoint;
+
+com.sun.jini.phoenix {
+
+ instantiatorExporter =
+ new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
+ new AccessILFactory());
+
+}//end com.sun.jini.phoenix
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-phoenix.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for Jini ERI phoenix */
+
+com.sun.jini.phoenix {
+
+ persistenceDirectory = "lib${/}phoenix-log";
+ groupConfig = new String[] { "config${/}jeri-phoenix-group.config" };
+
+}//end com.sun.jini.phoenix
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-server.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-server.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-server.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jeri-server.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for Jini ERI server */
+
+import net.jini.discovery.LookupDiscovery;
+import net.jini.jeri.BasicILFactory;
+import net.jini.jeri.BasicJeriExporter;
+import net.jini.jeri.tcp.TcpServerEndpoint;
+
+com.sun.jini.example.hello.Server {
+
+ /* Exporter for the server proxy */
+ exporter = new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
+ new BasicILFactory());
+
+ private groups = new String[] { "nonsecure.hello.example.jini.sun.com" };
+ discoveryManager = new LookupDiscovery(groups, this);
+
+}//end com.sun.jini.example.hello.Server
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix-group.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix-group.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix-group.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix-group.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for the non-secure phoenix group using JRMP */
+
+import com.sun.jini.phoenix.InstantiatorAccessExporter;
+
+com.sun.jini.phoenix {
+
+ instantiatorExporter = new InstantiatorAccessExporter();
+
+}//end com.sun.jini.phoenix
Added: incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix.config
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix.config?rev=724994&view=auto
==============================================================================
--- incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix.config (added)
+++ incubator/river/jtsk/skunk/niclas1/examples/hello/src/main/java/com/sun/jini/example/hello/config/jrmp-phoenix.config Tue Dec 9 21:23:07 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+/* Configuration source file for JRMP phoenix */
+
+import com.sun.jini.phoenix.*;
+import net.jini.jrmp.JrmpExporter;
+import java.rmi.activation.ActivationSystem;
+
+com.sun.jini.phoenix {
+
+ registryPort = ActivationSystem.SYSTEM_PORT;
+ registryExporter = new RegistrySunExporter(registryPort);
+ activatorExporter = new ActivatorSunJrmpExporter(registryPort);
+ systemExporter = new SunJrmpExporter(4, registryPort);
+ monitorExporter = new JrmpExporter(registryPort);
+ persistenceDirectory = "lib${/}phoenix-log";
+ groupConfig = new String[] { "config${/}jrmp-phoenix-group.config" };
+
+}//end com.sun.jini.phoenix