added missing files

This commit is contained in:
Alex Huang 2012-11-01 13:57:34 -07:00
parent 4b9990408d
commit 7397716fcd
11 changed files with 455 additions and 0 deletions

View File

@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.cloud.entity.api;
public interface EdgeService {
}

View File

@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.datacenter.entity.api;
import com.cloud.org.Cluster;
public interface ClusterEntity extends DataCenterResourceEntity, Cluster, OrganizationScope {
}

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.datacenter.entity.api;
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
/**
* This interface specifies the states and operations all physical
* and virtual resources in the data center must implement.
*/
public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<DataCenterResourceEntity.State> {
/**
* This is the state machine for how CloudStack should interact with
*
*/
public enum State {
Disabled("The resource is disabled so CloudStack should not use it. This is the initial state of all resources added to CloudStack."),
Enabled("The resource is now enabled for CloudStack to use."),
Deactivated("The resource is disactivated so CloudStack should not use it for new resource needs.");
String _description;
private State(String description) {
_description = description;
}
public enum Event {
EnableRequest,
DisableRequest,
DeactivateRequest,
ActivatedRequest
}
protected static final StateMachine2<State, Event, DataCenterResourceEntity> s_fsm = new StateMachine2<State, Event, DataCenterResourceEntity>();
static {
s_fsm.addTransition(Disabled, Event.EnableRequest, Enabled);
s_fsm.addTransition(Enabled, Event.DisableRequest, Disabled);
s_fsm.addTransition(Enabled, Event.DeactivateRequest, Deactivated);
s_fsm.addTransition(Deactivated, Event.ActivatedRequest, Enabled);
}
}
/**
* Prepare the resource to take new on new demands.
*/
boolean enable();
/**
* Disables the resource. Cleanup. Prepare for the resource to be removed.
*/
boolean disable();
/**
* Do not use the resource for new demands.
*/
boolean deactivate();
/**
* Reactivates a deactivated resource.
*/
boolean reactivate();
}

View File

@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.datacenter.entity.api;
public interface OrganizationScope {
}

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.datacenter.entity.api;
import java.util.List;
import com.cloud.dc.Pod;
import com.cloud.org.Cluster;
public interface PodEntity extends DataCenterResourceEntity, Pod {
List<Cluster> listClusters();
}

View File

@ -0,0 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.datacenter.entity.api;
import com.cloud.storage.StoragePool;
public interface StorageEntity extends DataCenterResourceEntity, StoragePool {
}

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.datacenter.entity.api;
import java.util.List;
import com.cloud.dc.DataCenter;
/**
* Describes a zone and operations that can be done in a zone.
*/
public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
List<PodEntity> listPods();
}

View File

@ -0,0 +1,96 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.entity.api;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* All entities returned by the Cloud Orchestration Platform must implement
* this interface. CloudValueEntity is an immutable representation of
* an entity exposed by Cloud Orchestration Platform. For each object, it
* defines two ids: uuid, generated by CloudStack Orchestration Platform, and
* an external id that is set by the caller when the entity is created. All
* ids must be unique for that entity. CloudValueEntity also can be converted
* to a CloudActionableEntity which contains actions the object can perform.
*/
public interface CloudStackEntity {
/**
* @return the uuid of the object.
*/
String getUuid();
/**
* @return the id which is often the database id.
*/
long getId();
/**
* @return external id set by the caller
*/
String getExternalId();
/**
* @return current state for the entity
*/
String getCurrentState();
/**
* @return desired state for the entity
*/
String getDesiredState();
/**
* Get the time the entity was created
*/
Date getCreatedTime();
/**
* Get the time the entity was last updated
*/
Date getLastUpdatedTime();
/**
* @return reference to the owner of this entity
*/
String getOwner();
/**
* @return details stored for this entity when created.
*/
Map<String, String> getDetails(String source);
/**
* @return a list of sources that have added to the details.
*/
List<String> getDetailSources();
void addDetail(String source, String name, String value);
void delDetail(String source, String name, String value);
void updateDetail(String source, String name, String value);
/**
* @return list of actions that can be performed on the object in its current state
*/
List<Method> getApplicableActions();
}

View File

@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.cloudstack.platform.service.api;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.platform.datacenter.entity.api.ZoneEntity;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.host.Host;
import com.cloud.host.Status;
import com.cloud.storage.StoragePool;
/**
* ProvisioningService registers and deregisters physical and virtual
* resources that the management server can use.
*/
public interface ProvisioningService {
String registerStorage(String name, List<String> tags, Map<String, String> details);
ZoneEntity registerZone(String name, List<String> tags, Map<String, String> details);
String registerPod(String name, List<String> tags, Map<String, String> details);
String registerCluster(String name, List<String> tags, Map<String, String> details);
String registerHost(String name, List<String> tags, Map<String, String> details);
void deregisterStorage(String uuid);
void deregisterZone();
void deregisterPod();
void deregisterCluster();
void deregisterHost();
void changeState(String type, String entity, Status state);
List<Host> listHosts();
List<Pod> listPods();
List<DataCenter> listZones();
List<StoragePool> listStorage();
}

View File

@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.cloud.utils.fsm;
public class ChangeEvent {
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.cloud.utils.fsm;
import java.util.Set;
public interface FiniteState2<T, E> {
StateMachine2<T, ? extends ChangeEvent, ? extends StateObject> getStateMachine();
T getNextState(ChangeEvent e) throws NoTransitionException;
T getFromStates(ChangeEvent e);
Set<ChangeEvent> getPossibleEvents();
}