Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2915 - in development/main/transit/core/handler/src: main/net/dpml/transit/store main/net/dpml/transit/unit test/net/dpml/transit/manager test/net/dpml/transit/test

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: r2915 - in development/main/transit/core/handler/src: main/net/dpml/transit/store main/net/dpml/transit/unit test/net/dpml/transit/manager test/net/dpml/transit/test
  • Date: Fri, 24 Jun 2005 13:17:33 -0400

Author: mcconnell AT dpml.net
Date: Fri Jun 24 13:17:32 2005
New Revision: 2915

Added:

development/main/transit/core/handler/src/test/net/dpml/transit/test/AuthorityTestCase.java
Modified:

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

development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.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/ProxyManagerTestCase.java
Log:
Update to include system property detection for transit authority based
configuraton.

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
Fri Jun 24 13:17:32 2005
@@ -42,8 +42,6 @@

void setAuthority( URL authority );

- void setReadOnly();
-
void useFactoryInitialization( boolean policy );

void clearBeforeInitialization( boolean policy );

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.java
Fri Jun 24 13:17:32 2005
@@ -168,10 +168,10 @@
{
File file = files[i];
String name = file.getName();
- if( name.indexOf( "." ) > -1 )
- {
- name = name.substring( 0, name.indexOf( "." ) );
- }
+ //if( name.indexOf( "." ) > -1 )
+ //{
+ // name = name.substring( 0, name.indexOf( "." )
);
+ //}
Preferences host = hostsPrefs.node( name );
URL hostUrl = fileToURL( file );
Properties properties = Util.readProps( hostUrl );

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
Fri Jun 24 13:17:32 2005
@@ -21,14 +21,14 @@
import java.rmi.registry.Registry;
import java.rmi.activation.ActivationSystem;
import java.util.Date;
+import java.util.Properties;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

import net.dpml.transit.Transit;
-
-import net.dpml.transit.model.Logger;
-
+import net.dpml.transit.TransitError;
import net.dpml.transit.adapter.LoggingAdapter;
+import net.dpml.transit.model.Logger;
import net.dpml.transit.model.Connection;
import net.dpml.transit.model.DefaultTransitModel;
import net.dpml.transit.model.DefaultProxyModel;
@@ -44,6 +44,7 @@
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.model.VetoDisposalException;
import net.dpml.transit.store.TransitHome;
+import net.dpml.transit.util.PropertyResolver;

/**
*
@@ -60,6 +61,7 @@
Preferences.userNodeForPackage( Transit.class ).node( "profiles" );
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";

//
------------------------------------------------------------------------
// state
@@ -79,6 +81,27 @@

public TransitStorageUnit()
{
+ 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
+ {
+ m_authority = new URL( path );
+ m_purgePolicy = true;
+ }
+ catch( MalformedURLException e )
+ {
+ final String error =
+ "Invaid authority url: " + path;
+ throw new TransitError( error, e );
+ }
+ }
}

public TransitStorageUnit( Preferences prefs )
@@ -90,16 +113,6 @@
// Home
//
------------------------------------------------------------------------

- public boolean isReadOnly()
- {
- return m_readonly;
- }
-
- public boolean isMutable()
- {
- return !isReadOnly();
- }
-
/**
* Return the home identifier.
* @return the home id
@@ -137,11 +150,6 @@
}
}

- public void setReadOnly()
- {
- m_readonly = true;
- }
-
public void useFactoryInitialization( boolean policy )
{
m_factoryPolicy = policy;
@@ -358,7 +366,7 @@

private URL getAuthority()
{
- return m_authority;
+ return m_authority;
}

private boolean getStoragePolicy()

Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
Fri Jun 24 13:17:32 2005
@@ -55,7 +55,6 @@
Preferences prefs =
Preferences.userNodeForPackage( Transit.class ).node( "test"
).node( "proxy-test" );
TransitHome home = new TransitStorageUnit( prefs );
- home.setReadOnly();
m_model = home.create();
}


Added:
development/main/transit/core/handler/src/test/net/dpml/transit/test/AuthorityTestCase.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/test/AuthorityTestCase.java
Fri Jun 24 13:17:32 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004 Niclas Hedhman.
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed 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 net.dpml.transit.test;
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.prefs.Preferences;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import junit.framework.TestCase;
+
+import net.dpml.transit.Transit;
+import net.dpml.transit.adapter.LoggingAdapter;
+import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.store.TransitHome;
+import net.dpml.transit.unit.TransitStorageUnit;
+
+/**
+ * URL Handler TestCase for Offline operations.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id: OnlineTestCase.java 2900 2005-06-22 19:10:15Z
mcconnell AT dpml.net $
+ */
+public class AuthorityTestCase extends TestCase
+{
+ private static Transit TRANSIT = null;
+
+ protected void setUp() throws Exception
+ {
+ System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
+ System.setProperty( "dpml.transit.authority",
"file:${dpml.prefs}/transit/authority" );
+ System.setProperty( "dpml.transit.profile", "test-authority" );
+ TRANSIT = Transit.getInstance();
+ }
+
+ public void testNothing() throws Exception
+ {
+ // vaidated during setup
+ }
+}



  • svn commit: r2915 - in development/main/transit/core/handler/src: main/net/dpml/transit/store main/net/dpml/transit/unit test/net/dpml/transit/manager test/net/dpml/transit/test, mcconnell, 06/24/2005

Archive powered by MHonArc 2.6.24.

Top of Page