Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2998 - in development/main/transit/core: . handler/src/main/net/dpml/transit handler/src/main/net/dpml/transit/model handler/src/main/net/dpml/transit/store handler/src/main/net/dpml/transit/unit handler/src/test/net/dpml/transit/manager tools/src/main/net/dpml/transit/tools

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2998 - in development/main/transit/core: . handler/src/main/net/dpml/transit handler/src/main/net/dpml/transit/model handler/src/main/net/dpml/transit/store handler/src/main/net/dpml/transit/unit handler/src/test/net/dpml/transit/manager tools/src/main/net/dpml/transit/tools
  • Date: Wed, 06 Jul 2005 23:10:14 -0400

Author: mcconnell AT dpml.net
Date: Wed Jul 6 23:10:14 2005
New Revision: 2998

Modified:

development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitRegistryModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java

development/main/transit/core/handler/src/test/net/dpml/transit/manager/AuthorityTestCase.java
development/main/transit/core/overview.html

development/main/transit/core/tools/src/main/net/dpml/transit/tools/TransitTask.java
Log:
o updates to the Transit storage model such that if an authorative URL is
supplied then non-persistent stoarage will be used thereby eliminating and
persitannt storage conflicts

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
Wed Jul 6 23:10:14 2005
@@ -19,20 +19,22 @@

package net.dpml.transit;

+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.rmi.NotBoundException ;
import java.rmi.AccessException;
import java.rmi.RemoteException;
import java.rmi.activation.ActivationSystem;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
+import java.util.Properties;

import net.dpml.transit.adapter.LoggingAdapter;
import net.dpml.transit.monitors.Monitor;
@@ -45,6 +47,9 @@
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
+import net.dpml.transit.store.TransitStorage;
+import net.dpml.transit.unit.TransitStorageUnit;
+import net.dpml.transit.util.PropertyResolver;

/**
* The Transit class manages the establishment of a singleton transit
instance
@@ -149,16 +154,35 @@
{
if( m_INSTANCE == null )
{
- try
+ URL authority = getAuthority();
+ if( null == authority )
{
- TransitModel model = new DefaultTransitModel();
- return getInstance( model );
+ try
+ {
+ TransitModel model = new DefaultTransitModel();
+ return getInstance( model );
+ }
+ catch( IOException e )
+ {
+ String message = e.getMessage();
+ Throwable cause = e.getCause();
+ throw new TransitRuntimeException( message, cause );
+ }
}
- catch( IOException e )
+ else
{
- String message = e.getMessage();
- Throwable cause = e.getCause();
- throw new TransitRuntimeException( message, cause );
+ try
+ {
+ TransitStorage store = new TransitStorageUnit(
authority );
+ TransitModel model = new DefaultTransitModel( store
);
+ return getInstance( model );
+ }
+ catch( IOException e )
+ {
+ String message = e.getMessage();
+ Throwable cause = e.getCause();
+ throw new TransitRuntimeException( message, cause );
+ }
}
}
else
@@ -491,4 +515,34 @@
*/
private static Transit m_INSTANCE;

+ private static URL getAuthority()
+ {
+ String auth = System.getProperty( AUTHORITY_KEY, null );
+ if( null != auth )
+ {
+ Properties properties = new Properties( System.getProperties() );
+ properties.setProperty( Transit.HOME_KEY,
Transit.DPML_HOME.toString() );
+ properties.setProperty( Transit.PREFS_KEY,
Transit.DPML_PREFS.toString() );
+ properties.setProperty( Transit.DATA_KEY,
Transit.DPML_DATA.toString() );
+ properties.setProperty( Transit.SYSTEM_KEY,
Transit.DPML_SYSTEM.toString() );
+ String path = PropertyResolver.resolve( properties, auth );
+ try
+ {
+ return new URL( path );
+ }
+ catch( MalformedURLException e )
+ {
+ final String error =
+ "Invaid authority url: " + path;
+ throw new TransitError( error, e );
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private static final String AUTHORITY_KEY = "dpml.transit.authority";
+
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
Wed Jul 6 23:10:14 2005
@@ -72,6 +72,11 @@
this( logger, new TransitStorageUnit() );
}

+ public DefaultTransitModel( TransitStorage store ) throws RemoteException
+ {
+ this( new LoggingAdapter( "transit" ), store );
+ }
+
public DefaultTransitModel( Logger logger, TransitStorage store ) throws
RemoteException
{
super( logger );

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitRegistryModel.java
Wed Jul 6 23:10:14 2005
@@ -69,7 +69,6 @@
// TransitRegistryModel
//
------------------------------------------------------------------------

-
public int getTransitModelCount()
{
synchronized( m_lock )

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheHome.java
Wed Jul 6 23:10:14 2005
@@ -21,13 +21,22 @@
import java.io.File;

/**
- *
+ * Interface implemented by classes providing cache storage management.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
public interface CacheHome extends CacheStorage
{
+ /**
+ * Return the inital set of host storage units.
+ * @return an array of host storage units
+ */
HostStorage[] getInitialHosts();

+ /**
+ * Return an identified host storage unit creating it if necessary.
+ * @param id the host storage unit identifier
+ * @return the identified host storage unit
+ */
HostStorage getHostStorage( String id );
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java
Wed Jul 6 23:10:14 2005
@@ -21,7 +21,7 @@
import java.io.File;

/**
- *
+ * Interface implemented by classes maintaining a cache configuration.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
Wed Jul 6 23:10:14 2005
@@ -66,6 +66,11 @@
this( getTransitPreferences( profile ) );
}

+ public TransitStorageUnit( URL url )
+ {
+ this( getLocalPreferences( url ) );
+ }
+
public TransitStorageUnit( Preferences prefs )
{
super( prefs );
@@ -152,20 +157,12 @@

private static Preferences getTransitPreferences( String profile )
{
- URL authority = getAuthority();
Preferences root = Preferences.userNodeForPackage( Transit.class );
Preferences prefs = root.node( "profiles" ).node( profile );
- if( null != authority )
+ long install = prefs.getLong( "installation", -1 );
+ if( install < 0 )
{
- TransitPreferences.setupPreferences( prefs, authority );
- }
- else
- {
- long install = prefs.getLong( "installation", -1 );
- if( install < 0 )
- {
- TransitPreferences.setupFactoryPreferences( prefs );
- }
+ TransitPreferences.setupFactoryPreferences( prefs );
}
return prefs;
}
@@ -175,38 +172,17 @@
return System.getProperty( PROFILE_KEY, DEFAULT_PROFILE_NAME );
}

- private static URL getAuthority()
+ private static Preferences getLocalPreferences( URL url )
{
- String auth = System.getProperty( AUTHORITY_KEY, null );
- if( null != auth )
- {
- Properties properties = new Properties( System.getProperties() );
- properties.setProperty( Transit.HOME_KEY,
Transit.DPML_HOME.toString() );
- properties.setProperty( Transit.PREFS_KEY,
Transit.DPML_PREFS.toString() );
- properties.setProperty( Transit.DATA_KEY,
Transit.DPML_DATA.toString() );
- properties.setProperty( Transit.SYSTEM_KEY,
Transit.DPML_SYSTEM.toString() );
- String path = PropertyResolver.resolve( properties, auth );
- try
- {
- return new URL( path );
- }
- catch( MalformedURLException e )
- {
- final String error =
- "Invaid authority url: " + path;
- throw new TransitError( error, e );
- }
- }
- else
- {
- return null;
- }
+ LocalPreferences root = new LocalPreferences( null, "" );
+ String selection = getDefaultProfileName();
+ Preferences prefs = new LocalPreferences( root, selection );
+ TransitPreferences.setupPreferences( prefs, url );
+ return prefs;
}

private static final String DEFAULT_PROFILE_NAME = "default";
private static final String PROFILE_KEY = "dpml.transit.profile";
- private static final String AUTHORITY_KEY = "dpml.transit.authority";
-
}



Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/manager/AuthorityTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/manager/AuthorityTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/manager/AuthorityTestCase.java
Wed Jul 6 23:10:14 2005
@@ -18,32 +18,24 @@

package net.dpml.transit.manager;

-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
+import java.net.URL;

import junit.framework.TestCase;

import net.dpml.transit.model.TransitModel;
import net.dpml.transit.model.HostModel;
import net.dpml.transit.model.DefaultTransitModel;
+import net.dpml.transit.unit.TransitStorageUnit;

/**
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
public class AuthorityTestCase extends TestCase
{
- static
- {
- System.setProperty(
- "java.util.prefs.PreferencesFactory",
- "net.dpml.transit.unit.LocalPreferencesFactory" );
- System.setProperty( "dpml.transit.authority",
"http://staging.dpml.net/test/"; );
- }
-
public void testAuthority() throws Exception
{
- TransitModel model = new DefaultTransitModel();
+ TransitStorageUnit store = new TransitStorageUnit( new URL(
"http://staging.dpml.net/test/"; ) );
+ TransitModel model = new DefaultTransitModel( store );
HostModel[] hosts = model.getCacheModel().getHostModels();
assertEquals( "hosts", 2, hosts.length );
}

Modified: development/main/transit/core/overview.html
==============================================================================
--- development/main/transit/core/overview.html (original)
+++ development/main/transit/core/overview.html Wed Jul 6 23:10:14 2005
@@ -1,28 +1,64 @@
<body>
+
<p>
A repository enabled application is an application the leverages a local
- cache of artifacts that are referenced by logical identifiers.
+ cache of artifacts that are referenced via URI values.
</p>
+
+<h3>Transit Overview</h3>
+
<p>
- Identifiers typically reference content in the form of an artifact url such
- as artifact:block:dpml/http/dpml-http-server#123. These
+ Identifiers typically reference content in the form of an artifact uri such
+ as <code>artifact:part:dpml/planet/http/dpml-http-demo#1234</code>. These
identifiers disassociate the definition of an application from the source
of
- the resources needed to build and deploy the application. Repository
enabled
- applications leverage a local cache management system to resolve artifact
- references to physical resource based on configuration data that is defined
- independently of particular applications.
+ the resources needed to build and deploy the application. Transit
applications
+ benefit from a local cache and multi-host repository management system
when
+ resolving artifact references to physical resources.
</p>

<P>
- An application will normally make content requests to a local cache manager
- which in turn interacts with one or more remote repositories to resolve
- application requests. Varying levels of quality of service are provided by
- repository systems, for example, a local cache manager can provide a level
- of control over which repositories are accesses and provide content
- validation. In addition, intelligent remote repositories can provide
advanced
- solutions including automated generation of artifacts relative to cache
- manager requests, content filtering, referral management, and solutions
- customized relative to client identity.
+ An application will normally make content requests through creation of a
URL
+ containing either a "artifact" or "link" protocol. The Transit protocol
handler
+ interacts with one or more remote repositories to resolve application
requests.
+</p>
+
+<h3>Enabling Transit</h3>
+
+<p>
+Transit is enabled by including the dpml-transit-main.jar file within the
system
+classloader and declaring the following system property:
</p>

+<pre>
+ java.protocol.handler.pkgs = net.dpml.transit
+</pre>
+
+<h3>Transit Configuration</h3>
+
+<p>
+Transit configuration profiles are managed by the <a
href="net/dpml/transit/model/TransitRegistryModel.html">TransitRegistryModel</a>.
Normally Transit will aquire a <a
href="net/dpml/transit/model/TransitModel.html">TransitModel</a>
automatically as a result of a request for url resolution or access to
Transit classloader construction services. Advanced applications my use the
registry to select a specific configuration profile. Configuration profiles
may be shared across multiple JVMs and model changes may be propergated at
runtimes without a JVM restart.
+
+<p>
+The default behavour Transit is controlled by the following system
properties:
+</p>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+ <TD><B>Property Name</B></TD>
+ <TD><B>Default</B></TD>
+ <TD><B>Description</B></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD>net.dpml.transit.profile</TD>
+ <TD>none</TD>
+ <TD>Used to select a stored configuration profile. If undefined a default
profile named <code>"default"</code> will be used. If the profile does not
exist it will initalized using Transit factory defaults or overriding
authorative defaults if the <code>net.dpml.transit.authority</code> property
is not null.</TD>
+<TD>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+ <TD>net.dpml.transit.authority</TD>
+ <TD>none</TD>
+ <TD>May be used to declare a remote location for Transit configuration
data. If declared, the value supplied must be a URL referencing an
authoritive directory. If the url declares the <code>file:</code> protocol
the configuration of Transit will be based on information declared under a
[URL]/cache.properties file and [URL]/hosts/*.host files. If the URL
references a remote directory, host files will be resolved by expanding a
index file at the address [URL]/hosts.idx containing a list of host file
urls. If the host file URL is not absolute it will be resolved relative to
the the base url.
+ </TD>
+</TR>
+</TABLE>
+
</body>
\ No newline at end of file

Modified:
development/main/transit/core/tools/src/main/net/dpml/transit/tools/TransitTask.java
==============================================================================
---
development/main/transit/core/tools/src/main/net/dpml/transit/tools/TransitTask.java
(original)
+++
development/main/transit/core/tools/src/main/net/dpml/transit/tools/TransitTask.java
Wed Jul 6 23:10:14 2005
@@ -121,7 +121,6 @@
String auth = project.getProperty( "dpml.transit.authority" );
if( null != auth )
{
-
System.setProperty( "dpml.transit.authority",
System.getProperty( "dpml.transit.authority", auth ) );
}



  • svn commit: r2998 - in development/main/transit/core: . handler/src/main/net/dpml/transit handler/src/main/net/dpml/transit/model handler/src/main/net/dpml/transit/store handler/src/main/net/dpml/transit/unit handler/src/test/net/dpml/transit/manager tools/src/main/net/dpml/transit/tools, mcconnell, 07/06/2005

Archive powered by MHonArc 2.6.24.

Top of Page