Package org.osgi.service.component.runtime

Examples of org.osgi.service.component.runtime.ServiceComponentRuntime


    protected void doStart() throws Exception {

        // prepare component registry
        m_componentBundles = new HashMap<Long, BundleComponentActivator>();
        m_componentRegistry = new ComponentRegistry( m_context );
        ServiceComponentRuntime runtime = new ServiceComponentRuntimeImpl(m_context, m_componentRegistry);
        m_runtime_reg = m_context.registerService(ServiceComponentRuntime.class, runtime, null);

        // log SCR startup
        log( LogService.LOG_INFO, m_bundle, " Version = {0}",
            new Object[] {m_bundle.getHeaders().get( Constants.BUNDLE_VERSION )}, null );
View Full Code Here


    }


    protected Collection<ComponentDescriptionDTO> getComponentDescriptions()
    {
        ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr == null )
        {
          TestCase.fail("no ServiceComponentRuntime");
        }
            return scr.getComponentDescriptionDTOs();
    }
View Full Code Here

    }


    protected ComponentDescriptionDTO findComponentDescriptorByName( String name )
    {
        ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr == null )
        {
          TestCase.fail("no ServiceComponentRuntime");
        }
            return scr.getComponentDescriptionDTO(bundle, name);
    }
View Full Code Here

    }


    protected Collection<ComponentConfigurationDTO> findComponentConfigurationsByName( Bundle b, String name, int expected )
    {
        ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr == null )
        {
          TestCase.fail("no ServiceComponentRuntime");
        }
        ComponentDescriptionDTO cd = scr.getComponentDescriptionDTO(b, name);
        Collection<ComponentConfigurationDTO> ccs = scr.getComponentConfigurationDTOs(cd);
        if (expected != -1)
        {
          for (ComponentConfigurationDTO cc: ccs)
          {
            Assert.assertEquals( "for ComponentConfiguration name: " + cc.description.name + " properties" + cc.properties + "Expected state " + STATES.get(expected) + " but was " + STATES.get(cc.state), expected, cc.state);             
View Full Code Here

      return getDisabledConfigurationAndEnable( bundle, name, initialState );
    }

    protected Collection<ComponentConfigurationDTO> getConfigurationsDisabledThenEnable( Bundle b, String name, int count, int initialState) throws InvocationTargetException, InterruptedException
    {
    ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr == null )
        {
          TestCase.fail("no ServiceComponentRuntime");
        }
      ComponentDescriptionDTO cd = scr.getComponentDescriptionDTO(b, name);
      Assert.assertFalse("Expected component disabled", scr.isComponentEnabled(cd));
      scr.enableComponent(cd).getValue();
      Assert.assertTrue("Expected component enabled", scr.isComponentEnabled(cd));
     
      Collection<ComponentConfigurationDTO> ccs = scr.getComponentConfigurationDTOs(cd);
      Assert.assertEquals(count, ccs.size());
      for (ComponentConfigurationDTO cc: ccs) {
      Assert.assertEquals("Expected state " + STATES.get(initialState)
          + " but was " + STATES.get(cc.state), initialState,
          cc.state);
View Full Code Here

      return getConfigurationsDisabledThenEnable(bundle, name, count, initialState);
    }
   
    protected ComponentDescriptionDTO checkConfigurationCount( Bundle b, String name, int count, int expectedState )
    {   
      ServiceComponentRuntime scr = scrTracker.getService();
      if ( scr == null )
      {
        TestCase.fail("no ServiceComponentRuntime");
      }
      ComponentDescriptionDTO cd = scr.getComponentDescriptionDTO(b, name);
      Assert.assertTrue("Expected component enabled", scr.isComponentEnabled(cd));

      Collection<ComponentConfigurationDTO> ccs = scr.getComponentConfigurationDTOs(cd);
      Assert.assertEquals(count, ccs.size());
      if (expectedState != -1)
      {
        for (ComponentConfigurationDTO cc: ccs)
        {
View Full Code Here

        }
    }
   
    protected void enableAndCheck( ComponentDescriptionDTO cd ) throws InvocationTargetException, InterruptedException
    {
        ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr != null )
        {
            scr.enableComponent(cd).getValue();
          Assert.assertTrue("Expected component enabled", scr.isComponentEnabled(cd));
        }
        else
        {
          throw new NullPointerException("no ServiceComponentRuntime");
        }
View Full Code Here

      ComponentDescriptionDTO cd = cc.description;
        disableAndCheck(cd);
    }

  protected void disableAndCheck(ComponentDescriptionDTO cd) throws InvocationTargetException, InterruptedException {
    ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr != null )
        {
          scr.disableComponent(cd).getValue();
          Assert.assertFalse("Expected component disabled", scr.isComponentEnabled(cd));
        }
        else
        {
          throw new NullPointerException("no ServiceComponentRuntime");
        }
View Full Code Here

       
    }

    void info( PrintWriter out )
    {
        ServiceComponentRuntime scr = scrTracker.getService();
        if ( scr == null )
        {
            TestCase.fail("no ServiceComponentRuntime");
        }
        new InfoWriter(scr).list(null, out);
View Full Code Here

TOP

Related Classes of org.osgi.service.component.runtime.ServiceComponentRuntime

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.