Package org.qi4j.api.service

Examples of org.qi4j.api.service.ServiceDescriptor


            @Override
            public boolean visitEnter( Object visited ) throws RuntimeException
            {
                if (visited instanceof ServiceDescriptor)
                {
                    ServiceDescriptor serviceDescriptor = (ServiceDescriptor) visited;
                    Assert.assertTrue( serviceDescriptor.isInstantiateOnStartup() );
                    Assert.assertTrue( serviceDescriptor.visibility() == Visibility.layer );
                    return false;
                } else if (visited instanceof EntityDescriptor)
                {
                    EntityDescriptor entityDescriptor = (EntityDescriptor) visited;
                    Assert.assertTrue( entityDescriptor.visibility() == Visibility.application );
View Full Code Here


        }

    public <T> T getConfigurationInstance( ServiceComposite serviceComposite, UnitOfWork uow )
        throws InstantiationException
    {
        ServiceDescriptor serviceModel = api.getServiceDescriptor( serviceComposite );

        String identity = serviceComposite.identity().get();
        T configuration;
        try
        {
            configuration = uow.get( serviceModel.<T>configurationType(), identity );
            uow.pause();
        }
        catch( NoSuchEntityException e )
        {
            return (T) initializeConfigurationInstance( serviceComposite, uow, serviceModel, identity );
View Full Code Here

            public boolean visitEnter( Object visited )
                throws RuntimeException
            {
                if( visited instanceof ServiceDescriptor )
                {
                    ServiceDescriptor serviceDescriptor = (ServiceDescriptor) visited;
                    Assert.assertTrue( serviceDescriptor.isInstantiateOnStartup() );
                    Assert.assertTrue( serviceDescriptor.visibility() == Visibility.layer );
                    return false;
                }
                else if( visited instanceof EntityDescriptor )
                {
                    EntityDescriptor entityDescriptor = (EntityDescriptor) visited;
View Full Code Here

        @SuppressWarnings( "unchecked" )
        public <T> T findConfigurationInstanceFor( ServiceComposite serviceComposite, UnitOfWork uow )
            throws InstantiationException
        {
            ServiceDescriptor serviceModel = api.serviceDescriptorFor( serviceComposite );

            String identity = serviceComposite.identity().get();
            T configuration;
            try
            {
                configuration = uow.get( serviceModel.<T>configurationType(), identity );
                uow.pause();
            }
            catch( NoSuchEntityException | EntityTypeNotFoundException e )
            {
                return (T) initializeConfigurationInstance( serviceComposite, uow, serviceModel, identity );
View Full Code Here

        setFont( normalFont, normalFontSize );

        if( objectDesciptor instanceof ServiceDetailDescriptor )
        {
            ServiceDescriptor descriptor = ( (ServiceDetailDescriptor) objectDesciptor ).descriptor();
            writeString( "- identity: " + descriptor.identity() );
            writeString( "- class: " + descriptor.toString() );
            writeString( "- visibility: " + descriptor.visibility().toString() );
            writeString( "- startup: " + ( (ServiceDetailDescriptor) objectDesciptor ).descriptor()
                .isInstantiateOnStartup() );
        }
        else if( objectDesciptor instanceof EntityDetailDescriptor )
        {
            EntityDescriptor descriptor = ( (EntityDetailDescriptor) objectDesciptor ).descriptor();
            writeString( "- name: " + descriptor.toString() );
            writeString( "- class: " + descriptor.toString() );
            writeString( "- visibility: " + descriptor.visibility().toString() );
        }
        else if( objectDesciptor instanceof ValueDetailDescriptor )
        {
            ValueDescriptor descriptor = ( (ValueDetailDescriptor) objectDesciptor ).descriptor();
            writeString( "- name: " + descriptor.toString() );
            writeString( "- class: " + descriptor.toString() );
            writeString( "- visibility: " + descriptor.visibility().toString() );
        }
        else if( objectDesciptor instanceof ObjectDetailDescriptor )
        {
            ObjectDescriptor descriptor = ( (ObjectDetailDescriptor) objectDesciptor ).descriptor();
            writeString( "- name: " + descriptor.toString() );
            writeString( "- class: " + descriptor.toString() );
            writeString( "- visibility: " + descriptor.visibility().toString() );
        }
        else if( objectDesciptor instanceof CompositeDetailDescriptor )
        {
            CompositeDescriptor descriptor = ( (CompositeDetailDescriptor) objectDesciptor ).descriptor();
            writeString( "- name: " + descriptor.toString() );
            writeString( "- class: " + descriptor.toString() );
            writeString( "- visibility: " + descriptor.visibility().toString() );
        }
    }
View Full Code Here

        private void reload( Object objectDesciptor )
        {
            if( objectDesciptor instanceof ServiceDetailDescriptor )
            {
                ServiceDescriptor descriptor = ( (ServiceDetailDescriptor) objectDesciptor ).descriptor();
                Class<?> type = first( descriptor.types() );
                rows.add( new TableRow( 2, nameRow, type.getSimpleName() ) );
                rows.add( new TableRow( 2, classRow, type.getName() ) );
                rows.add( new TableRow( 2, visibilityRow, descriptor.visibility().toString() ) );
                rows.add( new TableRow( 2, moduleRow, ( (ServiceDetailDescriptor) objectDesciptor ).module() ) );
                rows.add( new TableRow( 2, layerRow, ( (ServiceDetailDescriptor) objectDesciptor ).module().layer() ) );
                rows.add( new TableRow( 2, "startup", ( (ServiceDetailDescriptor) objectDesciptor ).descriptor().isInstantiateOnStartup() ) );
            }
            else if( objectDesciptor instanceof ImportedServiceDetailDescriptor )
            {
                ImportedServiceCompositeDescriptor descriptor = ( (ImportedServiceDetailDescriptor) objectDesciptor ).descriptor();
                rows.add( new TableRow( 2, nameRow, descriptor.primaryType().getSimpleName() ) );
                rows.add( new TableRow( 2, classRow, descriptor.primaryType().getName() ) );
                rows.add( new TableRow( 2, visibilityRow, descriptor.visibility().toString() ) );
                rows.add( new TableRow( 2, moduleRow, ( (ImportedServiceDetailDescriptor) objectDesciptor ).module() ) );
                rows.add( new TableRow( 2, layerRow, ( (ImportedServiceDetailDescriptor) objectDesciptor ).module().layer() ) );
            }
            else if( objectDesciptor instanceof EntityDetailDescriptor )
            {
                EntityDescriptor descriptor = ( (EntityDetailDescriptor) objectDesciptor ).descriptor();
                Class<?> type = first( descriptor.types() );
                rows.add( new TableRow( 2, nameRow, type.getSimpleName() ) );
                rows.add( new TableRow( 2, classRow, type.getName() ) );
                rows.add( new TableRow( 2, visibilityRow, descriptor.visibility().toString() ) );
                rows.add( new TableRow( 2, moduleRow, ( (EntityDetailDescriptor) objectDesciptor ).module() ) );
                rows.add( new TableRow( 2, layerRow, ( (EntityDetailDescriptor) objectDesciptor ).module().layer() ) );
            }
            else if( objectDesciptor instanceof ValueDetailDescriptor )
            {
                ValueDescriptor descriptor = ( (ValueDetailDescriptor) objectDesciptor ).descriptor();
                Class<?> type = first( descriptor.types() );
                rows.add( new TableRow( 2, new Object[]
                {
                    nameRow, type.getSimpleName()
                } ) );
                rows.add( new TableRow( 2, new Object[]
                {
                    classRow, type.getName()
                } ) );
                rows.add( new TableRow( 2, new Object[]
                {
                    visibilityRow, descriptor.visibility().toString()
                } ) );
                rows.add( new TableRow( 2, new Object[]
                {
                    moduleRow, ( (ValueDetailDescriptor) objectDesciptor ).module()
                } ) );
                rows.add( new TableRow( 2, new Object[]
                {
                    layerRow, ( (ValueDetailDescriptor) objectDesciptor ).module().layer()
                } ) );
            }
            else if( objectDesciptor instanceof ObjectDetailDescriptor )
            {
                ObjectDescriptor descriptor = ( (ObjectDetailDescriptor) objectDesciptor ).descriptor();
                Class<?> type = first( descriptor.types() );
                rows.add( new TableRow( 2, nameRow, type.getSimpleName() ) );
                rows.add( new TableRow( 2, classRow, type.getName() ) );
                rows.add( new TableRow( 2, visibilityRow, descriptor.visibility().toString() ) );
                rows.add( new TableRow( 2, moduleRow, ( (ObjectDetailDescriptor) objectDesciptor ).module() ) );
                rows.add( new TableRow( 2, layerRow, ( (ObjectDetailDescriptor) objectDesciptor ).module().layer() ) );
            }
            else if( objectDesciptor instanceof CompositeDetailDescriptor )
            {
                CompositeDescriptor descriptor = ( (CompositeDetailDescriptor) objectDesciptor ).descriptor();
                Class<?> type = first( descriptor.types() );
                rows.add( new TableRow( 2, nameRow, type.getSimpleName() ) );
                rows.add( new TableRow( 2, classRow, type.getName() ) );
                rows.add( new TableRow( 2, visibilityRow, descriptor.visibility().toString() ) );
                rows.add( new TableRow( 2, moduleRow, ( (CompositeDetailDescriptor) objectDesciptor ).module() ) );
                rows.add( new TableRow( 2, layerRow, ( (CompositeDetailDescriptor) objectDesciptor ).module().layer() ) );
            }

            fireTableDataChanged();
View Full Code Here

                    continue;
                }

                String serviceClass = first(compositeInstance.types()).getName();
                String name = configurableService.identity();
                ServiceDescriptor serviceDescriptor = spi.serviceDescriptorFor( configurableService );
                Module module = spi.moduleOf( configurableService );
                Class<Object> configurationClass = serviceDescriptor.configurationType();
                if( configurationClass != null )
                {
                    EntityDescriptor descriptor = module.entityDescriptor( configurationClass.getName() );
                    List<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>();
                    Map<String, AccessibleObject> properties = new HashMap<String, AccessibleObject>();
View Full Code Here

            tempModuleName = ( (ModuleDescriptor) visited ).name();
            return true;
        }
        else if( visited instanceof ServiceDescriptor )
        {
            ServiceDescriptor aDescriptor = (ServiceDescriptor) visited;
            String identity = aDescriptor.identity();
            if( serviceId.equals( identity ) )
            {
                layerName = tempLayerName;
                moduleName = tempModuleName;
                serviceType = first( aDescriptor.types() );
            }
        }
        else if( visited instanceof ObjectDescriptor )
        {
            return false;
View Full Code Here

                        server.registerMBean( mbean, objectName );
                        mbeans.add( objectName );
                    }
                    else if( visited instanceof ServiceDescriptor )
                    {
                        ServiceDescriptor serviceDescriptor = (ServiceDescriptor) visited;
                        ObjectName objectName = new ObjectName( names.peek()
                                                                    .toString() + ",class=Service,service=" + serviceDescriptor
                            .identity() );
                        RequiredModelMBean mbean = new ModelMBeanBuilder( objectName, serviceDescriptor.identity(), ServiceBean.class
                            .getName() ).
                            attribute( "Id", "Service id", String.class.getName(), "Id of service", "getId", null ).
                            attribute( "Visibility", "Service visibility", String.class.getName(), "Visibility of service", "getVisibility", null )
                            .
                                attribute( "Type", "Service type", String.class.getName(), "Type of service", "getType", null )
View Full Code Here

TOP

Related Classes of org.qi4j.api.service.ServiceDescriptor

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.