Java Code Examples for org.osgi.framework.InvalidSyntaxException

The following examples show how to use org.osgi.framework.InvalidSyntaxException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gvnix   Source File: JQueryOperationsImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public WebMetadataService getWebMetadataService() {
    if (webMetadataService == null) {
        // Get all Services implement WebMetadataService interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            WebMetadataService.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (WebMetadataService) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load WebMetadataService on JQueryOperationsImpl.");
            return null;
        }
    }
    else {
        return webMetadataService;
    }
}
 
Example 2
public MetadataDependencyRegistry getMetadataDependencyRegistry() {
    if (metadataDependencyRegistry == null) {
        // Get all Services implement MetadataDependencyRegistry interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            MetadataDependencyRegistry.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (MetadataDependencyRegistry) this.context
                        .getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load MetadataDependencyRegistry on DatatablesJspMetadataListener.");
            return null;
        }
    }
    else {
        return metadataDependencyRegistry;
    }
}
 
Example 3
public TypeManagementService getTypeManagementService() {
    if (typeManagementService == null) {
        // Get all Services implement TypeManagementService interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            TypeManagementService.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (TypeManagementService) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load TypeManagementService on MonitoringOperationsImpl.");
            return null;
        }
    }
    else {
        return typeManagementService;
    }

}
 
Example 4
Source Project: gvnix   Source File: WebProjectUtilsImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public OperationUtils getOperationUtils() {
    if (operationUtils == null) {
        // Get all Services implement OperationUtils interface
        try {
            ServiceReference<?>[] references = context
                    .getAllServiceReferences(
                            OperationUtils.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                operationUtils = (OperationUtils) context.getService(ref);
                return operationUtils;
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load OperationUtils on WebProjectUtilsImpl.");
            return null;
        }
    }
    else {
        return operationUtils;
    }

}
 
Example 5
Source Project: gvnix   Source File: ReportMetadataProvider.java    License: GNU General Public License v3.0 6 votes vote down vote up
public ProjectOperations getProjectOperations() {
    if (projectOperations == null) {
        // Get all Services implement ProjectOperations interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            ProjectOperations.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (ProjectOperations) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            logger.warning("Cannot load ProjectOperations on ReportMetadataProvider.");
            return null;
        }
    }
    else {
        return projectOperations;
    }

}
 
Example 6
Source Project: gvnix   Source File: MessageBundleUtilsImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public WebProjectUtils getWebProjectUtils() {
    if (webProjectUtils == null) {
        // Get all Services implement WebProjectUtils interface
        try {
            ServiceReference<?>[] references = context
                    .getAllServiceReferences(
                            WebProjectUtils.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                webProjectUtils = (WebProjectUtils) context.getService(ref);
                return webProjectUtils;
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load WebProjectUtils on MessageBundleUtilsImpl.");
            return null;
        }
    }
    else {
        return webProjectUtils;
    }

}
 
Example 7
public MetadataService getMetadataService() {
    if (metadataService == null) {
        // Get all Services implement MetadataService interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            MetadataService.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (MetadataService) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load MetadataService on BootstrapOperationsImpl.");
            return null;
        }
    }
    else {
        return metadataService;
    }
}
 
Example 8
public ProjectOperations getProjectOperations() {
    if (projectOperations == null) {
        // Get all Services implement ProjectOperations interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            ProjectOperations.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (ProjectOperations) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load ProjectOperations on MonitoringOperationsImpl.");
            return null;
        }
    }
    else {
        return projectOperations;
    }

}
 
Example 9
private Filter toFilter(List<String> procs, List<String> oses, List<VersionRange> vers, List<String> langs, String sf)
  throws InvalidSyntaxException
{
  final StringBuffer sb = new StringBuffer(80);
  int elems = 0;
  
  elems = andAdd(sb, orString(NativeNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE, procs));
  elems += andAdd(sb, orString(NativeNamespace.CAPABILITY_OSNAME_ATTRIBUTE, oses));
  elems += andAdd(sb, orString(NativeNamespace.CAPABILITY_OSVERSION_ATTRIBUTE, vers));
  elems += andAdd(sb, orString(NativeNamespace.CAPABILITY_LANGUAGE_ATTRIBUTE, langs));
  elems += andAdd(sb, sf);
  if (elems == 0) {
    return null;
  } else if (elems > 1) {
    sb.insert(0,"(&");
    sb.append(")");
  }
  return FrameworkUtil.createFilter(sb.toString());
}
 
Example 10
public PathResolver getPathResolver() {
    if (pathResolver == null) {
        // Get all Services implement PathResolver interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(PathResolver.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (PathResolver) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load PathResolver on ReportJspMetadataListener.");
            return null;
        }
    }
    else {
        return pathResolver;
    }

}
 
Example 11
Source Project: gvnix   Source File: JQueryOperationsImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public MvcOperations getMvcOperations() {
    if (mvcOperations == null) {
        // Get all Services implement MvcOperations interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(MvcOperations.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (MvcOperations) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load MvcOperations on JQueryOperationsImpl.");
            return null;
        }
    }
    else {
        return mvcOperations;
    }
}
 
Example 12
Source Project: gvnix   Source File: DependencyListenerImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public ProjectOperations getProjectOperations() {
    if (projectOperations == null) {
        // Get all Services implement ProjectOperations interface
        try {
            ServiceReference[] references = context
                    .getAllServiceReferences(
                            ProjectOperations.class.getName(), null);

            for (ServiceReference ref : references) {
                projectOperations = (ProjectOperations) context
                        .getService(ref);
                return projectOperations;
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load ProjectOperations on DependencyListenerImpl.");
            return null;
        }
    }
    else {
        return projectOperations;
    }
}
 
Example 13
public PathResolver getPathResolver() {
    if (pathResolver == null) {
        // Get all Services implement PathResolver interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(PathResolver.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (PathResolver) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load PathResolver on BootstrapOperationsImpl.");
            return null;
        }
    }
    else {
        return pathResolver;
    }
}
 
Example 14
Source Project: neoscada   Source File: PullManager.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public PullManager () throws InvalidSyntaxException
{
    final String driver = DataSourceHelper.getDriver ( SPECIFIC_PREFIX, DataSourceHelper.DEFAULT_PREFIX );
    this.tracker = new DataSourceFactoryTracker ( Activator.getContext (), driver, null );

    if ( driver == null )
    {
        logger.error ( "JDBC driver is not set" );
        throw new IllegalStateException ( "JDBC driver name is not set" );
    }

    this.tracker.open ();

    this.thread = new Thread ( "org.eclipse.scada.ae.slave.pull.Worker" ) {
        @Override
        public void run ()
        {
            PullManager.this.run ();
        }
    };
    this.thread.start ();
}
 
Example 15
public PathResolver getPathResolver() {
    if (pathResolver == null) {
        // Get all Services implement PathResolver interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(PathResolver.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (PathResolver) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load PathResolver on MonitoringOperationsImpl.");
            return null;
        }
    }
    else {
        return pathResolver;
    }

}
 
Example 16
Source Project: gvnix   Source File: JpaGeoOperationsImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public FileManager getFileManager() {
    if (fileManager == null) {
        // Get all Services implement FileManager interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(FileManager.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (FileManager) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load FileManager on JpaGeoOperationsImpl.");
            return null;
        }
    }
    else {
        return fileManager;
    }

}
 
Example 17
public TypeLocationService getTypeLocationService() {
    if (typeLocationService == null) {
        // Get all Services implement TypeLocationService interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            TypeLocationService.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (TypeLocationService) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load TypeLocationService on MonitoringOperationsImpl.");
            return null;
        }
    }
    else {
        return typeLocationService;
    }

}
 
Example 18
public ProjectOperations getProjectOperations() {
    if (projectOperations == null) {
        // Get all Services implement ProjectOperations interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            ProjectOperations.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (ProjectOperations) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load ProjectOperations on WSImportMetadataProvider.");
            return null;
        }
    }
    else {
        return projectOperations;
    }
}
 
Example 19
Source Project: gvnix   Source File: DependencyListenerImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
public GeoOperations getGeoOperations() {
    if (operations == null) {
        // Get all Services implement GeoOperations interface
        try {
            ServiceReference[] references = context
                    .getAllServiceReferences(GeoOperations.class.getName(),
                            null);

            for (ServiceReference ref : references) {
                operations = (GeoOperations) context.getService(ref);
                return operations;
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load GeoOperations on DependencyListenerImpl.");
            return null;
        }
    }
    else {
        return operations;
    }
}
 
Example 20
/**
 * Constructs a condition that tries to match the passed Bundle's location
 * to the location pattern.
 * 
 * @param bundle The Bundle being evaluated.
 * @param info The ConditionInfo from which to construct the condition. The
 *        ConditionInfo must specify one or two arguments. The first
 *        argument of the ConditionInfo specifies the location pattern
 *        against which to match the bundle location. Matching is done
 *        according to the filter string matching rules. Any '*' characters
 *        in the first argument are used as wildcards when matching bundle
 *        locations unless they are escaped with a '\' character. The
 *        Condition is satisfied if the bundle location matches the pattern.
 *        The second argument of the ConditionInfo is optional. If a second
 *        argument is present and equal to "!", then the satisfaction of the
 *        Condition is negated. That is, the Condition is satisfied if the
 *        bundle location does NOT match the pattern. If the second argument
 *        is present but does not equal "!", then the second argument is
 *        ignored.
 * @return Condition object for the requested condition.
 */
static public Condition getCondition(final Bundle bundle, final ConditionInfo info) {
	if (!CONDITION_TYPE.equals(info.getType()))
		throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
	String[] args = info.getArgs();
	if (args.length != 1 && args.length != 2)
		throw new IllegalArgumentException("Illegal number of args: " + args.length);
	String bundleLocation = AccessController.doPrivileged(new PrivilegedAction<String>() {
		public String run() {
			return bundle.getLocation();
		}
	});
	Filter filter = null;
	try {
		filter = FrameworkUtil.createFilter("(location=" + escapeLocation(args[0]) + ")");
	} catch (InvalidSyntaxException e) {
		// this should never happen, but just in case
		throw new RuntimeException("Invalid filter: " + e.getFilter(), e);
	}
	Dictionary<String, String> matchProps = new Hashtable<String, String>(2);
	matchProps.put("location", bundleLocation);
	boolean negate = (args.length == 2) ? "!".equals(args[1]) : false;
	return (negate ^ filter.match(matchProps)) ? Condition.TRUE : Condition.FALSE;
}
 
Example 21
@Override
public ScriptEngine getScriptEngineForLanguage(String language) {
   ScriptEngine scriptEngine = null;
   try {
     scriptEngine = resolveScriptEngine(language);
   } catch (InvalidSyntaxException e) {
     throw new ProcessEngineException(
         "problem resolving scripting engine" + e.getMessage(), e);
   }

   if (scriptEngine == null) {
     throw new ProcessEngineException(
         "Can't find scripting engine for '" + language + "'");
   }
   return scriptEngine;
}
 
Example 22
void doQuery() throws InvalidSyntaxException {
    if (tail.length() < 3 || !prefix("("))
        error(MALFORMED);

    switch (tail.charAt(0)) {
    case '&':
        doAnd();
        break;
    case '|':
        doOr();
        break;
    case '!':
        doNot();
        break;
    default:
        doSimple();
        break;
    }

    if (!prefix(")"))
        error(MALFORMED);
}
 
Example 23
public I18nSupport getI18nSupport() {
    if (i18nSupport == null) {
        // Get all Services implement I18nSupport interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(I18nSupport.class.getName(),
                            null);

            for (ServiceReference<?> ref : references) {
                return (I18nSupport) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load I18nSupport on DatatablesOperationsImpl.");
            return null;
        }
    }
    else {
        return i18nSupport;
    }
}
 
Example 24
Source Project: gvnix   Source File: ReportMetadataProvider.java    License: GNU General Public License v3.0 6 votes vote down vote up
public WebMetadataService getWebMetadataService() {
    if (webMetadataService == null) {
        // Get all Services implement WebMetadataService interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            WebMetadataService.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (WebMetadataService) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            logger.warning("Cannot load WebMetadataService on ReportMetadataProvider.");
            return null;
        }
    }
    else {
        return webMetadataService;
    }

}
 
Example 25
public WSConfigService getWSConfigService() {
    if (wSConfigService == null) {
        // Get all Services implement WSConfigService interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            WSConfigService.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (WSConfigService) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load WSConfigService on WSExportMetadataProvider.");
            return null;
        }
    }
    else {
        return wSConfigService;
    }
}
 
Example 26
Source Project: neoscada   Source File: MovingAverageDataSource.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void updateDataSource () throws InvalidSyntaxException
{
    logger.debug ( "updateDataSource ()" );
    if ( this.dataSourceTracker != null )
    {
        this.dataSourceTracker.close ();
        this.dataSourceTracker = null;
    }
    if ( this.dataSourceId != null )
    {
        logger.debug ( "track datasource {}", this.dataSourceId );
        this.dataSourceTracker = new SingleDataSourceTracker ( this.poolTracker, this.dataSourceId, new ServiceListener () {
            @Override
            public void dataSourceChanged ( final DataSource dataSource )
            {
                setDataSource ( dataSource );
            }
        } );
        this.dataSourceTracker.open ();
    }
}
 
Example 27
Source Project: neoscada   Source File: ConnectionTracker.java    License: Eclipse Public License 1.0 6 votes vote down vote up
protected Filter createFilter ()
{
    try
    {
        Class<?> filterClazz;
        if ( this.clazz != null )
        {
            filterClazz = this.clazz;
        }
        else
        {
            filterClazz = ConnectionService.class;
        }

        return FilterUtil.createAndFilter ( filterClazz.getName (), createFilterParameters () );
    }
    catch ( final InvalidSyntaxException e )
    {
        logger.warn ( "Failed to create filter", e );
        return null;
    }
}
 
Example 28
Source Project: AtlasForAndroid   Source File: BundleContextImpl.java    License: MIT License 6 votes vote down vote up
public ServiceReference[] getServiceReferences(String str, String str2) throws InvalidSyntaxException {
    Collection collection;
    checkValid();
    Filter fromString = RFC1960Filter.fromString(str2);
    if (str == null) {
        collection = Framework.services;
    } else {
        List list = (List) Framework.classes_services.get(str);
        if (list == null) {
            return null;
        }
    }
    List arrayList = new ArrayList();
    ServiceReferenceImpl[] serviceReferenceImplArr = (ServiceReferenceImpl[]) collection.toArray(new ServiceReferenceImpl[collection.size()]);
    for (int i = 0; i < serviceReferenceImplArr.length; i++) {
        if (fromString.match(serviceReferenceImplArr[i])) {
            arrayList.add(serviceReferenceImplArr[i]);
        }
    }
    if (Framework.DEBUG_SERVICES && log.isInfoEnabled()) {
        log.info("Framework: REQUESTED SERVICES " + str + " " + str2);
        log.info("\tRETURNED " + arrayList);
    }
    return arrayList.size() == 0 ? null : (ServiceReference[]) arrayList.toArray(new ServiceReference[arrayList.size()]);
}
 
Example 29
public WebMvcOperations getWebMvcOperations() {
    if (webMvcOperations == null) {
        // Get all Services implement WebMvcOperations interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            WebMvcOperations.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                return (WebMvcOperations) this.context.getService(ref);
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load WebMvcOperations on DatatablesOperationsImpl.");
            return null;
        }
    }
    else {
        return webMvcOperations;
    }
}
 
Example 30
public WebProjectUtils getWebProjectUtils() {
    if (webProjectUtils == null) {
        // Get all Services implement WebProjectUtils interface
        try {
            ServiceReference<?>[] references = this.context
                    .getAllServiceReferences(
                            WebProjectUtils.class.getName(), null);

            for (ServiceReference<?> ref : references) {
                webProjectUtils = (WebProjectUtils) this.context
                        .getService(ref);
                return webProjectUtils;
            }

            return null;

        }
        catch (InvalidSyntaxException e) {
            LOGGER.warning("Cannot load WebProjectUtils on MenuEntryOperationsImpl.");
            return null;
        }
    }
    else {
        return webProjectUtils;
    }
}