Package org.apache.ws.resource.properties

Examples of org.apache.ws.resource.properties.ResourceProperty


    * Test for XmlBeansResourceProperty#set.
    */
   public void testSet()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      final String stringValue = "somethang";
      prop.set( 0,
            XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      XmlString xString = (XmlString) prop.get( 0 );
      assertEquals( stringValue,
            xString.getStringValue() );
   }
View Full Code Here


    * Test for XmlBeansResourceProperty#size.
    */
   public void testSize()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      assertEquals( 1,
            prop.size() );
      final String stringValue = "somethang";
      prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      assertEquals( 3,
            prop.size() );
      prop.remove( prop.get( 0 ) );
      prop.remove( prop.get( 0 ) );
      assertEquals( 1,
            prop.size() );
   }
View Full Code Here

   throws ResourceContextException,
          ResourceException
   {
      JobPropertiesDocument jobPropDoc           = getJobPropDoc( instance );
      PrinterPortResource   printerResource      = (PrinterPortResource) getResourceContext(  ).getResource(  );
      ResourceProperty      printerJobProperties =
         printerResource.getResourcePropertySet(  ).get( PrinterPortPropertyQNames.JOB_PROPERTIES );
      printerJobProperties.add( jobPropDoc );
   }
View Full Code Here

   private void incrementQueueCount(  )
   throws ResourceException,
          ResourceContextException
   {
      PrinterPortResource printerResource      = (PrinterPortResource) getResourceContext(  ).getResource(  );
      ResourceProperty    printerJobProperties =
         printerResource.getResourcePropertySet(  ).get( PrinterPortPropertyQNames.QUEUED_JOB_COUNT );
      XmlInteger          queued               = (XmlInteger) printerJobProperties.get( 0 );
      BigInteger          bigIntegerValue      = queued.getBigIntegerValue(  );
      int                 count                = bigIntegerValue.intValue(  );
      count++;
      queued.setBigIntegerValue( BigInteger.valueOf( count ) );
   }
View Full Code Here

      JobPropertiesDocument jobPropDoc           = (JobPropertiesDocument) ((XmlBeansResourcePropertySet)getResourcePropertySet()).toXmlObject();
       org.oasisOpen.docs.wsrf.x2005.x01.wsrfInterop20Draft03.JobPropertiesDocument.JobProperties jobProperties = jobPropDoc.getJobProperties();
       java.math.BigInteger jobId = jobProperties.getJobId();

       PrinterPortResource   printerResource      = getPrinterResource();
      ResourceProperty      printerJobProperties =
         printerResource.getResourcePropertySet(  ).get( PrinterPortPropertyQNames.JOB_PROPERTIES );

       Iterator iterator = printerJobProperties.iterator();
       JobPropertiesDocument.JobProperties properties = null;
       while (iterator.hasNext())
       {
           properties = (JobPropertiesDocument.JobProperties) iterator.next();
           if(properties.getJobId().equals(jobId))
           {
               break;
           }
       }

       if(properties != null)
       {
            printerJobProperties.remove(properties);
       }

      return;
   }
View Full Code Here

    */
   public void init(  )
   {
      super.init(  );

      ResourceProperty resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_NAME );
      JobNameDocument  jobNameDocument = JobNameDocument.Factory.newInstance(  );
      jobNameDocument.setJobName( m_jobName );
      resourceProperty.add( jobNameDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_ID );
      JobIdDocument jobIdDocument = JobIdDocument.Factory.newInstance(  );
      jobIdDocument.setJobId( BigInteger.valueOf( m_jobId ) );
      resourceProperty.add( jobIdDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_ORIGINATING_USER_NAME );
      JobOriginatingUserNameDocument jobOriginatingUserNameDocument =
         JobOriginatingUserNameDocument.Factory.newInstance(  );
      jobOriginatingUserNameDocument.setJobOriginatingUserName( m_origUserName );
      resourceProperty.add( jobOriginatingUserNameDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_PRINTER_REFERENCE );
      JobPrinterReferenceDocument jobPrinterReferenceDocument =
         JobPrinterReferenceDocument.Factory.newInstance(  );
      jobPrinterReferenceDocument.setJobPrinterReference( m_printerRef );
      resourceProperty.add( jobPrinterReferenceDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_REFERENCE );
      JobReferenceDocument jobReferenceDocument = JobReferenceDocument.Factory.newInstance(  );
      jobReferenceDocument.setJobReference( getEpr(  ) );
      resourceProperty.add( jobReferenceDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_STATE );
      JobStateDocument jobStateDocument = JobStateDocument.Factory.newInstance(  );
      jobStateDocument.setJobState( JobStateType.PENDING );
      resourceProperty.add( jobStateDocument );

      Calendar currentTime = getCurrentTime();
      Calendar termTime = Calendar.getInstance(  );
      termTime.set( currentTime.get( Calendar.YEAR ),
                    currentTime.get( Calendar.MONTH ),
View Full Code Here

     * Initializes this resource's state (properties, etc.).
     */
    public void init()
    {
        super.init();
        ResourceProperty resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_REFERENCE);
        PrinterReferenceDocument printerRefDoc = PrinterReferenceDocument.Factory.newInstance();
        printerRefDoc.setPrinterReference(getEpr());
        resourceProperty.add(printerRefDoc);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_STATE);
        PrinterStateDocument printerState = PrinterStateDocument.Factory.newInstance();
        printerState.setPrinterState(PrinterStateType.IDLE);
        resourceProperty.add(printerState);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_NAME);
        PrinterNameDocument printName = PrinterNameDocument.Factory.newInstance();
        printName.setPrinterName(m_name);
        resourceProperty.add(printName);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_IS_ACCEPTING_JOBS);
        PrinterIsAcceptingJobsDocument isAccepting = PrinterIsAcceptingJobsDocument.Factory.newInstance();
        isAccepting.setPrinterIsAcceptingJobs(false);
        resourceProperty.add(isAccepting);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.QUEUED_JOB_COUNT);
        QueuedJobCountDocument queuedJobCountDocument = QueuedJobCountDocument.Factory.newInstance();
        queuedJobCountDocument.setQueuedJobCount(BigInteger.valueOf(0));
        resourceProperty.add(queuedJobCountDocument);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.OPERATIONS_SUPPORTED);
        OperationsSupportedDocument operationsSupportedDocument =
                OperationsSupportedDocument.Factory.newInstance();
        List operationsSupported = new ArrayList();
        operationsSupported.add(Operations.PRINT_JOB); //refer to doc...
        operationsSupported.add(Operations.CREATE_JOB); //refer to doc...
        operationsSupported.add(Operations.SEND_DOCUMENT); //refer to doc...
        operationsSupportedDocument.setOperationsSupported(operationsSupported);
        resourceProperty.add(operationsSupportedDocument);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED);
        DocumentFormatSupportedDocument documentFormatSupportedDocument =
                DocumentFormatSupportedDocument.Factory.newInstance();
        MimeMediaTypes mimeMediaTypes =
                documentFormatSupportedDocument.addNewDocumentFormatSupported();
        mimeMediaTypes.addMimeMediaType(MimeMediaTypeType.TEXT_PLAIN);
        resourceProperty.add(documentFormatSupportedDocument);
    }
View Full Code Here

                    setJobState(job, JobStateType.PROCESSING);
                    //set termination time to now to make it be removed.
                    job.setTerminationTime(Calendar.getInstance());

                    XmlBeansResourcePropertySet jobPropSet = (XmlBeansResourcePropertySet) job.getResourcePropertySet();
                    ResourceProperty resourceProperty = jobPropSet.get(JobPortPropertyQNames.JOB_ID);
                    XmlInteger jobint = (XmlInteger) resourceProperty.get(0);
                    BigInteger bigIntegerValue = jobint.getBigIntegerValue();                   

                    decrementQueueCount();
                    setJobState(job, JobStateType.COMPLETED);
                }
View Full Code Here

    {
        LOG.debug( MSG.getMessage( Keys.CLEAR_PROP_SET ) );
        Collection props = m_propsMap.values();
        for ( Iterator iterator = props.iterator(); iterator.hasNext(); )
        {
            ResourceProperty prop = (ResourceProperty) iterator.next();
            prop.clear();
            m_propsMap.remove( prop.getMetaData().getName() );
        }
    }
View Full Code Here

        if ( !m_metaData.isOpenContent() )
        {
            throw new MetaDataViolationException( MSG.getMessage( Keys.NON_ANY_PROP_CANNOT_BE_REMOVED ) );
        }
        LOG.debug( MSG.getMessage( Keys.REMOVING_PROP, propName.toString() ) );
        ResourceProperty resourceProp = (ResourceProperty) m_propsMap.get( propName );
        resourceProp.clear();
        m_propsMap.remove( propName );
        return true;
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.resource.properties.ResourceProperty

Copyright © 2018 www.massapicom. 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.