Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.NotProcessed


    * @param event Event to be processed.
    * @throws AdminEventListenerException when the listener is unable to
    *         process the event.
    */
    public <T extends ConfigBeanProxy> NotProcessed handleCreate(T instance) {
  NotProcessed np = null;
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, "MessageSecurityConfigEventListenerImpl - " +
    "handleCreate called");
        }
  if (instance instanceof MessageSecurityConfig) {
      GFServerConfigProvider.loadConfigContext(service);
  } else {
      np = new NotProcessed("unimplemented: unknown instance: "
    + instance.getClass().getName());
  }
  return np;
    }
View Full Code Here


  * @param changedType type of the configuration object
  * @param changedInstance changed instance.
  */
  public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type,
    Class<T> changedType, T changedInstance) {
      NotProcessed np = null;
      switch (type) {
    case ADD:
        logger.fine("A new " + changedType.getName() +
          " was added : " + " " + changedInstance);
        np = handleCreate(changedInstance);
View Full Code Here

        // ignore a REMOVE and an ADD of the same value
       
        final UnprocessedChangeEvents unp = ConfigSupport.sortAndDispatch(events, new Changed() {
            @Override
            public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> tc, T t) {
                NotProcessed result = null;
               
                if (tc == Profiler.class) {
                    result = new NotProcessed("Creation or changes to a profiler require restart");
                }
                else if (tc == Property.class && t.getParent().getClass() == JavaConfig.class) {
                    result = new NotProcessed("Addition of properties to JavaConfig requires restart");
                }
                else if (tc == JavaConfig.class && t instanceof JavaConfig) {
                    final JavaConfig njc = (JavaConfig) t;
                    logFine(type, njc);
                   
                    // we must *always* check the jvm options, no way to know except by comparing,
                    // plus we should send an appropriate message back for each removed/added item
                    final List<String> curProps = new ArrayList<String>( njc.getJvmOptions() );
                    final boolean jvmOptionsWereChanged = ! oldProps.equals(curProps);
                    final List<String> reasons = handle(oldProps, curProps);
                    oldProps = curProps;
                   
                    // something in the JavaConfig itself changed
                    // to do this well, we ought to keep a list of attributes, so we can make a good message
                    // saying exactly which attribute what changed
                    final Map<String,String> curAttrs = collectAttrs(njc);
                    reasons.addAll( handleAttrs( oldAttrs, curAttrs ) );
                    oldAttrs = curAttrs;
                   
                    result = reasons.isEmpty() ? null : new NotProcessed( CombinedJavaConfigSystemPropertyListener.toString(reasons) );
                }
                else if (tc == SystemProperty.class && t instanceof SystemProperty) {
                    final SystemProperty sp = (SystemProperty) t;
                    // check to see if this system property is for this instance
                    ConfigBeanProxy proxy = sp.getParent();
                    ConfigView p = ConfigSupport.getImpl(proxy);

                   
                    if (p == ConfigSupport.getImpl(server) ||
                            p == ConfigSupport.getImpl(config) ||
                            (cluster != null && p == ConfigSupport.getImpl(cluster)) ||
                            p == ConfigSupport.getImpl(domain)) {
                        // check to see if this system property is referenced by any of the options
                        String pname = sp.getName();
                        if (referencesProperty(pname, oldProps) ||
                            referencesProperty(pname, oldAttrs.values())) {
                            result = new NotProcessed("The system-property, " + pname + ", that is referenced by the Java configuration, was modified");
                        }
                    }
                    if (type == TYPE.ADD || type == TYPE.CHANGE) {  //create-system-properties
                        if (proxy instanceof Domain) {
                            return addToDomain(sp);
View Full Code Here

    }


   
    private List<String> handle(List<String> old, List<String> cur) {
        NotProcessed np = null;
       
        final Set<String> added = new HashSet<String>(cur);
        added.removeAll(old);
       
        final Set<String> removed = new HashSet<String>(old);
View Full Code Here

    class PropertyChangeHandler implements Changed {

        @Override
        public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> changedType, T changedInstance) {
            NotProcessed np = null;
            switch (type) {
                case CHANGE:
                    if(logger.isLoggable(Level.FINE)) {
                        logger.fine(adminStrings.getLocalString("managedJobConfig.change","ManagedJobConfig {0} was changed by {1} " , changedType.getName() , changedInstance));
                    }
View Full Code Here

         * @param changedType     type of the configuration object
         * @param changedInstance changed instance.
         */
        public <T extends ConfigBeanProxy> NotProcessed changed(Changed.TYPE type, Class<T> changedType,
                                                                T changedInstance) {
            NotProcessed np = null;
            if(!(changedInstance instanceof Application)){
                return np;
            }
            if(serverEnvironment.isDas()){
                ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
View Full Code Here

                }
            }
            return np;
        }
        private <T extends ConfigBeanProxy> NotProcessed handleAddEvent(T instance) {
            NotProcessed np = null;
            if(instance instanceof Application){
                Resources resources = ((Application)instance).getResources();
                pingConnectionPool(resources);

                Application app = (Application)instance;
View Full Code Here

        // ignore a REMOVE and an ADD of the same value
       
        final UnprocessedChangeEvents unp = ConfigSupport.sortAndDispatch(events, new Changed() {
            @Override
            public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> tc, T t) {
                NotProcessed result = null;
               
                if (tc == Profiler.class) {
                    result = new NotProcessed("Creation or changes to a profiler require restart");
                }
                else if (tc == Property.class && t.getParent().getClass() == JavaConfig.class) {
                    result = new NotProcessed("Addition of properties to JavaConfig requires restart");
                }
                else if (tc == JavaConfig.class && t instanceof JavaConfig) {
                    final JavaConfig njc = (JavaConfig) t;
                    logFine(type, njc);
                   
                    // we must *always* check the jvm options, no way to know except by comparing,
                    // plus we should send an appropriate message back for each removed/added item
                    final List<String> curProps = new ArrayList<String>( njc.getJvmOptions() );
                    final boolean jvmOptionsWereChanged = ! oldProps.equals(curProps);
                    final List<String> reasons = handle(oldProps, curProps);
                    oldProps = curProps;
                   
                    // something in the JavaConfig itself changed
                    // to do this well, we ought to keep a list of attributes, so we can make a good message
                    // saying exactly which attribute what changed
                    final Map<String,String> curAttrs = collectAttrs(njc);
                    reasons.addAll( handleAttrs( oldAttrs, curAttrs ) );
                    oldAttrs = curAttrs;
                   
                    result = reasons.isEmpty() ? null : new NotProcessed( CombinedJavaConfigSystemPropertyListener.toString(reasons) );
                }
                else if (tc == SystemProperty.class && t instanceof SystemProperty) {
                    final SystemProperty sp = (SystemProperty) t;
                    // check to see if this system property is for this instance
                    ConfigBeanProxy proxy = sp.getParent();
                    ConfigView p = ConfigSupport.getImpl(proxy);

                   
                    if (p == ConfigSupport.getImpl(server) ||
                            p == ConfigSupport.getImpl(config) ||
                            (cluster != null && p == ConfigSupport.getImpl(cluster)) ||
                            p == ConfigSupport.getImpl(domain)) {
                        // check to see if this system property is referenced by any of the options
                        String pname = sp.getName();
                        if (referencesProperty(pname, oldProps) ||
                            referencesProperty(pname, oldAttrs.values())) {
                            result = new NotProcessed("The system-property, " + pname + ", that is referenced by the Java configuration, was modified");
                        }
                    }
                    if (type == TYPE.ADD || type == TYPE.CHANGE) {  //create-system-properties
                        if (proxy instanceof Domain) {
                            return addToDomain(sp);
View Full Code Here

    }


   
    private List<String> handle(List<String> old, List<String> cur) {
        NotProcessed np = null;
       
        final Set<String> added = new HashSet<String>(cur);
        added.removeAll(old);
       
        final Set<String> removed = new HashSet<String>(old);
View Full Code Here

    class PropertyChangeHandler implements Changed {

        @Override
        public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> changedType, T changedInstance) {
            NotProcessed np = null;
            switch (type) {
                case CHANGE:
                    if(logger.isLoggable(Level.FINE)) {

                       logger.log(Level.FINE, KernelLoggerInfo.changeManagedJobConfig, new Object[]{
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.config.NotProcessed

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.