Selects the a specified m_drInterface over a specified m_externalInterface from m_config
@return an empty string when neither are specified
196591
public static String getDefaultReplicationInterface() {
        if (m_config.m_drInterface == null || m_config.m_drInterface.isEmpty()) {
            if (m_config.m_externalInterface == null) {
                return "";
            }
            else {
                return m_config.m_externalInterface;
            }
        }
        else {
            return m_config.m_drInterface;
        }
    }
72563
public String select(int databaseIndex) {
		Jedis jedis = getJedis();
		try {
			return jedis.select(databaseIndex);
		}
		finally {close(jedis);}
	}
147426
public static <C> C getProxy(final Class<C> configInterface)
    {
        return getProxy(configInterface, Optional.empty());
    }
313398
public String getHtmlForDbSelection() {

        StringBuffer buf = new StringBuffer(2048);

        buf.append(
            "<select name=\"fullDatabaseKey\" style=\"width: 250px;\" size=\"1\" onchange=\"location.href='../../step_3_database_selection.jsp?fullDatabaseKey='+this.options[this.selectedIndex].value;\">");
        buf.append("<!-- --------------------- JSP CODE --------------------------- -->");

        // get all available databases
        List<String> databases = getSortedDatabases();

        //  List all databases found in the dbsetup.properties
        if ((databases != null) && (databases.size() > 0)) {

            List<String> sqlDbs = new ArrayList<String>();

            for (String dbKey : databases) {
                sqlDbs.add(dbKey);
            }

            // show the sql dbs first
            for (String dbKey : sqlDbs) {
                String dn = getDatabaseName(dbKey);
                String selected = "";
                if (getFullDatabaseKey().equals(dbKey + "_sql")) {
                    selected = "selected";
                }
                buf.append("<option value='" + dbKey + "_sql' " + selected + ">" + dn);
            }
        } else {
            buf.append("<option value='null'>no database found");
        }

        buf.append("<!-- --------------------------------------------------------- -->");
        buf.append("</select>");

        return buf.toString();
    }
367749
protected String playModuleNotApplicationCheck()
    {
        String resultMessage = null;

        File baseDir = project.getBasedir();
        File confDir = new File( baseDir, "conf" );

        File applicationConfFile = new File( confDir, "application.conf" );
        if ( applicationConfFile.length() == 0 )
        {
            resultMessage = "Empty \"conf/application.conf\" file, skipping execution";
        }
        else
        {
            File routesFile = new File( confDir, "routes" );
            if ( !routesFile.isFile() )
            {
                resultMessage = "No \"conf/routes\" file, skipping execution";
            }
            else if ( routesFile.length() == 0 )
            {
                resultMessage = "Empty \"conf/routes\" file, skipping execution";
            }
        }

        return resultMessage;
    }
771246
@Override
	protected long detectPID() throws Exception {
		String jvmName = ManagementFactory.getRuntimeMXBean().getName();
		int index = jvmName.indexOf('@');
		if (index < 1) {
			return 0;
		}
		return Long.parseLong(jvmName.substring(0, index));
	}
482695
public List<String> getButtonBarOption() {

        if (m_buttonBarOption == null) {
            // use lazy initializing for performance reasons
            if (CmsStringUtil.isEmpty(getButtonBarOptionString())) {
                // no individual configuration defined, create empty list
                m_buttonBarOption = Collections.emptyList();
            } else {
                // create list of button bar options from configuration string
                m_buttonBarOption = CmsStringUtil.splitAsList(getButtonBarOptionString(), DELIMITER_VALUE, true);
            }
        }
        return m_buttonBarOption;
    }
743689
public static MSICredentials getMSICredentials(String managementEndpoint) {
        //check if we are running in a web app
        String websiteName = System.getenv("WEBSITE_SITE_NAME");

        if (websiteName != null && !websiteName.isEmpty()) {
            // We are in a web app...
            MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint);
            return forAppService(config);
        } else {
            //We are in a vm/container
            MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint);
            return forVirtualMachine(config);
        }
    }
1155141
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201811.ContentServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201811.ContentServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201811.ContentServiceSoapBindingStub(new java.net.URL(ContentServiceInterfacePort_address), this);
                _stub.setPortName(getContentServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
97832
private ConfigItem getRemoteCanalConfig() {
        String sql = "select name, content, modified_time from canal_config where id=1";
        try (Connection conn = dataSource.getConnection();
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery(sql)) {
            if (rs.next()) {
                ConfigItem configItem = new ConfigItem();
                configItem.setId(1L);
                configItem.setName(rs.getString("name"));
                configItem.setContent(rs.getString("content"));
                configItem.setModifiedTime(rs.getTimestamp("modified_time").getTime());
                return configItem;
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return null;
    }
358451
@Override
    public DataSource getSelectedDataSource() {
        final String dataSourceName = selectableDataSourceHolder.getCurrentSelectableDataSourceKey();
        if (dataSourceName != null) {
            return selectableDataSourceHolder.getSelectedDataSource();
        } else { // means no name set on thread local
            try {
                selectableDataSourceHolder.switchSelectableDataSourceKey(SlaveDBAccessor.MASTER_DB); // as default
                return selectableDataSourceHolder.getSelectedDataSource();
            } finally {
                selectableDataSourceHolder.switchSelectableDataSourceKey(null); // restore
            }
        }
    }
792413
static Class getMostDerivedInterface(Class controlIntf)
    {
        while (controlIntf.isAnnotationPresent(ControlExtension.class))
        {
            Class [] intfs = controlIntf.getInterfaces();
            boolean found = false;
            for (int i = 0; i < intfs.length; i++)
            {
                if (intfs[i].isAnnotationPresent(ControlExtension.class) ||
                    intfs[i].isAnnotationPresent(ControlInterface.class))
                {
                    controlIntf = intfs[i];
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                throw new ControlException("Can't find base control interface for " + controlIntf);
            }
        }
        return controlIntf;
    }
1157069
public static function select(String $name = NULL)
    {
        $name  = self::$settings['name']  ?? $name;
        $input = self::$settings['input'] ?? false;

        self::$settings = [];

        return Method::$input($name);
    }
597042
public String getExplorerFilesUri() {

        String body = "explorer_files.jsp?mode=explorerview";
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_uri)) {
            body = m_uri;
        }
        return getJsp().link(body);
    }
496274
@Override
    public FacesConfig getMetaInfServicesFacesConfig(ExternalContext ectx)
    {
        try
        {
            org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl facesConfig
                    = new org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl();
            org.apache.myfaces.config.impl.digester.elements.FactoryImpl factory
                    = new org.apache.myfaces.config.impl.digester.elements.FactoryImpl();
            
            facesConfig.addFactory(factory);
            
            for (String factoryName : FACTORY_NAMES)
            {
                List<String> classList = ServiceProviderFinderFactory.getServiceProviderFinder(ectx)
                        .getServiceProviderList(factoryName);
                
                for (String className : classList)
                {
                    if (log.isLoggable(Level.INFO))
                    {
                        log.info("Found " + factoryName + " factory implementation: " + className);
                    }

                    if (factoryName.equals(FactoryFinder.APPLICATION_FACTORY))
                    {
                        factory.addApplicationFactory(className);
                    } 
                    else if(factoryName.equals(FactoryFinder.EXCEPTION_HANDLER_FACTORY)) 
                    {
                        factory.addExceptionHandlerFactory(className);
                    } 
                    else if (factoryName.equals(FactoryFinder.EXTERNAL_CONTEXT_FACTORY))
                    {
                        factory.addExternalContextFactory(className);
                    } 
                    else if (factoryName.equals(FactoryFinder.FACES_CONTEXT_FACTORY))
                    {
                        factory.addFacesContextFactory(className);
                    } 
                    else if (factoryName.equals(FactoryFinder.LIFECYCLE_FACTORY))
                    {
                        factory.addLifecycleFactory(className);
                    } 
                    else if (factoryName.equals(FactoryFinder.RENDER_KIT_FACTORY))
                    {
                        factory.addRenderkitFactory(className);
                    } 
                    else if(factoryName.equals(FactoryFinder.TAG_HANDLER_DELEGATE_FACTORY)) 
                    {
                        factory.addTagHandlerDelegateFactory(className);
                    } 
                    else if (factoryName.equals(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY))
                    {
                        factory.addPartialViewContextFactory(className);
                    } 
                    else if(factoryName.equals(FactoryFinder.VISIT_CONTEXT_FACTORY)) 
                    {
                        factory.addVisitContextFactory(className);
                    } 
                    else if(factoryName.equals(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY)) 
                    {
                        factory.addViewDeclarationLanguageFactory(className);
                    }
                    else if(factoryName.equals(FactoryFinder.FLASH_FACTORY)) 
                    {
                        factory.addFlashFactory(className);
                    }
                    else if(factoryName.equals(FactoryFinder.FLOW_HANDLER_FACTORY)) 
                    {
                        factory.addFlowHandlerFactory(className);
                    }
                    else if(factoryName.equals(FactoryFinder.CLIENT_WINDOW_FACTORY)) 
                    {
                        factory.addClientWindowFactory(className);
                    }
                    else if(factoryName.equals(FactoryFinder.FACELET_CACHE_FACTORY)) 
                    {
                        factory.addFaceletCacheFactory(className);
                    }
                    else
                    {
                        throw new IllegalStateException("Unexpected factory name " + factoryName);
                    }
                }
            }
            return facesConfig;
        }
        catch (Throwable e)
        {
            throw new FacesException(e);
        }
    }
625538
@SuppressWarnings("unchecked")
	private StringBuffer getInterfaceScript(String scriptName,ServletContext servletContext) {
		StringBuffer sb = new StringBuffer(ENGINE_INIT);

		// List all containers to find all DWR interfaces
		List<Container> containers = ContainerUtil.getAllPublishedContainers(servletContext);
		boolean found = false;
		for(Iterator<Container> it = containers.iterator();it.hasNext() && !found;) {
			Container container = it.next();
			
			// The creatormanager holds the list of beans
			CreatorManager ctManager = (CreatorManager) container.getBean(CreatorManager.class.getName());
			if( null != ctManager ) {
				// The remoter builds interface scripts. 
				Remoter remoter = (Remoter) container.getBean(Remoter.class.getName());
				String path = getPathReplacementString(container);
				try {
					String script = remoter.generateInterfaceScript(scriptName, path);
					found = true;
					// Must remove the engine init script to avoid unneeded duplication
					script = removeEngineInit(script);
					sb.append(script);
				}
				catch(SecurityException ex){throw new BundlingProcessException(ex); }
			}
		}
		if(!found)
			throw new IllegalArgumentException("The DWR bean named '" + scriptName + "' was not found in any DWR configuration instance."); 
		
		return sb;
	}
67363
ITypeDecl getDefaultInterface( ICoClassDecl t ) {
        final int count = t.countImplementedInterfaces();
        // look for the default interface first.
        for( int i=0; i<count; i++ ) {
            IImplementedInterfaceDecl impl = t.getImplementedInterface(i);
            if(impl.isSource())
                continue;
            if(impl.isDefault()){
              IInterfaceDecl c = getCustom(impl);
              if(c!=null)
                return c;
              IDispInterfaceDecl d = impl.getType().queryInterface(IDispInterfaceDecl.class);
              if(d != null){
                return d;
              }
            }
        }

        // if none is found, look for any non-source interface
        Set<IInterfaceDecl> types = new HashSet<IInterfaceDecl>();
        for( int i=0; i<count; i++ ) {
            IImplementedInterfaceDecl impl = t.getImplementedInterface(i);
            if(impl.isSource())
                continue;
            IInterfaceDecl c = getCustom(impl);
            if(c !=null)
                types.add(c);
        }

        if(types.isEmpty())
            return null;

        // if T1 and T2 are in the set and T1 derives from T2, eliminate T2
        // (since returning T1 is better)
        Set<IInterfaceDecl> bases = new HashSet<IInterfaceDecl>();
        for (IInterfaceDecl ii : types) {
            for( int i=0; i<ii.countBaseInterfaces(); i++)
                bases.add(ii.getBaseInterface(i).queryInterface(IInterfaceDecl.class));
        }
        types.removeAll(bases);

        return types.iterator().next();
    }