notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2976 - in development/main: depot/install/src/main/net/dpml/depot/install depot/prefs/src/main/net/dpml/depot/prefs magic magic/core/src/main/net/dpml/magic metro metro/central/src/main/net/dpml/metro/central transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/store transit/core/handler/src/main/net/dpml/transit/unit
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2976 - in development/main: depot/install/src/main/net/dpml/depot/install depot/prefs/src/main/net/dpml/depot/prefs magic magic/core/src/main/net/dpml/magic metro metro/central/src/main/net/dpml/metro/central transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/store transit/core/handler/src/main/net/dpml/transit/unit
- Date: Tue, 05 Jul 2005 02:48:16 -0400
Author: mcconnell AT dpml.net
Date: Tue Jul 5 02:48:16 2005
New Revision: 2976
Added:
development/main/magic/core/src/main/net/dpml/magic/MagicInstaller.java
development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
Modified:
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
development/main/magic/module.xml
development/main/metro/module.xml
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
Log:
Complete the support for the installation of Magic via the Depot Installer.
Modified:
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
==============================================================================
---
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
(original)
+++
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
Tue Jul 5 02:48:16 2005
@@ -33,9 +33,9 @@
import net.dpml.transit.artifact.UnsupportedSchemeException;
import net.dpml.transit.artifact.MissingGroupException;
import net.dpml.transit.model.TransitRegistryModel;
+import net.dpml.transit.model.DefaultTransitRegistryModel;
import net.dpml.transit.model.Logger;
import net.dpml.transit.unit.TransitStorageHome;
-import net.dpml.transit.model.DefaultTransitRegistryModel;
/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
@@ -250,7 +250,7 @@
private void installZipBundle( Artifact artifact ) throws Exception
{
- ZipInstaller installer = new ZipInstaller( m_logger );
+ ZipInstaller installer = new ZipInstaller( m_logger, m_depot,
m_transit );
installer.install( artifact );
}
Modified:
development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
==============================================================================
---
development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
(original)
+++
development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
Tue Jul 5 02:48:16 2005
@@ -22,19 +22,25 @@
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.FileInputStream;
import java.io.OutputStream;
import java.net.URL;
+import java.net.URI;
import java.util.zip.ZipFile;
import java.util.zip.ZipEntry;
import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Date;
import net.dpml.depot.profile.DepotProfile;
import net.dpml.depot.profile.ApplicationProfile;
import net.dpml.transit.Transit;
+import net.dpml.transit.repository.Repository;
import net.dpml.transit.artifact.Artifact;
import net.dpml.transit.artifact.ArtifactNotFoundException;
import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.TransitRegistryModel;
import net.dpml.transit.util.StreamUtils;
/**
@@ -47,6 +53,10 @@
//--------------------------------------------------------------------------
private final Logger m_logger;
+ private final TransitRegistryModel m_transit;
+ private final DepotProfile m_depot;
+
+ private File m_bundle = null;
//--------------------------------------------------------------------------
// constructor
@@ -59,13 +69,17 @@
* @param logger the assigned logging channel
* @param artifact the installable artifact
*/
- public ZipInstaller( Logger logger ) throws Exception
+ public ZipInstaller( Logger logger, DepotProfile depot,
TransitRegistryModel transit ) throws Exception
{
m_logger = logger;
+ m_depot = depot;
+ m_transit = transit;
}
- public void install( Artifact artifact ) throws Exception
+ public synchronized void install( Artifact artifact ) throws Exception
{
+ m_bundle = null;
+
try
{
URL url = artifact.toURL();
@@ -74,16 +88,83 @@
System.out.println( " cached to: " + file );
ZipFile zip = new ZipFile( file );
int size = zip.size();
- System.out.println( " unpacking " + size + " entries" );
-
+ System.out.println( " unpacking " + size + " entries\n" );
unpack( zip );
-
+
+ System.out.println( "\n content update complete" );
+
}
catch( ArtifactNotFoundException e )
{
System.out.println( " Artifact not found.\n" );
throw new HandledException();
}
+
+ //
+ // if the installation declared a bundle then fire it
+ //
+
+ if( m_bundle != null )
+ {
+ System.out.println( " resolving package installer" );
+ Properties properties = new Properties();
+ try
+ {
+ FileInputStream input = new FileInputStream( m_bundle );
+ properties.load( input );
+ }
+ catch( IOException e )
+ {
+ final String error =
+ " Unable to load installer parameters."
+ + "\n Cause: " + e.getClass().getName()
+ + "\n Message: " + e.getMessage()
+ + "\n";
+ System.out.println( error );
+ throw new HandledException();
+ }
+
+ String plugin = properties.getProperty(
"dpml.depot.installer.uri", null );
+ if( null == plugin )
+ {
+ final String error =
+ " ERROR: Installer does not declare a plugin uri.\n";
+ System.out.println( error );
+ throw new HandledException();
+ }
+
+ String classname = properties.getProperty(
"dpml.depot.installer.class", null );
+ if( null == classname )
+ {
+ final String error =
+ " ERROR: Installer does not declare a classname.\n";
+ System.out.println( error );
+ throw new HandledException();
+ }
+
+ System.out.println( " installer: " + plugin );
+ System.out.println( " class: [" + classname + "]" );
+
+ try
+ {
+ Repository loader = Transit.getInstance().getRepository();
+ URI uri = new URI( plugin );
+ ClassLoader parent = ZipInstaller.class.getClassLoader();
+ ClassLoader classloader = loader.getPluginClassLoader(
parent, uri );
+ Class c = classloader.loadClass( classname );
+ Boolean flag = new Boolean( true );
+ loader.instantiate( c, new Object[]{ m_logger, m_transit,
m_depot, flag } );
+ System.out.println( " Installation complete.\n" );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ " ERROR: Installer deployment failure.";
+ System.out.println( error );
+ e.printStackTrace();
+ throw new HandledException();
+ }
+ }
}
private void unpack( ZipFile zip ) throws Exception
@@ -110,10 +191,16 @@
StreamUtils.copyStream( input, output, true );
}
- private File getDestination( ZipEntry entry )
+ private File getDestination( ZipEntry entry ) throws Exception
{
String name = entry.getName();
- if( name.startsWith( "share/" ) )
+ if( name.equals( "BUNDLE" ) )
+ {
+ long time = new Date().getTime();
+ m_bundle = File.createTempFile( "depot-bundle", "" + time );
+ return m_bundle;
+ }
+ else if( name.startsWith( "share/" ) )
{
//
// shared resources go into into DPML_SYSTEM
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
Tue Jul 5 02:48:16 2005
@@ -597,8 +597,7 @@
public void actionPerformed( ActionEvent event )
{
- String baseValue = m_base.getText();
- URL base = resolveBaseURL( baseValue );
+ String base = m_base.getText();
boolean trusted = m_trusted.isSelected();
boolean enabled = m_enabled.isSelected();
LayoutModel layout = (LayoutModel) m_strategy.getSelectedItem();
Added: development/main/magic/core/src/main/net/dpml/magic/MagicInstaller.java
==============================================================================
--- (empty file)
+++ development/main/magic/core/src/main/net/dpml/magic/MagicInstaller.java
Tue Jul 5 02:48:16 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 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.magic;
+
+import net.dpml.transit.model.TransitRegistryModel;
+import net.dpml.transit.model.UnknownKeyException;
+
+/**
+ */
+public class MagicInstaller
+{
+ public MagicInstaller( TransitRegistryModel home, Boolean install )
throws Exception
+ {
+ String profile = "development";
+ if( install.booleanValue() )
+ {
+ try
+ {
+ home.getTransitModel( profile );
+ System.out.println( " transit development profile exists
(no action required)" );
+ }
+ catch( UnknownKeyException e )
+ {
+ System.out.println( " adding transit development profile" );
+ home.addTransitModel( profile );
+ System.out.println( " profile created" );
+ }
+ }
+ else
+ {
+ System.out.println( " removing transit development profile" );
+ }
+ }
+}
Modified: development/main/magic/module.xml
==============================================================================
--- development/main/magic/module.xml (original)
+++ development/main/magic/module.xml Tue Jul 5 02:48:16 2005
@@ -121,6 +121,12 @@
<!-- zip up a copy of the platform independent bundle for use by depot
-->
+ <x:property name="magic.plugin.uri" key="dpml-magic-core" feature="uri"
type="plugin"/>
+ <echo file="${bundle}/BUNDLE">
+dpml.depot.installer.class = net.dpml.magic.MagicInstaller
+dpml.depot.installer.uri = ${magic.plugin.uri}
+ </echo>
+
<property name="zip.filename"
value="${basedir}/target/deliverables/zips/${project.name}-${project.version}.zip"/>
<mkdir dir="target/deliverables/zips"/>
Added:
development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
==============================================================================
--- (empty file)
+++
development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
Tue Jul 5 02:48:16 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005 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.metro.central;
+
+import net.dpml.transit.model.TransitRegistryModel;
+
+/**
+ */
+public class MetroInstaller
+{
+ public MetroInstaller( TransitRegistryModel home, Boolean install )
throws Exception
+ {
+ if( install.booleanValue() )
+ {
+ System.out.println( "## INSTALLING " + getClass().getName() );
+ }
+ else
+ {
+ System.out.println( "## DEINSTALLING " + getClass().getName() );
+ }
+ }
+}
Modified: development/main/metro/module.xml
==============================================================================
--- development/main/metro/module.xml (original)
+++ development/main/metro/module.xml Tue Jul 5 02:48:16 2005
@@ -74,6 +74,12 @@
<!-- zip up a copy of the platform independent bundle for use by depot
-->
+ <x:property name="metro.plugin.uri" key="dpml-metro-central"
feature="uri" type="plugin"/>
+ <echo file="${bundle}/BUNDLE">
+dpml.depot.installer.class = net.dpml.metro.central.MetroInstaller
+dpml.depot.installer.uri = ${metro.plugin.uri}
+ </echo>
+
<property name="zip.filename"
value="${basedir}/target/deliverables/zips/${project.name}-${project.version}.zip"/>
<mkdir dir="target/deliverables/zips"/>
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
Tue Jul 5 02:48:16 2005
@@ -20,6 +20,7 @@
import java.io.File;
import java.net.URI;
+import java.net.MalformedURLException;
import java.rmi.RemoteException;
/**
@@ -96,7 +97,8 @@
* @exception DuplicateKeyException if a host of the same identifier
already exists
* @exception UnknownKeyException if a host references an unknown layout
key
*/
- void addHostModel( String id ) throws DuplicateKeyException,
UnknownKeyException, RemoteException;
+ void addHostModel( String id )
+ throws DuplicateKeyException, UnknownKeyException, RemoteException,
MalformedURLException;
/**
* Add a new host model to the cache model.
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
Tue Jul 5 02:48:16 2005
@@ -23,6 +23,7 @@
import java.rmi.RemoteException;
import java.net.URI;
import java.net.UnknownHostException;
+import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
@@ -79,7 +80,7 @@
public DefaultCacheModel(
Logger logger, CacheHome home, LayoutRegistryModel registry )
- throws DuplicateKeyException, RemoteException, UnknownKeyException
+ throws DuplicateKeyException, RemoteException, UnknownKeyException,
MalformedURLException
{
super( logger, home );
if( null == registry )
@@ -227,14 +228,15 @@
}
}
- public void addHostModel( String id ) throws DuplicateKeyException,
UnknownKeyException, RemoteException
+ public void addHostModel( String id )
+ throws DuplicateKeyException, UnknownKeyException, RemoteException,
MalformedURLException
{
HostStorage store = m_home.getHostStorage( id );
addHostModel( store, true );
}
public void addHostModel( HostStorage store, boolean notify )
- throws DuplicateKeyException, UnknownKeyException, RemoteException
+ throws DuplicateKeyException, UnknownKeyException, RemoteException,
MalformedURLException
{
String id = store.getID();
Logger logger = getLogger().getChildLogger( id );
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
Tue Jul 5 02:48:16 2005
@@ -28,6 +28,7 @@
import java.util.List;
import java.net.URI;
import java.net.URL;
+import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.net.PasswordAuthentication;
@@ -36,8 +37,8 @@
import net.dpml.transit.store.Strategy;
import net.dpml.transit.store.PluginStrategy;
import net.dpml.transit.store.LocalStrategy;
-
import net.dpml.transit.network.RequestIdentifier;
+import net.dpml.transit.util.PropertyResolver;
/**
* Default implementation of a host manager. The implementation establishes
@@ -56,8 +57,10 @@
private final String m_id;
private String m_name;
- private URL m_base;
- private URL m_index;
+ private String m_base;
+ private String m_index;
+ private URL m_baseURL;
+ private URL m_indexURL;
private boolean m_enabled = false;
private boolean m_trusted = false;
private LayoutModel m_layout;
@@ -73,10 +76,10 @@
//
------------------------------------------------------------------------
public DefaultHostModel(
- Logger logger, LayoutRegistryModel registry, URI uri, String id, URL
base, URL index,
+ Logger logger, LayoutRegistryModel registry, URI uri, String id,
String base, String index,
String name, boolean trusted, boolean enabled, int priority, String
layout,
PasswordAuthentication auth, String scheme, String prompt, boolean
bootstrap )
- throws RemoteException, UnknownKeyException
+ throws RemoteException, UnknownKeyException, MalformedURLException
{
super( logger, uri );
@@ -89,17 +92,18 @@
m_enabled = enabled;
m_priority = priority;
m_layout = registry.getLayoutModel( layout );
- m_base = base;
+ m_base = resolveBaseValue( base );
m_index = index;
+ m_baseURL = resolveBaseURL( m_id, m_base );
+ m_indexURL = resolveIndexURL( m_id, m_baseURL, m_index );
m_authentication = auth;
-
m_layout.addDisposalListener( this );
- m_identifier = getRequestIdentifier( base, scheme, prompt );
+ m_identifier = getRequestIdentifier( m_baseURL, scheme, prompt );
m_bootstrap = bootstrap;
}
public DefaultHostModel( Logger logger, HostStorage home,
LayoutRegistryModel registry )
- throws RemoteException, UnknownKeyException
+ throws RemoteException, UnknownKeyException, MalformedURLException
{
super( logger, home );
@@ -111,8 +115,11 @@
m_trusted = home.getTrusted();
m_enabled = home.getEnabled();
m_priority = home.getPriority();
- m_base = home.getBaseURL();
- m_index = home.getIndexURL( m_base );
+
+ m_base = resolveBaseValue( home.getBasePath() );
+ m_index = home.getIndexPath();
+ m_baseURL = resolveBaseURL( m_id, m_base );
+ m_indexURL = resolveIndexURL( m_id, m_baseURL, m_index );
m_authentication = home.getAuthentication();
String key = home.getLayoutModelKey();
@@ -121,7 +128,7 @@
String scheme = home.getScheme();
String prompt = home.getPrompt();
- m_identifier = getRequestIdentifier( m_base, scheme, prompt );
+ m_identifier = getRequestIdentifier( m_baseURL, scheme, prompt );
Strategy strategy = home.getStrategy();
if( strategy instanceof PluginStrategy )
@@ -186,21 +193,24 @@
//----------------------------------------------------------------------
public void update(
- URL base, URL index, boolean enabled, boolean trusted, String layout,
+ String base, String index, boolean enabled, boolean trusted, String
layout,
PasswordAuthentication auth, String scheme, String prompt )
- throws BootstrapException, UnknownKeyException, RemoteException
+ throws BootstrapException, UnknownKeyException, RemoteException,
MalformedURLException
{
synchronized( m_lock )
{
LayoutModel layoutModel = m_registry.getLayoutModel( layout );
setLayoutModel( layoutModel );
- m_base = base;
+ m_base = resolveBaseValue( base );
m_index = index;
+ m_baseURL = resolveBaseURL( m_id, m_base );
+ m_indexURL = resolveIndexURL( m_id, m_baseURL, m_index );
+
m_enabled = enabled;
m_trusted = trusted;
m_authentication = auth;
- m_identifier = getRequestIdentifier( base, scheme, prompt );
+ m_identifier = getRequestIdentifier( m_baseURL, scheme, prompt );
if( null != m_home )
{
@@ -209,7 +219,7 @@
HostChangeEvent e =
new HostChangeEvent(
- this, base, index, m_identifier, auth, enabled, trusted );
+ this, m_baseURL, m_indexURL, m_identifier, auth, enabled,
trusted );
enqueueEvent( e );
}
}
@@ -365,7 +375,7 @@
* Return the host base url.
* @return the base url
*/
- public URL getBaseURL() throws RemoteException
+ public String getBasePath() throws RemoteException
{
synchronized( m_lock )
{
@@ -374,10 +384,22 @@
}
/**
+ * Return the host base url.
+ * @return the base url
+ */
+ public URL getBaseURL() throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ return m_baseURL;
+ }
+ }
+
+ /**
* Return index url.
* @return the index url
*/
- public URL getIndexURL() throws RemoteException
+ public String getIndexPath() throws RemoteException
{
synchronized( m_lock )
{
@@ -386,6 +408,18 @@
}
/**
+ * Return index url.
+ * @return the index url
+ */
+ public URL getIndexURL() throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ return m_indexURL;
+ }
+ }
+
+ /**
* Return the enabled status of the host.
* @return TRUE if enabled
*/
@@ -595,6 +629,23 @@
// static (utils)
//
------------------------------------------------------------------------
+ private static String resolveBaseValue( String path )
+ {
+ //
+ // make sure the base path ends with a "/" otherwise relative url
references
+ // will not be correct
+ //
+
+ if( false == path.endsWith( "/" ) )
+ {
+ return path + "/";
+ }
+ else
+ {
+ return path;
+ }
+ }
+
private static RequestIdentifier getRequestIdentifier( URL base, String
scheme, String prompt )
{
if( null == base )
@@ -630,6 +681,59 @@
return new RequestIdentifier( host, port, protocol, scheme, prompt );
}
+ private static URL resolveBaseURL( String id, String path ) throws
MalformedURLException
+ {
+ if( null == path )
+ {
+ return getDefaultHostURL();
+ }
+ try
+ {
+ return new URL( path );
+ }
+ catch( MalformedURLException e )
+ {
+ final String error =
+ "Invalid host base url"
+ + "\nHost ID: " + id
+ + "\nHost Path: " + path
+ + "\nCause: " + e.getMessage();
+ throw new MalformedURLException( error );
+ }
+ }
+
+ private static URL resolveIndexURL( String id, URL base, String path )
throws MalformedURLException
+ {
+ if( null == path )
+ {
+ return null;
+ }
+
+ String resolved = PropertyResolver.resolve( path );
+
+ try
+ {
+ return new URL( resolved );
+ }
+ catch( MalformedURLException e )
+ {
+ try
+ {
+ return new URL( base, resolved );
+ }
+ catch( MalformedURLException ee )
+ {
+ final String error =
+ "Invalid index url"
+ + "\nHost ID: " + id
+ + "\nHost Path: " + base
+ + "\nIndex Path: " + path
+ + "\nCause: " + e.getMessage();
+ throw new MalformedURLException( error );
+ }
+ }
+ }
+
private static URL getDefaultHostURL()
{
try
@@ -641,6 +745,5 @@
return null;
}
}
-
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
Tue Jul 5 02:48:16 2005
@@ -20,6 +20,7 @@
import java.net.URL;
import java.net.URI;
+import java.net.MalformedURLException;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.rmi.RemoteException;
@@ -62,12 +63,24 @@
int getPriority() throws RemoteException;
/**
+ * Return the host base path.
+ * @return the base path
+ */
+ String getBasePath() throws RemoteException;
+
+ /**
* Return the host base url.
* @return the base url
*/
URL getBaseURL() throws RemoteException;
/**
+ * Return index path.
+ * @return the index path
+ */
+ String getIndexPath() throws RemoteException;
+
+ /**
* Return index url.
* @return the index url
*/
@@ -125,9 +138,9 @@
void setLayoutModel( LayoutModel layout ) throws BootstrapException,
RemoteException;
void update(
- URL base, URL index, boolean enabled, boolean trusted, String layout,
+ String base, String index, boolean enabled, boolean trusted, String
layout,
PasswordAuthentication auth, String scheme, String prompt )
- throws BootstrapException, UnknownKeyException, RemoteException;
+ throws BootstrapException, UnknownKeyException, MalformedURLException,
RemoteException;
/**
* Add a host change listener to the director.
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java
Tue Jul 5 02:48:16 2005
@@ -44,9 +44,9 @@
String getLayoutModelKey();
- URL getBaseURL();
+ String getBasePath();
- URL getIndexURL( URL base );
+ String getIndexPath();
PasswordAuthentication getAuthentication();
@@ -57,7 +57,7 @@
Strategy getStrategy();
void setHostSettings(
- URL base, URL index, boolean enabled, boolean trusted, String layout,
+ String base, String index, boolean enabled, boolean trusted, String
layout,
PasswordAuthentication auth, String scheme, String prompt );
void setName( String name );
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
Tue Jul 5 02:48:16 2005
@@ -58,14 +58,14 @@
//
------------------------------------------------------------------------
public void setHostSettings(
- URL base, URL index, boolean enabled, boolean trusted, String layout,
+ String base, String index, boolean enabled, boolean trusted, String
layout,
PasswordAuthentication auth, String scheme, String prompt )
{
Preferences prefs = getPreferences();
synchronized( prefs )
{
- setURL( "base", base );
- setURL( "index", index );
+ setValue( "base", base );
+ setValue( "index", index );
setTrusted( trusted );
setEnabled( enabled );
setLayoutModelKey( layout );
@@ -143,33 +143,10 @@
}
}
- public URL getBaseURL() throws BuilderException
+ public String getBasePath() throws BuilderException
{
Preferences prefs = getPreferences();
- String baseSpec = prefs.get( "base", "http://localhost" );
-
- //
- // make sure the base path ends with a "/" otherwise relative url
references
- // will not be correct
- //
-
- if( false == baseSpec.endsWith( "/" ) )
- {
- baseSpec = baseSpec + "/";
- }
-
- try
- {
- return new URL( baseSpec );
- }
- catch( MalformedURLException e )
- {
- final String error =
- "Invalid host base url"
- + "\nHost ID: " + prefs.name()
- + "\nHost Path: " + baseSpec;
- throw new BuilderException( error, e );
- }
+ return prefs.get( "base", "http://localhost" );
}
public PasswordAuthentication getAuthentication()
@@ -187,31 +164,10 @@
}
}
- public URL getIndexURL( URL base ) throws BuilderException
+ public String getIndexPath() throws BuilderException
{
Preferences prefs = getPreferences();
- if( null == base )
- {
- throw new NullPointerException( "base" );
- }
- String indexSpec = prefs.get( "index", null );
- if( null == indexSpec )
- {
- return null;
- }
-
- try
- {
- return new URL( indexSpec );
- }
- catch( MalformedURLException e )
- {
- final String error =
- "Invalid index url"
- + "\nHost ID: " + prefs.name()
- + "\nIndex Path: " + indexSpec;
- throw new BuilderException( error, e );
- }
+ return prefs.get( "index", null );
}
private void setTrusted( boolean trusted )
- svn commit: r2976 - in development/main: depot/install/src/main/net/dpml/depot/install depot/prefs/src/main/net/dpml/depot/prefs magic magic/core/src/main/net/dpml/magic metro metro/central/src/main/net/dpml/metro/central transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/store transit/core/handler/src/main/net/dpml/transit/unit, mcconnell, 07/05/2005
Archive powered by MHonArc 2.6.24.