当前位置: 首页>>代码示例>>Java>>正文


Java InvalidSyntaxException类代码示例

本文整理汇总了Java中org.osgi.framework.InvalidSyntaxException的典型用法代码示例。如果您正苦于以下问题:Java InvalidSyntaxException类的具体用法?Java InvalidSyntaxException怎么用?Java InvalidSyntaxException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidSyntaxException类属于org.osgi.framework包,在下文中一共展示了InvalidSyntaxException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
protected void setUp() throws Exception {
	listener = new SimpleTargetSourceLifecycleListener();

	refs = new ServiceReference[] { new MockServiceReference() };

	bundleContext = new MockBundleContext() {

		public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
			return refs;
		}
	};

	interceptor = new ServiceDynamicInterceptor(bundleContext, null, null, getClass().getClassLoader());
	interceptor.setListeners(new OsgiServiceLifecycleListener[] { listener });
	interceptor.setMandatoryService(false);
	interceptor.setProxy(new Object());
	interceptor.setServiceImporter(new Object());
	interceptor.setSticky(false);

	interceptor.setRetryTimeout(1);

	SimpleTargetSourceLifecycleListener.BIND = 0;
	SimpleTargetSourceLifecycleListener.UNBIND = 0;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:25,代码来源:OsgiServiceDynamicInterceptorListenerTest.java

示例2: createFilter

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
private static Filter createFilter(BundleContext context, PersistenceUnit punit) {
    String filter;
    if (punit.getPersistenceProviderClassName() != null) {
        filter = String.format("(&(objectClass=%s)(%s=%s))",
                               PersistenceProvider.class.getName(),
                               JAVAX_PERSISTENCE_PROVIDER,
                               punit.getPersistenceProviderClassName());
    } else {
        filter = String.format("(objectClass=%s)", PersistenceProvider.class.getName());
    }

    try {
        return context.createFilter(filter);
    } catch (InvalidSyntaxException e) {
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:18,代码来源:PersistenceProviderTracker.java

示例3: testRegistersManagedEMF

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
@Test
public void testRegistersManagedEMF() throws InvalidSyntaxException, ConfigurationException {
	
	AriesEntityManagerFactoryBuilder emfb = new AriesEntityManagerFactoryBuilder(
			containerContext, provider, providerBundle, punit);
	
	verify(containerContext).registerService(eq(ManagedService.class),
			any(ManagedService.class), argThat(servicePropsMatcher(
					SERVICE_PID, "org.apache.aries.jpa.test-props")));
	
	// No EMF created as incomplete
	verifyZeroInteractions(msReg, provider);
	
	emfb.close();
	verify(msReg).unregister();
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:17,代码来源:PropsConfigurationTest.java

示例4: getServices

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
public static <E> List<E> getServices(BundleContext bundleContext, Class<E> serviceType, String filter)
        throws InvalidSyntaxException {
    List<E> services = null;
    final ServiceReference[] refs = bundleContext.getServiceReferences(serviceType.getName(), filter);
    if (refs != null) {
        services = new ArrayList<>(refs.length);
        if (refs != null && refs.length > 0) {
            for (ServiceReference ref : refs) {
                E service = (E) bundleContext.getService(ref);
                services.add(service);
            }
        }
    } else
        services = Collections.unmodifiableList(new ArrayList<E>());
    return services;
}
 
开发者ID:DantaFramework,项目名称:Core,代码行数:17,代码来源:OSGiUtils.java

示例5: testPUWithJtaDSGetsCreatedAutomatically

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
@Test
public void testPUWithJtaDSGetsCreatedAutomatically() throws InvalidSyntaxException, ConfigurationException {
	
	when(containerContext.getServiceReferences((String) null, 
			"(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name=testds))"))
		.thenReturn(new ServiceReference<?>[] {dsRef});
	
	when(punit.getJtaDataSourceName()).thenReturn(
			"osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=testds)");
	
	when(provider.createContainerEntityManagerFactory(eq(punit), 
			any(Map.class))).thenReturn(emf);
	
	AriesEntityManagerFactoryBuilder emfb = new AriesEntityManagerFactoryBuilder(
			containerContext, provider, providerBundle, punit);
	
	verify(punit).setJtaDataSource(ds);
	verify(punitContext).registerService(eq(EntityManagerFactory.class),
			any(EntityManagerFactory.class), argThat(servicePropsMatcher(JPA_UNIT_NAME, "test-props")));
	
	emfb.close();
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:23,代码来源:PropsConfigurationTest.java

示例6: testPUWithNonJtaDSGetsCreatedAutomatically

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
@Test
public void testPUWithNonJtaDSGetsCreatedAutomatically() throws InvalidSyntaxException, ConfigurationException {
	
	when(containerContext.getServiceReferences((String) null, 
			"(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name=testds))"))
	.thenReturn(new ServiceReference<?>[] {dsRef});
	
	when(punit.getTransactionType()).thenReturn(RESOURCE_LOCAL);

	when(punit.getNonJtaDataSourceName()).thenReturn(
			"osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=testds)");
	
	when(provider.createContainerEntityManagerFactory(eq(punit), 
			any(Map.class))).thenReturn(emf);
	
	AriesEntityManagerFactoryBuilder emfb = new AriesEntityManagerFactoryBuilder(
			containerContext, provider, providerBundle, punit);
	
	verify(punit).setNonJtaDataSource(ds);
	verify(punitContext).registerService(eq(EntityManagerFactory.class),
			any(EntityManagerFactory.class), argThat(servicePropsMatcher(JPA_UNIT_NAME, "test-props")));
	
	emfb.close();
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:25,代码来源:PropsConfigurationTest.java

示例7: setDataSource

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
protected void setDataSource ( final String dataSourceId ) throws InvalidSyntaxException
{
    logger.debug ( "Set datasource request: {}", dataSourceId );

    try
    {
        this.trackerLock.lock ();

        if ( this.tracker != null )
        {
            this.tracker.close ();
            this.tracker = null;
        }

        if ( dataSourceId != null )
        {
            this.tracker = new SingleDataSourceTracker ( this.poolTracker, dataSourceId, this.serviceListener );
            this.tracker.open ();
        }
    }
    finally
    {
        this.trackerLock.unlock ();
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:AbstractDataSourceHandler.java

示例8: setUp

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
protected void setUp() throws Exception {

		BundleContext bundleContext = new MockBundleContext() {
			// service reference already registered
			public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
				return new ServiceReference[0];
			}
		};

		appContext = new GenericApplicationContext();
		appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
		appContext.setClassLoader(getClass().getClassLoader());

		XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
		// reader.setEventListener(this.listener);
		reader.loadBeanDefinitions(new ClassPathResource("osgiReferenceNestedBeans.xml", getClass()));
		appContext.refresh();
	}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:19,代码来源:NestedReferencesTest.java

示例9: init

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
public void init () throws InvalidSyntaxException
{
    final String filter = String.format ( "(%s=%s)", JaxWsExporter.EXPORT_ENABLED, true );
    synchronized ( this )
    {
        this.context.addServiceListener ( this, filter );
        final ServiceReference<?>[] refs = this.context.getServiceReferences ( (String)null, filter );
        if ( refs != null )
        {
            for ( final ServiceReference<?> ref : refs )
            {
                addService ( ref );
            }
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:AbstractExporter.java

示例10: createFilter

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
protected static Filter createFilter ( final String operand, final Filter... filters ) throws InvalidSyntaxException
{
    final StringBuilder sb = new StringBuilder ();

    sb.append ( "(" );
    sb.append ( operand );

    for ( final Filter filter : filters )
    {
        sb.append ( filter.toString () );
    }

    sb.append ( ")" );

    return FrameworkUtil.createFilter ( sb.toString () );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:FilterUtil.java

示例11: SingleDataSourceTracker

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
/**
 * Create a new single datasource tracker
 * 
 * @param poolTracker
 *            the pool tracker to use
 * @param dataSourceId
 *            the id of the datasource to track
 * @param listener
 *            the listener that gets notified (must not be <code>null</code>)
 * @throws InvalidSyntaxException
 */
public SingleDataSourceTracker ( final ObjectPoolTracker<DataSource> poolTracker, final String dataSourceId, final ServiceListener listener ) throws InvalidSyntaxException
{
    this.listener = listener;
    if ( listener == null )
    {
        throw new NullPointerException ( "'listener' must not be null" );
    }

    this.tracker = new SingleObjectPoolServiceTracker<DataSource> ( poolTracker, dataSourceId, new SingleObjectPoolServiceTracker.ServiceListener<DataSource> () {
        @Override
        public void serviceChange ( final DataSource service, final Dictionary<?, ?> properties )
        {
            SingleDataSourceTracker.this.setDataSource ( service );
        }
    } );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:SingleDataSourceTracker.java

示例12: setUp

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
protected void setUp() throws Exception {
	services = new LinkedHashMap();

	BundleContext ctx = new MockBundleContext() {

		public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
			return new ServiceReference[0];
		}

		public Object getService(ServiceReference reference) {
			Object service = services.get(reference);
			return (service == null ? new Object() : service);
		}

	};

	ClassLoader cl = getClass().getClassLoader();
	proxyCreator =
			new StaticServiceProxyCreator(new Class<?>[] { Cloneable.class }, cl, cl, ctx,
					ImportContextClassLoaderEnum.UNMANAGED, false, false);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:22,代码来源:OsgiServiceCollectionProxiesTest.java

示例13: setSources

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
private void setSources ( final String str ) throws InvalidSyntaxException
{
    if ( this.tracker != null )
    {
        this.tracker.close ();
        this.tracker = null;
    }

    this.sourceIds = convertSources ( str );
    this.sources = new HashMap<DataSource, ProxyDataSource.SourceHandler> ( this.sourceIds.size () );

    if ( this.sourceIds.isEmpty () )
    {
        // nothing to do if we don't have any source
        return;
    }

    this.tracker = new MultiDataSourceTracker ( this.poolTracker, this.sourceIds, this );
    this.tracker.open ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:ProxyDataSource.java

示例14: getServiceReferences

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
	// Some jiggery-pokery to get round the fact that we don't ever use the clazz
	if (clazz == null) {
		if (filter != null) {
			// flatten filter since the constants might be case insensitive
			String flattenFilter = filter.toLowerCase();
			int i = flattenFilter.indexOf(Constants.OBJECTCLASS.toLowerCase() + "=");
			if (i > 0) {
				clazz = filter.substring(i + Constants.OBJECTCLASS.length() + 1);
				clazz = clazz.substring(0, clazz.indexOf(")"));
			}
		} else {
			clazz = Object.class.getName();
           }
       }
	return new ServiceReference[] { new MockServiceReference(getBundle(), new String[] { clazz }) };
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:18,代码来源:MockBundleContext.java

示例15: setUp

import org.osgi.framework.InvalidSyntaxException; //导入依赖的package包/类
protected void setUp() throws Exception {
	services = new LinkedHashMap();

	context = new MockBundleContext() {

		public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
			return new ServiceReference[0];
		}

		public Object getService(ServiceReference reference) {
			Object service = services.get(reference);
			return (service == null ? new Object() : service);
		}
	};

	col = createCollection();
	col.setRequiredAtStartup(false);
	col.afterPropertiesSet();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:20,代码来源:AbstractOsgiCollectionTest.java


注:本文中的org.osgi.framework.InvalidSyntaxException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。