You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC
svn commit: r381694 [14/38] - in /incubator/ode/scratch: bpe/ ode/
ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/
ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/
ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Scope.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Scope.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Scope.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Scope.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.client.impl;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IInstance;
+import org.apache.ode.cc.client.IScope;
+import org.apache.ode.cc.data.ScopeData;
+import org.apache.ode.cc.data.VariableData;
+import org.apache.ode.cc.service.ICCService;
+
+public class Scope extends ServiceNode implements IScope
+{
+ private IInstance m_instance;
+// private IScope m_parentScope;
+ private ScopeData m_data;
+ public Scope(ICCService service, IInstance instance,
+ ScopeData cdata)
+ {
+ super(service);
+ m_instance = instance;
+ m_data = cdata;
+ }
+ public Collection getChildScopes() throws CCException
+ {
+ Collection childScopes = getService().getChildScopes(
+ m_data );
+ Iterator iter = childScopes.iterator();
+ LinkedList scopeList = new LinkedList();
+ while( iter.hasNext() )
+ {
+ ScopeData data = ( ScopeData )
+ ( iter.next() );
+ ChildScope newScope = new ChildScope( getService(),
+ m_instance, this, data );
+ scopeList.add( newScope );
+ }
+ return scopeList;
+ }
+ public Collection getVariables() throws CCException
+ {
+ Collection variables = getService().getVariables(m_data);
+
+ Iterator iter = variables.iterator();
+ LinkedList variableList = new LinkedList();
+ while( iter.hasNext())
+ {
+ VariableData vd = (VariableData)( iter.next());
+ Variable newVariable = new Variable( getService(),
+ this, vd );
+ variableList.add(newVariable);
+ }
+ return variableList;
+ }
+ public IInstance getBPInstance() throws CCException
+ {
+ return m_instance;
+ }
+ public String getName() throws CCException
+ {
+ return m_data.getName();
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/ServiceNode.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/ServiceNode.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/ServiceNode.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/ServiceNode.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.client.impl;
+
+import org.apache.ode.cc.service.ICCService;
+
+
+
+public class ServiceNode
+{
+ private ICCService m_CCService;
+ public ServiceNode(ICCService service)
+ {
+ m_CCService = service;
+ }
+ protected ICCService getService()
+ {
+ return m_CCService;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Variable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Variable.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Variable.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/client/impl/Variable.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.client.impl;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IScope;
+import org.apache.ode.cc.client.IVariable;
+import org.apache.ode.cc.data.PartData;
+import org.apache.ode.cc.data.VariableData;
+import org.apache.ode.cc.service.ICCService;
+
+
+public class Variable extends ServiceNode implements IVariable
+{
+ private VariableData m_data;
+ private IScope m_scope;
+ public Variable( ICCService iService, IScope iScope,
+ VariableData iData)
+ {
+ super( iService );
+ m_scope = iScope;
+ m_data = iData;
+ }
+ public Collection getParts() throws CCException
+ {
+ Collection partData = getService().getPartData(m_data);
+ LinkedList partList = new LinkedList();
+ Iterator iter = partData.iterator();
+ while( iter.hasNext() )
+ {
+ PartData pd = (PartData)(iter.next());
+ Part part = new Part(getService(),this, pd);
+ partList.add(part);
+ }
+ return partList;
+
+ }
+ public IScope getScope() throws CCException
+ {
+ return m_scope;
+ }
+ public String getName() throws CCException
+ {
+ return m_data.getName();
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/DefinitionData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/DefinitionData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/DefinitionData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/DefinitionData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+import org.apache.ode.cc.client.DefinitionState;
+
+
+public class DefinitionData implements Serializable
+{
+
+ static final long serialVersionUID = -2744350622781004507L;
+
+ private String m_id;
+ private String m_name;
+ private DefinitionState m_state;
+
+
+
+ public DefinitionData( String iID, String iName,
+ DefinitionState iState )
+ {
+ m_id = iID;
+ m_name = iName;
+ m_state = iState;
+ }
+
+ public DefinitionData()
+ {
+ }
+
+ public void setID( String iID )
+ {
+ m_id = iID;
+ }
+
+ public String getID( )
+ {
+ return m_id;
+ }
+
+ public void setName(String iName)
+ {
+ m_name = iName;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+
+ public void setState( DefinitionState iState )
+ {
+ m_state = iState;
+ }
+
+ public DefinitionState getState()
+ {
+ return m_state;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/EngineData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/EngineData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/EngineData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/EngineData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+import org.apache.ode.cc.client.EngineState;
+
+
+public class EngineData implements Serializable
+{
+ static final long serialVersionUID = -1851035273514785141L;
+
+ private EngineState m_state;
+ private String m_name;
+ private String m_ID;
+ private boolean m_automaticCleanup;
+
+ public EngineData()
+ {
+
+ }
+
+ public EngineData( String iName, String iID, EngineState iState, boolean iAutomaticCleanup )
+ {
+ m_state = iState;
+ }
+
+ public EngineState getState()
+ {
+ return m_state;
+ }
+
+ public void setState( EngineState iState )
+ {
+ m_state = iState;
+ }
+
+ public void setName( String iName )
+ {
+ m_name = iName;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+
+ public void setID( String iID )
+ {
+ m_ID = iID;
+ }
+
+ public String getID()
+ {
+ return m_ID;
+ }
+
+ public boolean getAutomaticCleanup()
+ {
+ return m_automaticCleanup;
+ }
+
+ public void setAutomaticCleanup( boolean iAutomaticCleanup )
+ {
+ m_automaticCleanup = iAutomaticCleanup;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/InstanceData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/InstanceData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/InstanceData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/InstanceData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+import org.apache.ode.cc.client.InstanceState;
+
+
+public class InstanceData implements Serializable
+{
+ static final long serialVersionUID = -1292139018864615305L;
+
+ private InstanceState m_state;
+ private String m_id;
+ private String m_definitionID;
+
+ public InstanceData()
+ {
+ }
+
+ public InstanceData( String iID, String iDefinitionID, InstanceState iState )
+ {
+ m_id = iID;
+ m_state = iState;
+ m_definitionID = iDefinitionID;
+ }
+
+ public void setID( String iID )
+ {
+ m_id = iID;
+ }
+
+ public String getID()
+ {
+ return m_id;
+ }
+
+ public String getDefinitionID()
+ {
+ return m_definitionID;
+ }
+
+ public void setDefinitionID( String iDefinitionID )
+ {
+ m_definitionID = iDefinitionID;
+ }
+
+ public void setState( InstanceState iState )
+ {
+ m_state = iState;
+ }
+
+ public InstanceState getState()
+ {
+ return m_state;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/OperationData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/OperationData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/OperationData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/OperationData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+
+public class OperationData implements Serializable
+{
+
+ static final long serialVersionUID = 7184233691844807142L;
+
+ private String m_portTypeNamespace;
+ private String m_portType;
+ private String m_operation;
+ private String m_staticKey;
+
+ public OperationData(
+ String portTypeNamespace,
+ String portType,
+ String operation,
+ String staticKey)
+ {
+ m_portTypeNamespace = portTypeNamespace;
+ m_portType = portType;
+ m_operation = operation;
+ m_staticKey = staticKey;
+
+ }
+
+ public String getPortTypeNamespace()
+ {
+ return m_portTypeNamespace;
+ }
+
+ public String getPortType()
+ {
+ return m_portType;
+ }
+
+ public String getOperation()
+ {
+ return m_operation;
+ }
+
+ public String getStaticKey()
+ {
+ return m_staticKey;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/PartData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/PartData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/PartData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/PartData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+
+public class PartData implements Serializable
+{
+
+ static final long serialVersionUID = -7855461618668281086L;
+
+ private String m_name;
+
+ public PartData()
+ {
+
+ }
+
+ public PartData( String iName )
+ {
+ m_name = iName;
+ }
+
+ public void setName( String iName )
+ {
+ m_name = iName;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/RegistrationData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/RegistrationData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/RegistrationData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/RegistrationData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+
+public class RegistrationData implements Serializable
+{
+ static final long serialVersionUID = -6816714273398328712L;
+
+ private InstanceData m_instanceData;
+ private String m_operation;
+ private String m_portType;
+ private String m_targetNamespace;
+ private String m_dynamicKey;
+ private String m_name;
+
+ public RegistrationData()
+ {
+ }
+
+ public RegistrationData(InstanceData data, String iName, String operation,
+ String type,
+ String namespace, String key)
+ {
+ m_instanceData = data;
+ m_operation = operation;
+ m_portType = type;
+ m_targetNamespace = namespace;
+ m_dynamicKey = key;
+ }
+ public String getDynamicKey()
+ {
+ return m_dynamicKey;
+ }
+ public void setDynamicKey(String key)
+ {
+ m_dynamicKey = key;
+ }
+ public InstanceData getInstanceData()
+ {
+ return m_instanceData;
+ }
+ public void setInstanceData(InstanceData data)
+ {
+ m_instanceData = data;
+ }
+ public String getOperation()
+ {
+ return m_operation;
+ }
+ public void setOperation(String operation)
+ {
+ m_operation = operation;
+ }
+ public String getPortType()
+ {
+ return m_portType;
+ }
+ public void setPortType(String type)
+ {
+ m_portType = type;
+ }
+ public String getTargetNamespace()
+ {
+ return m_targetNamespace;
+ }
+ public void setTargetNamespace(String namespace)
+ {
+ m_targetNamespace = namespace;
+ }
+ public String getName()
+ {
+ return m_name;
+ }
+ public void setName( String iName )
+ {
+ m_name = iName;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/ScopeData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/ScopeData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/ScopeData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/ScopeData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+
+public class ScopeData implements Serializable
+{
+
+ static final long serialVersionUID = 3436317860567815149L;
+
+ private String m_instanceID;
+ private ArrayList m_path;
+ private String m_name;
+
+ public ScopeData()
+ {
+ }
+
+ public ScopeData( String iInstanceID, ArrayList iPath, String iName )
+ {
+ m_instanceID = iInstanceID;
+ m_path = iPath;
+ m_name = iName;
+ }
+
+ public String getInstanceID()
+ {
+ return m_instanceID;
+ }
+
+ public void setInstanceID( String iInstanceID )
+ {
+ m_instanceID = iInstanceID;
+ }
+
+ public ArrayList getPath()
+ {
+ return m_path;
+ }
+
+ public void setPath( ArrayList iPath )
+ {
+ m_path = iPath;
+ }
+
+ public void setName( String iName )
+ {
+ m_name = iName;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/VariableData.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/VariableData.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/VariableData.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/data/VariableData.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.data;
+
+import java.io.Serializable;
+
+
+
+public class VariableData implements Serializable
+{
+
+ static final long serialVersionUID = 6745387099208735618L;
+
+ private ScopeData m_scopeData;
+ private String m_name;
+
+ public VariableData()
+ {
+
+ }
+ public VariableData( ScopeData iScopeData, String iName)
+ {
+ m_name = iName;
+ m_scopeData = iScopeData;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+
+ public void setName( String iName)
+ {
+ m_name = iName;
+ }
+
+ public ScopeData getScopeData()
+ {
+ return m_scopeData;
+ }
+
+ public void setScopeData( ScopeData iScopeData )
+ {
+ m_scopeData = iScopeData;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceBean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceBean.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceBean.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceBean.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.ejb;
+
+import java.rmi.RemoteException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.cc.base.CCServiceBase;
+import org.apache.ode.util.BPException;
+
+/**
+ *
+ * This bean can start definitions.
+ * @ejb:bean
+ * type="Stateless"
+ * name="CCService"
+ * jndi-name="BPE/CCService"
+ * view-type="remote"
+ *
+ * @ejb.transaction type="Required"
+ *
+ * @ejb.ejb-ref
+ * --ejb-name="EngineState"
+ * ejb-name="EngineStateCoarse"
+ * view-type="local"
+ * ref-name="theEngineState"
+ *
+ * @ejb.ejb-ref
+ * ejb-name="RegistrationEntity"
+ * view-type="local"
+ * ref-name="registrationBean"
+ *
+ * @ejb.ejb-ref
+ * ejb-name="BPE_CMPBLOB"
+ * view-type="local"
+ * ref-name="theCMPObjectBean"
+ *
+ * @ejb.ejb-ref
+ * ejb-name="BPEventDirector"
+ * view-type="local"
+ * ref-name="theLocalBPEDBean"
+ *
+ */
+public class CCServiceBean extends CCServiceBase implements SessionBean
+{
+
+ static final long serialVersionUID = -1304129724404194169L;
+
+
+ private static Logger logger =
+ Logger.getLogger(CCServiceBean.class.getName());
+
+ public void setSessionContext(SessionContext arg0) throws EJBException,
+ RemoteException
+ {
+ // TODO Auto-generated method stub
+
+ }
+ /**
+ *
+ * @ejb.create-method
+ */
+ public void ejbCreate()
+ {
+ }
+
+ /**
+ *
+ * @ejb.interface-method
+ */
+ public void init(String packageName)
+ {
+ try {
+ eventDirector = EventDirectorFactory.createRemoteEventDirector(packageName,true);
+ m_intED = eventDirector.getIInternalEventDirector();
+ } catch (BPException e) {
+ logger.log(Level.SEVERE,"",e);
+ }
+ }
+ public void ejbRemove() throws EJBException, RemoteException
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ // TODO Auto-generated method stub
+
+ }
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceRemoteProxy.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceRemoteProxy.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceRemoteProxy.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/ejb/CCServiceRemoteProxy.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,455 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.ejb;
+
+import java.rmi.RemoteException;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IBundle;
+import org.apache.ode.cc.data.DefinitionData;
+import org.apache.ode.cc.data.EngineData;
+import org.apache.ode.cc.data.InstanceData;
+import org.apache.ode.cc.data.PartData;
+import org.apache.ode.cc.data.ScopeData;
+import org.apache.ode.cc.data.VariableData;
+import org.apache.ode.cc.service.ICCService;
+
+
+public class CCServiceRemoteProxy implements ICCService
+{
+ private CCService remoteService;
+ public CCServiceRemoteProxy(String pkgName) throws CCException
+ {
+ try
+ {
+
+ InitialContext ic = new InitialContext();
+ Object o = ic.lookup(pkgName+ "/CCService");
+ CCServiceHome pdHome = (CCServiceHome) PortableRemoteObject
+ .narrow(o, CCServiceHome.class);
+ remoteService = pdHome.create();
+ remoteService.init(pkgName);
+ }
+ catch( Exception e )
+ {
+ throw new CCException(e);
+ }
+
+
+ }
+ public Collection getDefinitionData() throws CCException
+ {
+ try
+ {
+ return remoteService.getDefinitionData();
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+
+ }
+ public Collection getInstancesData(String iDefinitionID) throws CCException
+ {
+ try
+ {
+ return remoteService.getInstancesData(iDefinitionID);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void cleanupNow() throws CCException
+ {
+ try
+ {
+ remoteService.cleanupNow();
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void cleanCompletedSince(Date iDate) throws CCException
+ {
+ try
+ {
+ remoteService.cleanup(iDate);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void pauseEngine() throws CCException
+ {
+ try
+ {
+ remoteService.pauseEngine();
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void resumeEngine() throws CCException
+ {
+ try
+ {
+ remoteService.resumeEngine();
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Collection deployBundle(IBundle source)
+ throws CCException
+ {
+ try
+ {
+ return remoteService.deployBundle(source);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public InstanceData getInstanceData(String instanceID) throws CCException
+ {
+ try
+ {
+ return remoteService.getInstanceData(instanceID);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public DefinitionData getDefinitionData(String definitionID)
+ throws CCException
+ {
+ try
+ {
+ return remoteService.getDefinitionData(definitionID);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void deactivateDefinition(DefinitionData data) throws CCException
+ {
+ try
+ {
+ remoteService.deactivateDefinition(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void activateDefinition(DefinitionData data) throws CCException
+ {
+ try
+ {
+ remoteService.activateDefinition(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void removeDefinition(DefinitionData data) throws CCException
+ {
+ try
+ {
+ remoteService.removeDefinition(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public EngineData getEngineData() throws CCException
+ {
+ try
+ {
+ return remoteService.getEngineData();
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public DefinitionData getDefinitionForInstance(String instanceID)
+ throws CCException
+ {
+ try
+ {
+ return remoteService.getDefinitionForInstance(instanceID);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void pauseInstance(InstanceData data) throws CCException
+ {
+ try
+ {
+ remoteService.pauseInstance(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void terminateInstance(InstanceData data) throws CCException
+ {
+ try
+ {
+ remoteService.terminateInstance(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void resumeInstance(InstanceData data) throws CCException
+ {
+ try
+ {
+ remoteService.resumeInstance(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void removeInstance(InstanceData data) throws CCException
+ {
+ try
+ {
+ remoteService.removeInstance(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public ScopeData getContextScopeData(InstanceData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getContextScopeData(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Collection getChildScopes(ScopeData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getChildScopes(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Collection getVariables(ScopeData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getVariables(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Collection getRegistrations(InstanceData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getRegistrations(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Collection getPartData(VariableData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getPartData(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void cleanup(Date completionDate) throws CCException
+ {
+ try
+ {
+ remoteService.cleanup(completionDate);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Object getPartValue(PartData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getPartValue(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public void setAutomaticCleanup(boolean automaticCleanup)
+ throws CCException
+ {
+ try
+ {
+ remoteService.setAutomaticCleanup(automaticCleanup);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Map getDefinitionStatistics(DefinitionData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getDefinitionStatistics(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Map getEngineStatistics(EngineData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getEngineStatistics(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Map getInstanceStatistics(InstanceData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getInstanceStatistics(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+ public Collection getProcessCreatingOperations(DefinitionData data) throws CCException
+ {
+ try
+ {
+ return remoteService.getProcessCreatingOperations(data);
+ } catch (RemoteException e)
+ {
+ throw new CCException(e);
+ } catch (CCException e)
+ {
+ throw e;
+ }
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/CCServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/CCServiceFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/CCServiceFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/CCServiceFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.service;
+
+import java.util.Properties;
+
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.cc.base.CCServiceBase;
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.ejb.CCServiceRemoteProxy;
+import org.apache.ode.cc.service.ICCServiceFactory;
+
+
+
+public class CCServiceFactory implements ICCServiceFactory
+{
+ private static ICCServiceFactory cachedFactory;
+ private CCServiceFactory()
+ {
+ }
+
+ public static ICCServiceFactory newInstance()
+ {
+ if ( cachedFactory == null )
+ {
+ return CreateCCServiceFactory();
+ }
+ return cachedFactory;
+ }
+
+ public ICCService createCCService(String pgkName) throws CCException
+ {
+ return createCCService(pgkName,new Properties());
+ }
+
+ public ICCService createCCService(Properties props) throws CCException
+ {
+ return createCCService("BPE",props);
+ }
+
+ public ICCService createCCService() throws CCException
+ {
+ return createCCService("BPE");
+ }
+
+ public ICCService createCCService(String pgkName, Properties props) throws CCException
+ {
+ ICCService returnValue = null;
+
+ boolean remote = true;
+ String jnfi_value = System.getProperty(EventDirectorFactory.JNFI);
+ if (jnfi_value != null &&
+ jnfi_value.compareTo(EventDirectorFactory.IMJNFI) == 0)
+ {
+ remote = false;
+ }
+ if ( remote )
+ {
+ returnValue=
+ new CCServiceRemoteProxy(pgkName);
+ }
+ else
+ {
+ returnValue = new CCServiceBase(props);
+ }
+
+ return returnValue;
+ }
+
+ private static ICCServiceFactory CreateCCServiceFactory()
+ {
+ if ( cachedFactory == null )
+ {
+ cachedFactory = new CCServiceFactory();
+ }
+ return cachedFactory;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.service;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IBundle;
+import org.apache.ode.cc.data.DefinitionData;
+import org.apache.ode.cc.data.EngineData;
+import org.apache.ode.cc.data.InstanceData;
+import org.apache.ode.cc.data.PartData;
+import org.apache.ode.cc.data.ScopeData;
+import org.apache.ode.cc.data.VariableData;
+
+
+/**
+* Pluggable command and control service
+* implementations must satisfy this interface.
+* The tiered client facade
+* funnels all calls through this interface.
+*/
+public interface ICCService
+{
+
+ /**
+ * @return
+ * Collection containing definition data for all the
+ * definitions deployed in the server.
+ */
+ public Collection getDefinitionData() throws CCException;
+
+ /**
+ * @param iBPDefinitionID
+ * @return
+ * Collection containing instance data for all
+ * the instances associated with the definition id.
+ */
+ public Collection getInstancesData( String iDefinitionID ) throws CCException;
+
+ public void cleanupNow() throws CCException;
+
+ public void cleanCompletedSince( Date iDate ) throws CCException;
+
+ public void pauseEngine() throws CCException;
+
+ public void resumeEngine() throws CCException;
+
+ public Collection deployBundle( IBundle source ) throws CCException;
+
+ public InstanceData getInstanceData(String instanceID) throws CCException;
+
+ public DefinitionData getDefinitionData(String definitionID) throws CCException;
+
+ public void deactivateDefinition(DefinitionData data) throws CCException;
+
+ public void activateDefinition(DefinitionData data) throws CCException;
+
+ public void removeDefinition(DefinitionData data) throws CCException;
+
+ public EngineData getEngineData() throws CCException;
+
+ public DefinitionData getDefinitionForInstance(String instanceID) throws CCException;
+
+ public void pauseInstance(InstanceData data) throws CCException;
+
+ public void terminateInstance(InstanceData data) throws CCException;
+
+ public void resumeInstance(InstanceData data) throws CCException;
+
+ public void removeInstance(InstanceData data) throws CCException;
+
+ public ScopeData getContextScopeData(InstanceData data) throws CCException;
+
+ public Collection getChildScopes(ScopeData data) throws CCException;
+
+ public Collection getVariables(ScopeData data) throws CCException;
+
+ public Collection getRegistrations(InstanceData data) throws CCException;
+
+ public Collection getPartData(VariableData data) throws CCException;
+
+ public Collection getProcessCreatingOperations(DefinitionData data )
+ throws CCException;
+
+ public Object getPartValue(PartData data) throws CCException;
+
+ public void setAutomaticCleanup(boolean automaticCleanup) throws CCException;
+
+ public Map getDefinitionStatistics(DefinitionData data) throws CCException;
+
+ public Map getEngineStatistics(EngineData data) throws CCException;
+
+ public Map getInstanceStatistics(InstanceData data) throws CCException;
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCServiceFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCServiceFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/service/ICCServiceFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.service;
+import java.util.Properties;
+
+import org.apache.ode.cc.client.CCException;
+
+
+
+public interface ICCServiceFactory
+{
+ public ICCService createCCService(
+ )throws CCException;
+
+ public ICCService createCCService( String engineName
+ )throws CCException;
+
+ public ICCService createCCService(Properties props
+ ) throws CCException;
+
+ public ICCService createCCService(String engineName, Properties props
+ ) throws CCException;
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCNode.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCNode.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCNode.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCNode.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+
+public class CCNode implements Serializable
+{
+ static final long serialVersionUID = 7819838963165367584L;
+
+ private HashMap m_properties = new HashMap();
+ private LinkedList m_children = new LinkedList();
+ private String m_name;
+ private Object m_value;
+
+ public CCNode( String iName )
+ {
+ m_name = iName;
+ }
+ public String getName()
+ {
+ return m_name;
+ }
+ public void addProperty( String iName, Object iValue)
+ {
+ m_properties.put( iName, iValue );
+ }
+ public HashMap getProperties()
+ {
+ return m_properties;
+ }
+ public Collection getChildren()
+ {
+ return m_children;
+ }
+ public CCNode createChild(String iName)
+ {
+ CCNode newChild = new CCNode( iName );
+ m_children.add( newChild );
+ return newChild;
+ }
+ public void setValue( Object iObject )
+ {
+ m_value = iObject;
+ }
+ public Object getValue()
+ {
+ return m_value;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCReader.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCReader.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCReader.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCReader.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.apache.ode.cc.client.IDefinition;
+import org.apache.ode.cc.client.IEngine;
+import org.apache.ode.cc.client.IInstance;
+import org.apache.ode.cc.client.IProcessCreatingOperation;
+import org.apache.ode.cc.client.IRegistration;
+import org.apache.ode.cc.client.IScope;
+import org.apache.ode.cc.client.IStatistical;
+import org.apache.ode.cc.client.IVariable;
+import org.apache.ode.cc.client.IVariablePart;
+public class CCReader
+{
+ private CCTreeBuilder m_treeBuilder;
+
+ public static final String NAME = "name";
+ public static final String ID = "id";
+ public static final String STATE = "state";
+ public static final String VALUE = "value";
+ public static final String DEF = "definition";
+ public static final String ENGINE = "engine";
+ public static final String INSTANCE = "instance";
+ public static final String SCOPE = "scope";
+ public static final String VARIABLE = "variable";
+ public static final String PART = "part";
+ public static final String REGISTRATION = "registration";
+ public static final String PORT_TYPE = "portType";
+ public static final String OPERATION = "operation";
+ public static final String NAMESPACE = "namespace";
+ public static final String DYNAMIC_KEY = "dynamicKey";
+ public static final String STATISTIC = "statistic";
+ public static final String PROCESS_CREATING_OPERATION =
+ "processCreatingOperation";
+ public static final String STATIC_KEY =
+ "staticKey";
+ public static final String PCO = "processCreatingOperations";
+ public static final String PROCESS_INSTANCES = "processInstances";
+
+ public CCReader()
+ {
+ }
+
+ public CCNode readEngine(IEngine iEngine) throws Exception
+ {
+ m_treeBuilder = new CCTreeBuilder();
+ m_treeBuilder.pushChild( ENGINE );
+ readStatistics(iEngine);
+
+ Collection definitions = iEngine.getDefinitions();
+ Iterator definitionIter = definitions.iterator();
+ while (definitionIter.hasNext())
+ {
+ m_treeBuilder.addProperty( NAME, iEngine.getName() );
+ m_treeBuilder.addProperty( ID, iEngine.getID() );
+ m_treeBuilder.addProperty( STATE, iEngine.getState() );
+ IDefinition def = (IDefinition) definitionIter.next();
+ readDefinition(def);
+ }
+
+ return m_treeBuilder.getTree();
+ }
+
+
+
+ private void readStatistics(IStatistical statistical )
+ throws Exception
+ {
+ Map stats = statistical.getStatistics();
+ Set entrySet = stats.entrySet();
+ Iterator iter = entrySet.iterator();
+ while( iter.hasNext())
+ {
+ Entry entry = (Entry )(iter.next());
+ String name = ( String )(entry.getKey());
+ Object value = entry.getValue();
+ m_treeBuilder.pushChild(STATISTIC);
+ m_treeBuilder.addProperty(name, value);
+ m_treeBuilder.pop();
+ }
+
+ }
+
+ private void readDefinition(IDefinition def) throws Exception
+ {
+ m_treeBuilder.pushChild(DEF);
+ readStatistics(def);
+ m_treeBuilder.addProperty(NAME, def.getName());
+ m_treeBuilder.addProperty(ID, def.getID());
+ m_treeBuilder.addProperty(STATE, def.getState());
+
+ Collection creatingOperations =
+ def.getProcessCreatingOperations();
+ Iterator operationIter = creatingOperations.iterator();
+ m_treeBuilder.pushChild( PCO );
+ while( operationIter.hasNext())
+ {
+ IProcessCreatingOperation pco =
+ (IProcessCreatingOperation)operationIter.next();
+ readOperation(pco);
+ }
+ m_treeBuilder.pop();
+
+
+ m_treeBuilder.pushChild( PROCESS_INSTANCES );
+ Collection instances = def.getInstances();
+ Iterator instanceIterator = instances.iterator();
+ while (instanceIterator.hasNext())
+ {
+ IInstance instance = (IInstance) instanceIterator.next();
+ readInstance(instance);
+ }
+ m_treeBuilder.pop();
+
+ m_treeBuilder.pop();
+ }
+
+
+ public CCNode readInstanceNode( IInstance instance, boolean recursive )
+ throws Exception
+
+ {
+ m_treeBuilder = new CCTreeBuilder();
+ readInstance( instance, recursive );
+ return m_treeBuilder.getTree();
+ }
+
+ private void readInstance( IInstance instance ) throws Exception
+ {
+ readInstance( instance, true);
+ }
+
+ private void readInstance(IInstance instance, boolean recursive) throws Exception
+ {
+ m_treeBuilder.pushChild(INSTANCE);
+
+ readStatistics(instance );
+
+ if ( recursive )
+ {
+ Collection registrations = instance.getRegistrations();
+ Iterator regIter = registrations.iterator();
+ while( regIter.hasNext() )
+ {
+ IRegistration nextReg = ( IRegistration )
+ ( regIter.next());
+ readRegistration( nextReg );
+ }
+ }
+
+ m_treeBuilder.addProperty(ID, instance.getID());
+ m_treeBuilder.addProperty(STATE, instance.getState());
+
+ if ( recursive)
+ {
+ IScope scope = instance.getRootContext();
+ readScope( scope );
+ }
+
+ m_treeBuilder.pop();
+ }
+ private void readRegistration(IRegistration registration)
+ {
+ m_treeBuilder.pushChild(REGISTRATION);
+
+ m_treeBuilder.addProperty(OPERATION,
+ registration.getOperation());
+ m_treeBuilder.addProperty(PORT_TYPE,
+ registration.getPortType());
+ m_treeBuilder.addProperty(NAMESPACE,
+ registration.getTargetNamespace());
+ m_treeBuilder.addProperty(DYNAMIC_KEY,
+ registration.getDynamicKey());
+ m_treeBuilder.addProperty(NAME,
+ registration.getName());
+
+ m_treeBuilder.pop();
+ }
+ private void readScope(IScope scope) throws Exception
+ {
+ if ( scope == null) { return; }
+ m_treeBuilder.pushChild(SCOPE);
+
+ m_treeBuilder.addProperty(NAME, scope.getName() );
+
+ Collection variables = scope.getVariables();
+ Iterator variableIter = variables.iterator();
+ while( variableIter.hasNext() )
+ {
+ readVariable( ( IVariable )variableIter.next() );
+ }
+
+ Collection childScopes = scope.getChildScopes();
+ Iterator scopeIter = childScopes.iterator();
+ while( scopeIter.hasNext() )
+ {
+ readScope( ( IScope )scopeIter.next() );
+ }
+
+ m_treeBuilder.pop();
+
+ }
+
+ private void readVariable(IVariable iVariable) throws Exception
+ {
+ m_treeBuilder.pushChild(VARIABLE);
+
+ m_treeBuilder.addProperty( NAME, iVariable.getName() );
+ Collection parts = iVariable.getParts();
+ Iterator partIterator = parts.iterator();
+ while( partIterator.hasNext() )
+ {
+ readPart( (IVariablePart)(partIterator.next()));
+ }
+
+ m_treeBuilder.pop();
+
+ }
+
+ private void readPart(IVariablePart part) throws Exception
+ {
+ m_treeBuilder.pushChild(PART, part.getValue());
+ m_treeBuilder.addProperty( NAME, part.getName());
+ m_treeBuilder.pop();
+ }
+
+ private void readOperation( IProcessCreatingOperation operation )
+ {
+ m_treeBuilder.pushChild(PROCESS_CREATING_OPERATION);
+ m_treeBuilder.addProperty(OPERATION,
+ operation.getOperationName());
+ m_treeBuilder.addProperty(NAMESPACE,
+ operation.getPortTypeNamespace());
+ m_treeBuilder.addProperty(PORT_TYPE,
+ operation.getPortType() );
+ m_treeBuilder.addProperty(STATIC_KEY,
+ operation.getStaticKey());
+ m_treeBuilder.pop();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializer.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializer.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializer.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializer.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util;
+
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Iterator;
+
+
+public class CCSerializer
+{
+ private SerializationContext m_context;
+ private OutputStream m_outputStream;
+
+ public CCSerializer( OutputStream iOutputStream )
+ {
+ m_outputStream = iOutputStream;
+ m_context = new SerializationContext( m_outputStream );
+ }
+
+ public void serializeTree( CCNode iNode )
+ {
+ m_context.startTag( iNode.getName(), iNode.getProperties(), iNode.getValue());
+ Collection childCollection = iNode.getChildren();
+ Iterator childIter = childCollection.iterator();
+ while( childIter.hasNext())
+ {
+ serializeTree( ( CCNode ) ( childIter.next()));
+ }
+ m_context.endTag( iNode.getName());
+ }
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializerApp.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializerApp.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializerApp.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCSerializerApp.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util;
+
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+import org.apache.ode.cc.client.CCClient;
+import org.apache.ode.cc.client.IEngine;
+
+
+public class CCSerializerApp
+{
+ public static void main(String[] args) throws Exception
+ {
+ CCClient ccc = new CCClient();
+ IEngine engine = ccc.getEngine();
+ CCReader ccs = new CCReader( );
+ CCNode node = ccs.readEngine( engine );
+ OutputStream output = System.out;
+ if ( args.length > 0 )
+ {
+ FileOutputStream fos =
+ new FileOutputStream( args[0] );
+ output = fos;
+ }
+ CCSerializer serializer = new CCSerializer( output );
+ serializer.serializeTree(node);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCTreeBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCTreeBuilder.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCTreeBuilder.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/CCTreeBuilder.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util;
+import java.util.Stack;
+
+
+public class CCTreeBuilder
+{
+ private CCNode m_root;
+ private CCNode m_currentNode;
+ private Stack m_nodeStack = new Stack();
+
+ public CCNode getTree()
+ {
+ return m_root;
+ }
+
+ public CCTreeBuilder( )
+ {
+ }
+
+ public void pushChild( String iChildName )
+ {
+ pushChild( iChildName, null);
+ }
+
+ public void pushChild( String iChildName, Object iValue )
+ {
+ if ( m_root == null )
+ {
+ m_root = new CCNode( iChildName );
+ m_currentNode = m_root;
+ }
+ else
+ {
+ m_currentNode = m_currentNode.createChild( iChildName );
+ }
+ m_currentNode.setValue( iValue );
+ m_nodeStack.push( m_currentNode );
+ }
+
+ public void addProperty( String iName, Object iValue)
+ {
+ m_currentNode.addProperty( iName, iValue );
+ }
+
+
+ public void pop()
+ {
+ if ( m_nodeStack.peek() != null )
+ {
+ m_nodeStack.pop();
+ if ( !m_nodeStack.empty())
+ {
+ m_currentNode = (CCNode)m_nodeStack.peek();
+ }
+ }
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/SerializationContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/SerializationContext.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/SerializationContext.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/SerializationContext.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Map.Entry;
+
+
+public class SerializationContext
+{
+ public SerializationContext( OutputStream iOutputStream )
+ {
+ try
+ {
+ m_printStream = new PrintStream( iOutputStream, false, "UTF-8" );
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException ("Unable to create PrintStream.");
+ }
+ }
+
+ public void incrementIndent()
+ {
+ m_indentCount++;
+ }
+
+ public void decrementIndent()
+ {
+ m_indentCount--;
+ }
+
+ public void startTag(String iTagName, HashMap iProperties,
+ Object iValue)
+ {
+ print( "<"+ iTagName );
+ if ( iProperties != null )
+ {
+ Set props = iProperties.entrySet();
+ Iterator entryIter = props.iterator();
+ while( entryIter.hasNext())
+ {
+ Entry property = (Entry)entryIter.next();
+ print(" " + property.getKey() + "=" + "\""+ property.getValue() + "\"");
+ }
+ }
+ println(">");
+ incrementIndent();
+ if ( iValue != null )
+ {
+ println( iValue.toString());
+ }
+
+ }
+
+ public void endTag(String iTagName)
+ {
+ decrementIndent();
+ println( "</" + iTagName + ">" );
+ }
+
+
+ public void println( String iString )
+ {
+ if( m_bShouldIndent == true )
+ {
+ doIndent1();
+ }
+ m_printStream.println( iString );
+
+ // Always indent after a new line
+ m_bShouldIndent = true;
+ }
+
+ protected void doIndent1( )
+ {
+ for ( int i = 0; i < m_indentCount; i++ )
+ {
+ m_printStream.print(" ");
+ }
+ }
+
+ public void print( String iString )
+ {
+ if( m_bShouldIndent == true )
+ {
+ doIndent1();
+ m_bShouldIndent = false;
+ }
+ m_printStream.print( iString );
+ }
+
+ protected PrintStream m_printStream;
+ protected boolean m_bShouldIndent = true;
+ protected int m_indentCount = 0;
+ /**
+ * @param string
+ */
+ public void startEndTag(String iTagName, String iValue)
+ {
+ startEndTag( iTagName, null, iValue );
+ }
+
+ public void startEndTag(String iTagName, HashMap iProperties, String iValue )
+ {
+ print("<" + iTagName);
+
+ if ( iProperties != null )
+ {
+ Set props = iProperties.entrySet();
+ Iterator entryIter = props.iterator();
+ while( entryIter.hasNext())
+ {
+ Entry property = (Entry)entryIter.next();
+ print(" " + property.getKey() + "=" + "\""+ property.getValue() + "\"");
+ }
+ }
+
+ print(">");
+
+ if (iValue != null)
+ {
+ print(iValue.toString());
+ }
+ println("</" + iTagName + ">");
+ }
+
+ /**
+ * @param string
+ */
+ public void startTag(String string)
+ {
+ startTag( string, null, null);
+
+ }
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ActivateAllDefinitions.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ActivateAllDefinitions.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ActivateAllDefinitions.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ActivateAllDefinitions.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IDefinition;
+
+
+public class ActivateAllDefinitions extends AllDefinitionOperationBase
+{
+
+ protected void invokePerDefinition(IDefinition definition)
+ throws CCException
+ {
+ definition.activate();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllDefinitionOperationBase.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllDefinitionOperationBase.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllDefinitionOperationBase.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllDefinitionOperationBase.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IDefinition;
+
+
+public abstract class AllDefinitionOperationBase extends CCOpBase
+{
+
+ public void invoke()
+ {
+ try
+ {
+ Collection definitions =
+ m_util.getEngine().getDefinitions();
+ Iterator iter = definitions.iterator();
+ while( iter.hasNext() )
+ {
+ IDefinition definition = ( IDefinition )iter.next();
+ invokePerDefinition(definition);
+ }
+ }
+ catch( CCException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ protected abstract void
+ invokePerDefinition(IDefinition definition) throws CCException;
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllInstanceOperationBase.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllInstanceOperationBase.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllInstanceOperationBase.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/AllInstanceOperationBase.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.
+*/
+/*
+ * Created on Sep 27, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.cc.util.ops;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IInstance;
+
+
+public abstract class AllInstanceOperationBase extends CCOpBase
+{
+
+ public void invoke()
+ {
+ Collection instances = m_util.getAllInstances();
+ Iterator iter = instances.iterator();
+ while( iter.hasNext() )
+ {
+ IInstance instance = ( IInstance )( iter.next() );
+ try
+ {
+ invokePerInstanceOperation( instance );
+ } catch (CCException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+ protected abstract void
+ invokePerInstanceOperation( IInstance instance ) throws CCException;
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCOpBase.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCOpBase.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCOpBase.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCOpBase.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import java.util.Properties;
+
+
+public abstract class CCOpBase implements ICCOp
+{
+ protected Properties m_args;
+ protected CCUtil m_util;
+
+
+ public void setArgs(Properties args)
+ {
+ m_args = args;
+ }
+
+
+ public void setConnection( CCUtil util )
+ {
+ m_util = util;
+ }
+
+ public String getOpArg()
+ {
+ String op = m_args.getProperty( "op", "" );
+ return op;
+ }
+
+ public boolean supports(Properties args)
+ {
+
+ if (args.size() >= getArgCount() &&
+ args.getProperty("op","").
+ equalsIgnoreCase(getName()))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected String getInstanceIDArg()
+ {
+ String instanceID = m_args.getProperty( "instanceID" );
+ return instanceID;
+ }
+
+ public String getName()
+ {
+ String className = this.getClass().getName();
+ String[] namebits = className.split("\\.");
+ String name = namebits[namebits.length-1];
+ return name;
+ }
+
+ public String getUsage()
+ {
+ return "op."+getName();
+ }
+ public int getArgCount()
+ {
+ return 1;
+ }
+
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCUtil.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCUtil.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/CCUtil.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import org.apache.ode.cc.client.CCClient;
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.ICCClient;
+import org.apache.ode.cc.client.IDefinition;
+import org.apache.ode.cc.client.IEngine;
+import org.apache.ode.cc.client.IInstance;
+
+
+public class CCUtil
+{
+ private HashMap m_operations = new HashMap();
+ private String m_args[];
+ private Properties m_argumentProperties = new Properties();
+ private ICCClient m_client;
+ private IEngine m_engine;
+
+ private String getPackageName()
+ {
+ return m_argumentProperties.getProperty("pkg",
+ "BPE");
+ }
+
+ private void addOperations()
+ {
+ addOperation( new PauseInstance());
+ addOperation( new QueryInstance());
+ addOperation( new ResumeInstance());
+ addOperation( new PauseAllInstances());
+ addOperation( new ResumeAllInstances());
+ addOperation( new TerminateAllInstances());
+ addOperation( new RemoveAllInstances());
+ addOperation( new QueryEngine());
+ addOperation( new ActivateAllDefinitions());
+ addOperation( new DeactivateAllDefinitions());
+ addOperation( new RemoveAllDefinitions());
+ }
+
+ public CCUtil(String[] args)
+ {
+ m_args = args;
+ buildArgumentProperties(m_args);
+ addOperations();
+
+ }
+
+ private void buildArgumentProperties( String[] args)
+ {
+ for ( int i = 0; i< args.length; i++)
+ {
+ String nv[] = args[i].split("\\.");
+ if ( nv.length == 2 )
+ {
+ m_argumentProperties.put(
+ nv[0], nv[1]);
+ }
+ else
+ {
+ getPrintStream().println("Invalid argument:"+ args[i]);
+ getPrintStream().println("Arguments should be of the form: name=value");
+ }
+ }
+
+ }
+
+ public void addOperation(ICCOp operation)
+ {
+ m_operations.put( operation.getClass().getName(), operation);
+ }
+
+ public static void main( String iArgs[] )
+ {
+ CCUtil util = new CCUtil(iArgs);
+ util.run();
+ }
+
+ private void run()
+ {
+ Iterator iter = m_operations.values().iterator();
+ boolean hit = false;
+ while( iter.hasNext() )
+ {
+ ICCOp operation = ( ICCOp )iter.next();
+ if ( operation.supports(m_argumentProperties) )
+ {
+ hit = true;
+ invokeOperation( operation );
+ getPrintStream().
+ println(operation.getName() +
+ " operation completed normally.");
+
+ }
+ }
+
+
+ if ( !hit )
+ {
+ dumpUsage();
+ }
+
+ }
+
+ public PrintStream getPrintStream()
+ {
+ return System.out;
+ }
+
+ private void dumpUsage()
+ {
+ Iterator iter = m_operations.values().iterator();
+ getPrintStream().println( "Supported usages:");
+ while( iter.hasNext())
+ {
+ ICCOp operation = ( ICCOp ) iter.next();
+ System.out.println( " CCUtil [pkg.<package name>] " + operation.getUsage());
+ }
+ }
+
+ private void invokeOperation( ICCOp operation )
+ {
+ operation.setConnection(this);
+ operation.setArgs(m_argumentProperties);
+ operation.invoke();
+ }
+
+ public OutputStream getOutputStream()
+ {
+ return getPrintStream();
+ }
+
+ private ICCClient getClient()
+ {
+ if (m_client == null)
+ {
+ try
+ {
+ m_client = new CCClient();
+ } catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return m_client;
+ }
+
+ public IEngine getEngine()
+ {
+ if (m_engine == null)
+ {
+ HashMap hm = new HashMap();
+ hm.put(IEngine.ENGINE_NAME, getPackageName());
+ try
+ {
+ m_engine = getClient().getEngine(hm);
+ } catch (CCException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return m_engine;
+ }
+
+ public IInstance getInstance( String instanceID)
+ {
+ try
+ {
+ IEngine engine = getClient().getEngine();
+ IInstance instance = engine.getInstance( instanceID );
+ return instance;
+ }
+ catch( Exception e )
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Collection getAllInstances()
+ {
+ LinkedList instances = new LinkedList();
+ Collection definitions;
+ try
+ {
+ definitions = getClient().getEngine().getDefinitions();
+
+ Iterator iter = definitions.iterator();
+ while (iter.hasNext())
+ {
+ IDefinition definition = (IDefinition) iter.next();
+ Collection defInstances = definition.getInstances();
+ instances.addAll( defInstances);
+ }
+
+ }
+ catch (CCException e)
+ {
+ throw new RuntimeException(e);
+ }
+ //Collection defInstances
+ return instances;
+ }
+
+
+
+}
+
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/DeactivateAllDefinitions.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/DeactivateAllDefinitions.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/DeactivateAllDefinitions.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/DeactivateAllDefinitions.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IDefinition;
+
+
+public class DeactivateAllDefinitions extends AllDefinitionOperationBase
+{
+
+ protected void invokePerDefinition(IDefinition definition)
+ throws CCException
+ {
+ definition.deactivate();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ICCOp.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ICCOp.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ICCOp.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/ICCOp.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import java.util.Properties;
+
+public interface ICCOp
+{
+ public void setArgs( Properties args );
+ public void setConnection(CCUtil client);
+ public void invoke();
+ public String getUsage();
+ public boolean supports( Properties args );
+ public String getName();
+ public int getArgCount();
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/PauseAllInstances.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/PauseAllInstances.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/PauseAllInstances.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/util/ops/PauseAllInstances.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.apache.ode.cc.util.ops;
+
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IInstance;
+
+
+public class PauseAllInstances extends AllInstanceOperationBase
+{
+
+ protected void invokePerInstanceOperation(IInstance instance) throws CCException
+ {
+ instance.pause();
+ }
+}