Package org.apache.ws.muse.example.businessprocesstype

Source Code of org.apache.ws.muse.example.businessprocesstype.BusinessprocesstypeResource

/*=============================================================================*
*  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.businessprocesstype;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.mows.v1_0.MowsConstants;
import org.apache.ws.mows.v1_0.capability.MetricsCapability;
import org.apache.ws.muse.example.ExampleConstants;
import org.apache.ws.muse.example.ExampleUtils;
import org.apache.ws.muse.example.businessprocesstype.backend.BusinessProcessInstance;
import org.apache.ws.muse.example.businessprocesstype.callback.CumulativeExecutionTimeCallback;
import org.apache.ws.muse.example.businessprocesstype.callback.NumberOfRunningProcessesCallback;
import org.apache.ws.muse.example.businessprocesstype.callback.NumberOfSuspendedProcessesCallback;
import org.apache.ws.muse.example.businessprocesstype.callback.TotalNumberOfAbortedProcessesCallback;
import org.apache.ws.muse.example.businessprocesstype.callback.TotalNumberOfCompletedProcessesCallback;
import org.apache.ws.muse.example.businessprocesstype.callback.TotalNumberOfTerminatedProcessesCallback;
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.RelationshipParticipantType;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;

import java.util.Calendar;

/**
*
* @author Kinga Dziembowski
*
* A Businessprocesstype WS-Resource.
* <p/>
* NOTE: This class is generated but IS meant to be modified.
*/
public class BusinessprocesstypeResource
   extends AbstractBusinessprocesstypeResource
{
   /**
    * 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 = "BusinessProcess";

   /**  The value for the Caption property **/
   public static final String CAPTION = "BusinessProcess";

   /**  The value for the Version property **/
   public static final String VERSION = "1.0";

   /**  The value for the description property **/
   public static final String DESCRIPTION = "Business process resource";

   /** A resource variable to hold the reference for backend */
   private BusinessProcessInstance m_instance = null;

   /** A log object */
   private static final Log LOG = LogFactory.getLog( BusinessprocesstypeResource.class.getName() );

   /**
    * Creates a new {@link BusinessprocesstypeResource} object.
    *
    * @param resourceId DOCUMENT_ME
    * @param params DOCUMENT_ME
    */
   public BusinessprocesstypeResource( Object      resourceId,
                                       CreateParamsType params )
   {
      setID( resourceId );

      // params can have any important information for the creation of Resource
      // in this example it is not used.
      // It is very powerfull mechanizm to initialize desired state of resource.
   }

   /**
    * DOCUMENT_ME
    *
    * @param requestDoc DOCUMENT_ME
    *
    * @throws Exception DOCUMENT_ME
    */
   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( BusinessprocesstypePropertyQNames.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 BusinessProcessInstance( 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 );

         //MOWS TopicSpace
         TopicSpace mowsTopicSpace = new TopicSpaceImpl( MowsConstants.NSURI_MOWS_TOPICS );
         getTopicSpaceSet(  ).addTopicSpace( mowsTopicSpace );

         ManagementEventTopic mowsMetricsCapability =
            new XmlBeansManagementEventTopicImpl( MetricsCapability.TOPIC_NAME );
         mowsTopicSpace.addTopic( mowsMetricsCapability );

         Calendar calendarInst = Calendar.getInstance(  );

         // init the {http://ws.apache.org/muse/example/businessprocesstype/properties}TotalNumberOfCompletedProcesses Resource Property
         resourceProperty =
            resourcePropertySet.get( BusinessprocesstypePropertyQNames.TOTALNUMBEROFCOMPLETEDPROCESSES );
         org.apache.ws.muse.example.businessprocesstype.properties.TotalNumberOfCompletedProcessesDocument prop_totalnumberofcompletedprocesses =
            org.apache.ws.muse.example.businessprocesstype.properties.TotalNumberOfCompletedProcessesDocument.Factory
            .newInstance(  );
         org.apache.ws.namespaces.muse.muwsExt1.LongMetric                                                 totNumCompl =
            org.apache.ws.namespaces.muse.muwsExt1.LongMetric.Factory.newInstance(  );
         totNumCompl.setLongValue( m_instance.getTotalNumberOfCompletedProcesses(  ) );
         totNumCompl.setLastUpdated( calendarInst );
         prop_totalnumberofcompletedprocesses.setTotalNumberOfCompletedProcesses( totNumCompl );
         resourceProperty.add( prop_totalnumberofcompletedprocesses );
         resourceProperty.setCallback( new TotalNumberOfCompletedProcessesCallback( m_instance ) );

         // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part1.xsd}ResourceId Resource Property
         resourceProperty = resourcePropertySet.get( BusinessprocesstypePropertyQNames.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( BusinessprocesstypePropertyQNames.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( BusinessprocesstypePropertyQNames.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 );

         // init the {http://ws.apache.org/muse/example/businessprocesstype/properties}TotalNumberOfTerminatedProcesses Resource Property
         resourceProperty =
            resourcePropertySet.get( BusinessprocesstypePropertyQNames.TOTALNUMBEROFTERMINATEDPROCESSES );
         org.apache.ws.muse.example.businessprocesstype.properties.TotalNumberOfTerminatedProcessesDocument prop_totalnumberofterminatedprocesses =
            org.apache.ws.muse.example.businessprocesstype.properties.TotalNumberOfTerminatedProcessesDocument.Factory
            .newInstance(  );
         org.apache.ws.namespaces.muse.muwsExt1.LongMetric                                                  totTermP =
            org.apache.ws.namespaces.muse.muwsExt1.LongMetric.Factory.newInstance(  );
         totTermP.setLongValue( m_instance.getTotalNumberOfTerminatedProcesses(  ) );
         totTermP.setLastUpdated( calendarInst );
         prop_totalnumberofterminatedprocesses.setTotalNumberOfTerminatedProcesses( totTermP );
         resourceProperty.add( prop_totalnumberofterminatedprocesses );
         resourceProperty.setCallback( new TotalNumberOfTerminatedProcessesCallback( m_instance ) );

         // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Version Resource Property
         resourceProperty = resourcePropertySet.get( BusinessprocesstypePropertyQNames.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( BusinessprocesstypePropertyQNames.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      lStringCap =
            LangString.Factory.newInstance(  );
         lStringCap.setStringValue( CAPTION + "-" + getID(  ).toString(  ) );
         lStringCap.setLang( "en" );
         prop_caption.setCaption( lStringCap );
         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( BusinessprocesstypePropertyQNames.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://ws.apache.org/muse/example/businessprocesstype/properties}TotalNumberOfAbortedProcesses Resource Property
         resourceProperty =
            resourcePropertySet.get( BusinessprocesstypePropertyQNames.TOTALNUMBEROFABORTEDPROCESSES );
         org.apache.ws.muse.example.businessprocesstype.properties.TotalNumberOfAbortedProcessesDocument prop_totalnumberofabortedprocesses =
            org.apache.ws.muse.example.businessprocesstype.properties.TotalNumberOfAbortedProcessesDocument.Factory
            .newInstance(  );
         org.apache.ws.namespaces.muse.muwsExt1.LongMetric                                               totNumAborPro =
            org.apache.ws.namespaces.muse.muwsExt1.LongMetric.Factory.newInstance(  );
         totNumAborPro.setLongValue( m_instance.getTotalNumberOfAbortedProcesses(  ) );
         totTermP.setLastUpdated( calendarInst );
         prop_totalnumberofabortedprocesses.setTotalNumberOfAbortedProcesses( totNumAborPro );
         resourceProperty.add( prop_totalnumberofabortedprocesses );
         resourceProperty.setCallback( new TotalNumberOfAbortedProcessesCallback( m_instance ) );

         // init the {http://ws.apache.org/muse/example/businessprocesstype/properties}NumberOfRunningProcesses Resource Property
         resourceProperty = resourcePropertySet.get( BusinessprocesstypePropertyQNames.NUMBEROFRUNNINGPROCESSES );
         org.apache.ws.muse.example.businessprocesstype.properties.NumberOfRunningProcessesDocument prop_numberofrunningprocesses =
            org.apache.ws.muse.example.businessprocesstype.properties.NumberOfRunningProcessesDocument.Factory
            .newInstance(  );
         org.apache.ws.namespaces.muse.muwsExt1.IntMetric                                           totRunningP =
            org.apache.ws.namespaces.muse.muwsExt1.IntMetric.Factory.newInstance(  );
         totRunningP.setIntValue( m_instance.getNumberOfRunningProcesses(  ) );
         totRunningP.setLastUpdated( calendarInst );
         prop_numberofrunningprocesses.setNumberOfRunningProcesses( totRunningP );
         resourceProperty.add( prop_numberofrunningprocesses );
         resourceProperty.setCallback( new NumberOfRunningProcessesCallback( m_instance ) );

         // init the {http://ws.apache.org/muse/example/businessprocesstype/properties}NumberOfSuspendedProcesses Resource Property
         resourceProperty =
            resourcePropertySet.get( BusinessprocesstypePropertyQNames.NUMBEROFSUSPENDEDPROCESSES );
         org.apache.ws.muse.example.businessprocesstype.properties.NumberOfSuspendedProcessesDocument prop_numberofsuspendedprocesses =
            org.apache.ws.muse.example.businessprocesstype.properties.NumberOfSuspendedProcessesDocument.Factory
            .newInstance(  );
         org.apache.ws.namespaces.muse.muwsExt1.IntMetric                                             numSuspP =
            org.apache.ws.namespaces.muse.muwsExt1.IntMetric.Factory.newInstance(  );
         numSuspP.setIntValue( m_instance.getNumberOfSuspendedProcesses(  ) );
         numSuspP.setLastUpdated( calendarInst );
         prop_numberofsuspendedprocesses.setNumberOfSuspendedProcesses( numSuspP );
         resourceProperty.add( prop_numberofsuspendedprocesses );
         resourceProperty.setCallback( new NumberOfSuspendedProcessesCallback( m_instance ) );

         // init the {http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.xsd}Description Resource Property
         resourceProperty = resourcePropertySet.get( BusinessprocesstypePropertyQNames.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( BusinessprocesstypePropertyQNames.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( BusinessprocesstypePropertyQNames.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(BusinessprocesstypePropertyQNames.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.BUSINESS_P_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(BusinessprocesstypePropertyQNames.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 )
      {
         e.printStackTrace(  );
         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( BusinessprocesstypePropertyQNames.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 processId DOCUMENT_ME
    */
   public void resume( String processId )
   {
      m_instance.resume( processId );
      return;
   }

   /**
    * DOCUMENT_ME
    *
    * @param processId DOCUMENT_ME
    */
   public void suspend( String processId )
   {
      m_instance.suspend( processId );
      return;
   }
  
   /**
    * DOCUMENT_ME
    *
    * @param processId DOCUMENT_ME
    */
   public void complete( String processId )
   {
      m_instance.complete( processId );
      return;
   }

   /**
    * DOCUMENT_ME
    *
    * @param processId DOCUMENT_ME
    */
   public void terminate( String processId )
   {
      m_instance.terminate( processId );
      return;
   }

   /**
    * 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;
   }
}
TOP

Related Classes of org.apache.ws.muse.example.businessprocesstype.BusinessprocesstypeResource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.