mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
Added some annotations for logging commands
This commit is contained in:
parent
ab49c70add
commit
c3c15b8435
61
api/src/com/cloud/agent/api/LogLevel.java
Normal file
61
api/src/com/cloud/agent/api/LogLevel.java
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Specifies the log level we should log the command in.
|
||||
*/
|
||||
@Target({ TYPE, FIELD })
|
||||
@Retention(RUNTIME)
|
||||
public @interface LogLevel {
|
||||
public enum Log4jLevel {
|
||||
Off(Level.OFF),
|
||||
Trace(Level.TRACE),
|
||||
Debug(Level.DEBUG),
|
||||
Info(Level.INFO),
|
||||
Warn(Level.WARN),
|
||||
Error(Level.ERROR),
|
||||
Fatal(Level.FATAL);
|
||||
|
||||
Level _level;
|
||||
|
||||
private Log4jLevel(Level level) {
|
||||
_level = level;
|
||||
}
|
||||
|
||||
public void log(Logger logger, String msg) {
|
||||
logger.log(_level, msg);
|
||||
}
|
||||
|
||||
public boolean enabled(Logger logger) {
|
||||
return logger.isEnabledFor(_level);
|
||||
}
|
||||
}
|
||||
|
||||
Log4jLevel level() default Log4jLevel.Debug;
|
||||
}
|
||||
22
server/src/com/cloud/resource/ResourceManager.java
Normal file
22
server/src/com/cloud/resource/ResourceManager.java
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.resource;
|
||||
|
||||
public interface ResourceManager {
|
||||
|
||||
}
|
||||
54
server/src/com/cloud/resource/ResourceManagerImpl.java
Normal file
54
server/src/com/cloud/resource/ResourceManagerImpl.java
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.resource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
@Local({ ResourceManager.class, ResourceService.class })
|
||||
public class ResourceManagerImpl implements ResourceManager, Manager {
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user