/**

   Copyright 2010 OpenEngSB Division, Vienna University of Technology

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

 */
package org.openengsb.ui.web.fixtures.log;

import java.util.Locale;
import java.util.Map;

import org.openengsb.core.config.ServiceManager;
import org.openengsb.core.config.descriptor.AttributeDefinition;
import org.openengsb.core.config.descriptor.ServiceDescriptor;

public class StdoutLogServiceManager implements ServiceManager {

    @Override
    public ServiceDescriptor getDescriptor() {
        return getDescriptor(Locale.getDefault());
    }

    @Override
    public ServiceDescriptor getDescriptor(Locale locale) {
        boolean de = "de".equals(locale.getLanguage());
        return ServiceDescriptor.builder()
                .id(StdoutLogService.class.getName())
                .implementsInterface(LogDomain.class.getName())
                .name(de ? "Stdout Log Service" : "Stdout Log Service")
                .description(de ? "Loggt Nachrichten auf den Stdout." : "Logs messages to the stdout.")
                .attribute(AttributeDefinition.builder()
                .id("flush")
                .name(de ? "Ausgabe flushen" : "Flush Output")
                .description(de ? "die deutsche Beschreibung" : "die englische Beschreibung")
                .defaultValue("true")
                .required()
                .build())
        .build();
    }

    @Override
    public void update(String id, Map<String, String> attributes) {
    }

    @Override
    public void delete(String id) {
    }

}

@@ -1222,364 +1222,380 @@
     
-return ServiceDescriptor.builder()%0A                .id(StdoutLogService.class.getName())%0A                .implementsInterface(LogDomain.class.getName())%0A                .name(de ? %22Stdout Log Service%22 : %22Stdout Log Service%22)%0A                .description(de ? %22Loggt Nachrichten auf den Stdout.%22 : %22Logs messages to the stdout.%22)%0A                .attribute(
+AttributeDefinition flush = AttributeDefinition.builder()%0A                .id(%22flush%22)%0A                .name(de ? %22Ausgabe flushen%22 : %22Flush Output%22)%0A                .description(de ? %22die deutsche Beschreibung%22 : %22die englische Beschreibung%22)%0A                .defaultValue(%22true%22)%0A                .required()%0A                .build();%0A        AttributeDefinition level = 
 Attr
@@ -1633,37 +1633,37 @@
            .id(%22
-flush
+level
 %22)%0A             
@@ -1675,178 +1675,480 @@
 ame(
-de ? %22Ausgabe flushen%22 : %22Flush Output%22)%0A                .description(de ? %22die deutsche Beschreibung%22 : %22die englische Beschreibung%22)%0A                .defaultValue(%22true
+%22Log Level%22)%0A                .defaultValue(%22INFO%22)%0A                .description(%22%22)%0A                .required()%0A                .build();%0A        return ServiceDescriptor.builder()%0A                .id(StdoutLogService.class.getName())%0A                .implementsInterface(LogDomain.class.getName())%0A                .name(de ? %22Stdout Log Service%22 : %22Stdout Log Service%22)%0A                .description(de ? %22Loggt Nachrichten auf den Stdout.%22 : %22Logs messages to the stdout.
 %22)%0A 
@@ -2159,33 +2159,39 @@
            .
-required(
+attribute(flush
 )%0A          
@@ -2201,17 +2201,33 @@
    .
-build())%0A
+attribute(level)%0A        
     

add a second attribute to the log service fixture