/*=============================================================================*
* Copyright 2005 The Apache Software Foundation
*
* 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 org.apache.ws.muse.example.application;
import java.util.Calendar;
import org.apache.ws.mows.v1_0.MowsConstants;
import org.apache.ws.mows.v1_0.capability.MetricsCapability;
import org.apache.ws.mows.v1_0.capability.OperationalStatusCapability;
import org.apache.ws.muse.example.ExampleConstants;
import org.apache.ws.muse.example.ExampleUtils;
import org.apache.ws.muse.example.application.backend.ApplicationInstance;
import org.apache.ws.muse.example.application.callback.CumulativeExecutionTimeCallback;
import org.apache.ws.muse.example.application.callback.TotalNumberOfRequestsCallback;
import org.apache.ws.muse.example.resourceadmin.properties.CreateParamsType;
import org.apache.ws.muws.MuwsUtils;
import org.apache.ws.muws.v1_0.capability.DescriptionCapability;
import org.apache.ws.muws.v1_0.capability.IdentityCapability;
import org.apache.ws.muws.v1_0.capability.ManageabilityCharacteristicsCapability;
import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
import org.apache.ws.muws.v1_0.topics.ManagementEventTopic;
import org.apache.ws.muws.v1_0.topics.impl.XmlBeansManagementEventTopicImpl;
import org.apache.ws.notification.topics.TopicSpace;
import org.apache.ws.notification.topics.TopicSpaceSet;
import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CurrentTimeDocument;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipParticipantType;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
* * @author Kinga Dziembowski
* A Application WS-Resource.
* <p/>
* NOTE: This class is generated but IS meant to be modified.
*/
public class ApplicationResource
extends AbstractApplicationResource
{
/**
* A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
*/
public static final org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl SPEC_NAMESPACE_SET =
new org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl( );
/** The value for the ImplementationProfile property **/
public static final String RESOURCE_TYPE = "EnterpriseApplication";
/** The value for the Caption property **/
public static final String CAPTION = "Application";
/** The value for the Version property **/
public static final String VERSION = "1.0";
/** The value for the Description property */
public static final String DESCRIPTION = "Application Resource";
/** A resource variable to hold the reference for backend */
private ApplicationInstance m_instance = null;
/** The operational event emmiter - simulation of low disk space use case
*
*/
private EventScheduler m_eventScheduler;
/** A log object */
private static final Log LOG = LogFactory.getLog( ApplicationResource.class.getName() );
/**
* Creates a new {@link ApplicationResource} object.
*
* @param resourceId DOCUMENT_ME
* @param params DOCUMENT_ME
*/
public ApplicationResource( Object resourceId,
CreateParamsType params )
{
setID( resourceId );
// params can have any important information for the creation of Resource
// in this example it is not used
}
// not exposed by WSDM, utility operation to set the relationship for the resource
public void setRelationship( org.apache.ws.muse.example.resourceadmin.properties.SetRelationshipDocument requestDoc )
throws Exception
{
org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet =
getResourcePropertySet( );
org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.RELATIONSHIP );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument prop_relationship =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDocument.Factory.newInstance( );
RelationshipType relationshipType =
prop_relationship.addNewRelationship( );
relationshipType.setType( requestDoc.getSetRelationship( ).getType( ) );
RelationshipParticipantType[] partTo =
requestDoc.getSetRelationship( ).getRelationshipTo( ).getParticipantArray( );
int numOfToParticipants = partTo.length;
if ( numOfToParticipants > 0 )
{
//There is the from participant - will be in the first position in the array,
// there needs to be at least one participant to, can be more.
RelationshipParticipantType[] participants = new RelationshipParticipantType[numOfToParticipants + 1];
participants[0] = requestDoc.getSetRelationship( ).getRelationshipFrom( ).getParticipant( );
for ( int i = 0; i < numOfToParticipants; i++ )
{
participants[i + 1] = partTo[i];
}
relationshipType.setParticipantArray( participants );
resourceProperty.add( prop_relationship );
if ( LOG.isDebugEnabled() )
{
LOG.debug( "SetRelationship - " + prop_relationship );
}
}
else
{
throw new Exception( "Missing Relationship Participant" );
}
}
/**
* Initializes this resource's state (properties, etc.).
*/
public void init( )
{
super.init( );
/**
* The ResourcePropertySet which contains all the defined ResourceProperties
*/
org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet( );
org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
try
{
// create the backend object associated with this resource
m_instance = new ApplicationInstance( getID( ).toString( ) );
TopicSpaceSet aSet = getTopicSpaceSet( );
/* MUWS TopicSpace is returned by MuwsUtils.addRelationshipTopics - This utility operation adds relationship topics support. I
* nternaly the code :
* TopicSpace muwsTopicSpace = new TopicSpaceImpl( MuwsConstants.NSURI_MUWS_PART2_TOPICS )
* aSet.addTopicSpace( muwsTopicSpace ) is executed. We are adding more MUWS topics to this
* TopicSpace.
*/
TopicSpace muwsTopicSpace = MuwsUtils.addRelationshipTopics( aSet );
ManagementEventTopic identityCapability =
new XmlBeansManagementEventTopicImpl( IdentityCapability.TOPIC_NAME );
muwsTopicSpace.addTopic( identityCapability );
ManagementEventTopic manageabilityCharacteristicsCapability =
new XmlBeansManagementEventTopicImpl( ManageabilityCharacteristicsCapability.TOPIC_NAME );
muwsTopicSpace.addTopic( manageabilityCharacteristicsCapability );
ManagementEventTopic muwsDescriptionCapability =
new XmlBeansManagementEventTopicImpl( DescriptionCapability.TOPIC_NAME );
muwsTopicSpace.addTopic( muwsDescriptionCapability );
ManagementEventTopic metricCapability =
new XmlBeansManagementEventTopicImpl( MetricsCapability.TOPIC_NAME );
muwsTopicSpace.addTopic( metricCapability );
// OperationalStatusCapability MUWS topic - add subtopics for AvailableDiskSpace
ManagementEventTopic operationalStatCapability =
new XmlBeansManagementEventTopicImpl( OperationalStatusCapability.TOPIC_NAME );
//ManagementEventTopic statusDiskSpace = new XmlBeansManagementEventTopicImpl( ApplicationHome.AVAILABLE_DISK_TOPIC );
//operationalStatCapability.addTopic(statusDiskSpace);
muwsTopicSpace.addTopic( operationalStatCapability );
m_eventScheduler = new EventScheduler( this );
//MOWS TopicSpace
TopicSpace mowsTopicSpace = new TopicSpaceImpl( MowsConstants.NSURI_MOWS_TOPICS );
getTopicSpaceSet( ).addTopicSpace( mowsTopicSpace );
ManagementEventTopic mowsMetricsCapability =
new XmlBeansManagementEventTopicImpl( MetricsCapability.TOPIC_NAME );
mowsTopicSpace.addTopic( mowsMetricsCapability );
// init the {http://ws.apache.org/muse/example/application/properties}TotalNumberOfRequests Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.TOTALNUMBEROFREQUESTS );
org.apache.ws.muse.example.application.properties.TotalNumberOfRequestsDocument prop_totalnumberofrequests =
org.apache.ws.muse.example.application.properties.TotalNumberOfRequestsDocument.Factory.newInstance( );
org.apache.ws.namespaces.muse.muwsExt1.LongMetric totNumReq =
org.apache.ws.namespaces.muse.muwsExt1.LongMetric.Factory.newInstance( );
Calendar calendarInst =
Calendar.getInstance( );
totNumReq.setLongValue( m_instance.getTotalNumberOfRequests( ) );
totNumReq.setLastUpdated( calendarInst );
prop_totalnumberofrequests.setTotalNumberOfRequests( totNumReq );
prop_totalnumberofrequests.setTotalNumberOfRequests( totNumReq );
resourceProperty.add( prop_totalnumberofrequests );
resourceProperty.setCallback( new TotalNumberOfRequestsCallback( m_instance ) );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.RESOURCEID );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument prop_resourceid =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ResourceIdDocument.Factory.newInstance( );
prop_resourceid.setResourceId( getID( ).toString( ) );
resourceProperty.add( prop_resourceid );
resourceProperty.addChangeListener( identityCapability );
// init the {http://ws.apache.org/muse/example/shared}CumulativeExecutionTime Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.CUMULATIVEEXECUTIONTIME );
org.apache.ws.muse.example.shared.CumulativeExecutionTimeDocument prop_cumulativeexecutiontime =
org.apache.ws.muse.example.shared.CumulativeExecutionTimeDocument.Factory.newInstance( );
org.apache.ws.namespaces.muse.muwsExt1.LongMetric cumExecTime =
org.apache.ws.namespaces.muse.muwsExt1.LongMetric.Factory.newInstance( );
cumExecTime.setLongValue( m_instance.getCumulativeExecutionTime( ) );
cumExecTime.setLastUpdated( calendarInst );
prop_cumulativeexecutiontime.setCumulativeExecutionTime( cumExecTime );
resourceProperty.add( prop_cumulativeexecutiontime );
resourceProperty.setCallback( new CumulativeExecutionTimeCallback( m_instance ) );
// init the {http://ws.apache.org/muse/example/shared}ResourceHostname Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.RESOURCEHOSTNAME );
org.apache.ws.namespaces.muse.muwsExt1.ResourceHostnameDocument prop_resourcehostname =
org.apache.ws.namespaces.muse.muwsExt1.ResourceHostnameDocument.Factory.newInstance( );
prop_resourcehostname.setResourceHostname( getHostName( ) );
resourceProperty.add( prop_resourcehostname );
resourceProperty.add( prop_resourcehostname );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Version Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.VERSION );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.VersionDocument prop_version =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.VersionDocument.Factory.newInstance( );
prop_version.setVersion( VERSION );
resourceProperty.add( prop_version );
resourceProperty.addChangeListener( muwsDescriptionCapability );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Caption Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.CAPTION );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CaptionDocument prop_caption =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CaptionDocument.Factory.newInstance( );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString lStringC =
LangString.Factory.newInstance( );
lStringC.setStringValue( CAPTION + "-" + getID( ).toString( ) );
lStringC.setLang( "en" );
prop_caption.setCaption( lStringC );
resourceProperty.add( prop_caption );
resourceProperty.addChangeListener( muwsDescriptionCapability );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ManageabilityCapability Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.MANAGEABILITYCAPABILITY );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument prop_manageabilitycapability =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory
.newInstance( );
prop_manageabilitycapability.setManageabilityCapability( IdentityCapability.URI );
resourceProperty.add( prop_manageabilitycapability );
resourceProperty.addChangeListener( manageabilityCharacteristicsCapability );
prop_manageabilitycapability = ManageabilityCapabilityDocument.Factory.newInstance( );
prop_manageabilitycapability.setManageabilityCapability( org.apache.ws.muws.v1_0.capability.MetricsCapability.URI );
resourceProperty.add( prop_manageabilitycapability );
prop_manageabilitycapability = ManageabilityCapabilityDocument.Factory.newInstance( );
prop_manageabilitycapability.setManageabilityCapability( RelationshipsCapability.URI );
resourceProperty.add( prop_manageabilitycapability );
prop_manageabilitycapability = ManageabilityCapabilityDocument.Factory.newInstance( );
prop_manageabilitycapability.setManageabilityCapability( DescriptionCapability.URI );
resourceProperty.add( prop_manageabilitycapability );
prop_manageabilitycapability = ManageabilityCapabilityDocument.Factory.newInstance( );
prop_manageabilitycapability.setManageabilityCapability( MetricsCapability.URI );
resourceProperty.add( prop_manageabilitycapability );
prop_manageabilitycapability = ManageabilityCapabilityDocument.Factory.newInstance( );
prop_manageabilitycapability.setManageabilityCapability( ExampleConstants.MUWS_EXT_CAPABILITY_URI );
resourceProperty.add( prop_manageabilitycapability );
resourceProperty.addChangeListener( manageabilityCharacteristicsCapability );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}OperationalStatus Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.OPERATIONALSTATUS );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument prop_operationalstatus =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument.Factory.newInstance( );
prop_operationalstatus.setOperationalStatus( OperationalStatusDocument.OperationalStatus.AVAILABLE );
resourceProperty.add( prop_operationalstatus );
// init the {http://ws.apache.org/muse/example/application/properties}NumberOfOutstandingRequests Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.NUMBEROFOUTSTANDINGREQUESTS );
org.apache.ws.muse.example.application.properties.NumberOfOutstandingRequestsDocument prop_numberofoutstandingrequests =
org.apache.ws.muse.example.application.properties.NumberOfOutstandingRequestsDocument.Factory
.newInstance( );
org.apache.ws.namespaces.muse.muwsExt1.IntMetric numOutRequests =
org.apache.ws.namespaces.muse.muwsExt1.IntMetric.Factory.newInstance( );
numOutRequests.setIntValue( m_instance.getNumberOfOutstandingRequests( ) );
numOutRequests.setLastUpdated( calendarInst );
prop_numberofoutstandingrequests.setNumberOfOutstandingRequests( numOutRequests );
resourceProperty.add( prop_numberofoutstandingrequests );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Description Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.DESCRIPTION );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DescriptionDocument prop_description =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.DescriptionDocument.Factory.newInstance( );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString lString =
LangString.Factory.newInstance( );
lString.setStringValue( DESCRIPTION );
lString.setLang( "en" );
prop_description.setDescription( lString );
resourceProperty.add( prop_description );
resourceProperty.addChangeListener( muwsDescriptionCapability );
// init the {http://ws.apache.org/muse/example/shared}ResourceType Resource Property
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.RESOURCETYPE );
org.apache.ws.namespaces.muse.muwsExt1.ResourceTypeDocument prop_resourcetype =
org.apache.ws.namespaces.muse.muwsExt1.ResourceTypeDocument.Factory.newInstance( );
prop_resourcetype.setResourceType( RESOURCE_TYPE );
resourceProperty.add( prop_resourcetype );
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Relationship Resource Property
// init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}CurrentTime ResourceProperty
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.CURRENTTIME );
CurrentTimeDocument currentTimeDocument = CurrentTimeDocument.Factory.newInstance( );
currentTimeDocument.setCurrentTime( Calendar.getInstance( ) );
resourceProperty.add( currentTimeDocument );
resourceProperty.setCallback( new org.apache.ws.resource.lifetime.callback.CurrentTimeCallback( ) );
resourceProperty.addChangeListener( metricCapability );
// init the {http://ws.apache.org/namespaces/muse/muws-ext-1.xsd}Owner Resource Property
resourceProperty = resourcePropertySet.get(ApplicationPropertyQNames.OWNER);
org.apache.ws.namespaces.muse.muwsExt1.OwnerDocument prop_owner = org.apache.ws.namespaces.muse.muwsExt1.OwnerDocument.Factory.newInstance();
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.LangString oString = LangString.Factory.newInstance( );
oString.setStringValue( ExampleConstants.APPLICATION_OWNER );
oString.setLang( "en" );
prop_owner.setOwner( oString );
resourceProperty.add(prop_owner);
// init the {http://ws.apache.org/namespaces/muse/muws-ext-1.xsd}CreationTime Resource Property
resourceProperty = resourcePropertySet.get(ApplicationPropertyQNames.CREATIONTIME);
org.apache.ws.namespaces.muse.muwsExt1.CreationTimeDocument prop_creationtime = org.apache.ws.namespaces.muse.muwsExt1.CreationTimeDocument.Factory.newInstance();
prop_creationtime.setCreationTime(Calendar.getInstance( ));
resourceProperty.add(prop_creationtime);
}
catch ( Exception e )
{
throw new javax.xml.rpc.JAXRPCException( "There was a problem in initializing your resource properties. Please check your init() method. Cause: "
+ e.getLocalizedMessage( ) );
}
// Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}FixedTopicSet is implemented by the framework.
// Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}Topic is implemented by the framework.
// Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}TopicExpressionDialects is implemented by the framework.
}
/**
* DOCUMENT_ME
*
* @param requestDoc DOCUMENT_ME
*
* @throws Exception DOCUMENT_ME
*/
public void removeRelationship( org.apache.ws.muse.example.resourceadmin.properties.RemoveRelationshipDocument requestDoc )
throws Exception
{
// get participants of relationship to be removed
RelationshipType relationshipRemove = requestDoc.getRemoveRelationship( ).getRelationship( );
// get the relationship property from properties set
// then walk all relationships and compare them with the relationship which needs to be removed.
// when the match exist the relationship will be removed from the relationship properties list
// this will genarate realtionshipremoved notification
org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet( );
org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
resourceProperty = resourcePropertySet.get( ApplicationPropertyQNames.RELATIONSHIP );
if ( resourceProperty.isEmpty( ) )
{
return;
}
for ( int i = 0; i < resourceProperty.size( ); i++ )
{
Object relationObj = resourceProperty.get( i );
if ( relationObj instanceof RelationshipType )
{
RelationshipType relationship = (RelationshipType) relationObj;
if ( ExampleUtils.CompareRelationships( relationshipRemove, relationship ) )
{
resourceProperty.remove( relationObj );
//continue to walk - you can have more then one this same relationship
//the notification will be sent to wsdm:RelationshipsCapability/RelationshipDeleted topic
}
}
}
}
/**
* DOCUMENT_ME
*
* @param delayminutes DOCUMENT_ME
* @param frequencySeconds DOCUMENT_ME
*
* @throws EventsEmitFaultException DOCUMENT_ME
*/
public void startEvents( String delayminutes,
String frequencySeconds )
throws EventsEmitFaultException
{
try
{
if ( ( delayminutes == null ) || ( delayminutes.length( ) == 0 ) )
{
throw new Exception( "The Delay param value is not specified" );
}
if ( ( frequencySeconds == null ) || ( frequencySeconds.length( ) == 0 ) )
{
throw new Exception( "The Frequency param value is not specified" );
}
int intDelay = Integer.parseInt( delayminutes );
int intFrequency = Integer.parseInt( frequencySeconds );
getEventScheduler( ).start( intDelay, intFrequency );
}
catch ( Exception e )
{
throw new EventsEmitFaultException( SPEC_NAMESPACE_SET,
e.getMessage( ) );
}
}
/**
* DOCUMENT_ME
*
* @throws EventsEmitFaultException DOCUMENT_ME
*/
public void stopEvents( )
throws EventsEmitFaultException
{
try
{
getEventScheduler( ).stop( );
}
catch ( RuntimeException e )
{
throw new EventsEmitFaultException( SPEC_NAMESPACE_SET,
e.getMessage( ) );
}
}
/**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
*/
protected EventScheduler getEventScheduler( )
{
return m_eventScheduler;
}
/**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
*/
protected String getHostName( )
{
String name = null;
try
{
java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost( );
name = localMachine.getCanonicalHostName( );
}
catch ( java.net.UnknownHostException uhe )
{
uhe.printStackTrace();
}
return name;
}
}