Package org.papoose.core.filter

Examples of org.papoose.core.filter.Expr


    public ServiceReference[] getAllServiceReferences(BundleController bundleController, String clazz, String filter) throws InvalidSyntaxException
    {
        synchronized (lock)
        {
            Expr expr = (filter == null ? null : framework.getParser().parse(filter));
            List<ServiceReference> result = new ArrayList<ServiceReference>();

            for (ServiceEntry entry : serviceEntries.values())
            {
                ServiceRegistrationImpl registration = entry.getRegistration();
                ServiceRegistrationImpl.ServiceReferenceImpl reference = (ServiceRegistrationImpl.ServiceReferenceImpl) registration.getReference();
                Dictionary<String, Object> p = reference.getProperties();

                boolean found = true;
                if (clazz != null)
                {
                    found = false;
                    for (String objectClass : (String[]) p.get(Constants.OBJECTCLASS))
                    {
                        if (objectClass.equals(clazz))
                        {
                            found = true;
                            break;
                        }
                    }
                }
                if (!found) continue;

                boolean secure = true;
                for (String objectClass : (String[]) p.get(Constants.OBJECTCLASS))
                {
                    try
                    {
                        SecurityUtils.checkServicePermission(objectClass, ServicePermission.GET);
                    }
                    catch (SecurityException e)
                    {
                        secure = false;
                        break;
                    }
                }
                if (!secure) continue;

                if (expr != null && !expr.match(p)) continue;

                result.add(reference);
            }

            return sortedReferences(result);
View Full Code Here

TOP

Related Classes of org.papoose.core.filter.Expr

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.