Package org.apache.derby.iapi.services.monitor

Examples of org.apache.derby.iapi.services.monitor.PersistentService


  public Object createPersistentService(String factoryInterface, String name, Properties properties)
    throws StandardException {


    PersistentService provider = findProviderForCreate(name);
    if (provider == null) {
      throw StandardException.newException(SQLState.PROTOCOL_UNKNOWN, name);
    }

    return bootService(provider, factoryInterface, name, properties, true);
View Full Code Here


      
    */
    public void removePersistentService(String name)
         throws StandardException
    {
        PersistentService provider=null;
    provider = findProviderForCreate(name);
        String serviceName = provider.getCanonicalServiceName(name);
        boolean removed = provider.removeServiceRoot(serviceName);
        if (removed == false)
      throw StandardException.newException(SQLState.SERVICE_DIRECTORY_REMOVE_ERROR,serviceName);
    }
View Full Code Here

    private boolean getPersistentServiceImplementation( Class possibleModule)
    {
        if( ! PersistentService.class.isAssignableFrom(possibleModule))
            return false;

        PersistentService ps = (PersistentService) newInstance(possibleModule);
        if (ps == null) {
            report("Class " + possibleModule.getName() + " cannot create instance, module ignored.");
        } else {
            serviceProviders.put(ps.getType(), ps);
        }
        return true;
    } // end of getPersistentServiceImplementation
View Full Code Here

    to boot all the services that that provider knows about.
  */
  private void bootPersistentServices() {
    Enumeration e = new ProviderEnumeration( applicationProperties);
    while (e.hasMoreElements()) {
      PersistentService provider = (PersistentService) e.nextElement();
      bootProviderServices(provider);
    }

  }
View Full Code Here

  */
  private boolean findProviderAndStartService(String name,
              Properties properties, boolean bootTime)
    throws StandardException {

    PersistentService actualProvider = null;

    Properties serviceProperties = null;
    String serviceName = null;

    // see if the name already includes a service type
    int colon = name.indexOf(':');
    if (colon != -1) {
      actualProvider = findProviderFromName(name, colon);

      // if null is returned here then its a sub-sub protocol/provider
      // that we don't understand. Attempt to load it as an untyped name.
      // If we have a protool
      // that we do understand and we can't open the service we will
      // throw an exception
      if (actualProvider != null) {

        serviceName = actualProvider.getCanonicalServiceName(name);
        if (serviceName == null)
          return true// we understand the type, but the service does not exist

        serviceProperties =
          actualProvider.getServiceProperties(serviceName, properties);

        if (serviceProperties == null)
          return true; // we understand the type, but the service does not exist

        // see if this service does not want to be auto-booted.
        if (bootTime && Boolean.valueOf(serviceProperties.getProperty(Property.NO_AUTO_BOOT)).booleanValue())
          return true;

        startProviderService(actualProvider, serviceName, serviceProperties);
        return true; // we understand the type
      }
    }

    StandardException savedMse = null;

    for (Enumeration e = new ProviderEnumeration( properties); e.hasMoreElements(); ) {

      PersistentService provider = (PersistentService) e.nextElement();

      String sn = provider.getCanonicalServiceName(name);
      if (sn == null)
        continue;

      Properties p = null;
      try {
        p = provider.getServiceProperties(sn, properties);
        // service does not exist.
        if (p == null)
          continue;

      } catch (StandardException mse) {
View Full Code Here

    {
        if( subSubProtocol == null)
            return null;
        if( serviceProviders != null)
        {
            PersistentService ps = (PersistentService) serviceProviders.get( subSubProtocol);
            if( ps != null)
                return ps;
        }
        return getPersistentService(subSubProtocol);
    } // end of getServiceProvider
View Full Code Here

        }
        else
        {
            try
            {
                PersistentService ps = Monitor.getMonitor().getServiceType(this);
                logStorageFactory = (WritableStorageFactory) ps.getStorageFactoryInstance( false, logDevice, null, null);
            }
            catch( IOException ioe)
            {
                if( SanityManager.DEBUG)
                    SanityManager.NOTREACHED();
View Full Code Here

            StorageFile logdir = logFactory.getLogDirectory();
           
            try
            {
                String name = Monitor.getMonitor().getServiceName(this);
                PersistentService ps =
                    Monitor.getMonitor().getServiceType(this);
                String fullName = ps.getCanonicalServiceName(name);
                Properties prop =
                    ps.getServiceProperties(fullName, (Properties)null);

                StorageFile defaultLogDir =
                    storageFactory.newStorageFile(
                        LogFactory.LOG_DIRECTORY_NAME);

                if (!logdir.equals(defaultLogDir)) 
                {
                    prop.remove(Attribute.LOG_DEVICE);
                    if (SanityManager.DEBUG)
                    {
                        SanityManager.ASSERT(
                            prop.getProperty(Attribute.LOG_DEVICE) == null,
                            "cannot get rid of logDevice property");
                    }

                    logHistory(historyFile,
                               MessageService.getTextMessage(
                               MessageId.STORE_EDITED_SERVICEPROPS));
                }
           
                // save the service properties into the backup.
                ps.saveServiceProperties(backupcopy.getPath(), prop);

            }
            catch(StandardException se)
            {
                logHistory(
View Full Code Here

            // Attribute.DATA_ENCRYPTION is stored in the service properties
            // for encrypted database, and this takes precedence over the
            // value specified by the user.

            String name = Monitor.getMonitor().getServiceName(this);
            PersistentService ps = Monitor.getMonitor().getServiceType(this);
            String canonicalName = ps.getCanonicalServiceName(name);
            Properties serviceprops = ps.getServiceProperties(canonicalName,
                                                              (Properties)null);
            isEncryptedDatabase =
                    isTrue(serviceprops, Attribute.DATA_ENCRYPTION);

            if (isEncryptedDatabase) {
View Full Code Here

        public PersistentService nextElement() throws NoSuchElementException
        {
            if( serviceProvidersKeys != null && serviceProvidersKeys.hasMoreElements())
                return serviceProviders.get( serviceProvidersKeys.nextElement());
            getNextStorageFactory();
            PersistentService ret = storageFactoryPersistentService;
            storageFactoryPersistentService = null;
            return ret;
        }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.monitor.PersistentService

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.